@zuplo/core 6.40.3 → 6.40.4
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/customer.cli.minified.js +1 -1
- package/index.minified.js +1 -1
- package/package.json +4 -4
package/customer.cli.minified.js
CHANGED
|
@@ -579,7 +579,7 @@ globstar while`,s,K,c,Ne,De),this.matchOne(s.slice(K),c.slice(Ne),f))return this
|
|
|
579
579
|
`),stderr:v.join(`
|
|
580
580
|
`),exitCode:E},"Tar process logs")}}t(n_r,"tarFolder");async function i_r({tarFilePath:a,outputDir:s,logger:c}){let f=[],d=[],v;try{await new Promise((E,A)=>{let O=ndt("sh",["-c",`tar -xvf ${a} -C ${s};`]);O.stdout.on("data",R=>{let W=R.toString().trim();W.length>0&&f.push(W.trim())}),O.stderr.on("data",R=>{let W=R.toString().trim();W.length>0&&d.push(W.trim())}),O.on("close",R=>{v=R,R===0?E():A(new Error(`tar process exited with code ${R}`))}),O.on("error",R=>{A(R)})})}catch(E){throw new Error("Failed to untar file",{cause:E})}finally{c.info({stdout:f.join(`
|
|
581
581
|
`),stderr:d.join(`
|
|
582
|
-
`),exitCode:v},"Untar process logs")}}t(i_r,"untarFile");async function s_r(a){if(await YIe(a))return await wN.rm(a,{recursive:!0})}t(s_r,"deleteFolder");var du=XIe;var SC=jp(KIe(),1);import{readFile as a_r}from"fs/promises";var n7=class extends Error{static{t(this,"CustomResolveError")}},PN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return YQ.$RefParser.dereference(s,{resolve:{json:!0,file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return YQ.$RefParser.bundle(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return YQ.$RefParser.parse(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return YQ.$RefParser.resolve(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Vfe(a,s){return{order:100,canRead(c){let f=l_r(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=odt(c.url)}catch(E){throw new n7(`Malformed URI: ${c.url}`,{cause:E})}try{du.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=odt(c.url)}catch(d){throw new n7(`Malformed URI: ${c.url}`,{cause:d})}try{return await a_r(f)}catch(d){throw new n7(`Error opening file "${f}"`,{cause:d})}}}}t(Vfe,"customResolver");var ZIe=/^win/.test(globalThis.process?globalThis.process.platform:""),o_r=/\//g,c_r=/^(\w{2,}):\/\//i,e8e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function l_r(a){let s=c_r.exec(a);if(s)return s[1].toLowerCase()}t(l_r,"getProtocol");function odt(a,s){a=decodeURI(a);for(let f=0;f<e8e.length;f+=2)a=a.replace(e8e[f],e8e[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),ZIe&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=ZIe?a:"/"+a)),ZIe&&!c&&(a=a.replace(o_r,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(odt,"toFileSystemPath");var cdt="YOUR_KEY_HERE";async function ldt(a){let c=await new PN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return u_r({...a,relativeOpenApiPath:f},c)}t(ldt,"buildPublicOpenApiFile");async function u_r(a,s){d_r({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=__r(c),f_r(c,a),c=p_r(c,a),udt(c,"x-zuplo"),c}t(u_r,"buildRawOpenApiFile");function f_r(a,{deploymentUrl:s,deploymentName:c,environmentType:f}){let d;s?d=new URL(s).hostname:f&&c&&(d=f===Flt.WORKING_COPY?`${c}.${LNe.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${LNe.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(f_r,"addServerHost");function __r(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(Vj in A&&jue(A[Vj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},R=["delete","get","head","patch","post","put","trace","options"];return R.forEach(W=>{let $=A[W];if(!$)return;if(jue($[Vj])){delete O[W];return}let{parameters:K}=$;if(!K)return;let Ne=K.filter(De=>{if(Vj in De&&jue(De[Vj]))return!1;if("$ref"in De){let Se=De.$ref.split("/").pop();return Se?!f.includes(Se):!0}return!0});O[W]={...$,parameters:Ne}}),R.some(W=>!!O[W])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(__r,"removeHiddenRoutesAndParams");function p_r(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,K)=>{let Ne=s.policies?.find(({name:Ct})=>Ct===K);if(!Ne)return $;if(!(Ne.handler.export==="CompositeInboundPolicy"))return $.concat(K);let Se=Ne.handler.options?.policies;return Se?$.concat(Se):$},[]),R=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="ApiAuthKeyInboundPolicy"||K.handler.export==="ApiKeyInboundPolicy")&&!K.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&R.push(K)})}),R.length>0){let $=R.length>0&&R[0].handler&&R[0].handler.options&&R[0].handler.options.authHeader?R[0].handler.options.authHeader:"Authorization",K=R.length>0&&R[0].handler&&R[0].handler.options&&(R[0].handler.options.authScheme||R[0].handler.options.authScheme==="")?R[0].handler.options.authScheme:"Bearer",Ne=K!==""?`${K} ${cdt}`:cdt,De={name:$,in:"header",required:!0,example:Ne,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Ne}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===De.name)||A.parameters.unshift(De):A.parameters=[De];let Se={type:"http",scheme:K.toLowerCase()},Ct="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(br=>"name"in br&&br.type==="apiKey"||"type"in br&&br.type==="http"&&br.scheme===K)||(a.components.securitySchemes={...a.components.securitySchemes,[Ct]:Se}):(a.components||(a.components={}),a.components.securitySchemes={[Ct]:Se});let Tt={[Ct]:[]};A.security?A.security.some(br=>br[Ct]!==void 0)||A.security.unshift(Tt):A.security=[Tt]}let W=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="RateLimitInboundPolicy"||K.handler.export==="ComplexRateLimitInboundPolicy")&&W.push(K)})}),W.length>0){let $={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},K={...$,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:$,RateLimitWithRetryAfter:K},A.responses||(A.responses={});let Ne=W.some(De=>De.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Ne?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(p_r,"enrichSpecWithZuploData");function udt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&udt(a[c],s)}t(udt,"removePropertiesByPrefix");function d_r({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new Tv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new Tv({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new Tv({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(d_r,"assertIsZuploOpenApiSpec");function m_r(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let R=0;R<s.length;R++)s[R]=255;for(let R=0;R<a.length;R++){let W=a.charAt(R),$=W.charCodeAt(0);if(s[$]!==255)throw new TypeError(W+" is ambiguous");s[$]=R}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";let W=0,$=0,K=0,Ne=R.length;for(;K!==Ne&&R[K]===0;)K++,W++;let De=(Ne-K)*v+1>>>0,Se=new Uint8Array(De);for(;K!==Ne;){let br=R[K],Cr=0;for(let Lr=De-1;(br!==0||Cr<$)&&Lr!==-1;Lr--,Cr++)br+=256*Se[Lr]>>>0,Se[Lr]=br%c>>>0,br=br/c>>>0;if(br!==0)throw new Error("Non-zero carry");$=Cr,K++}let Ct=De-$;for(;Ct!==De&&Se[Ct]===0;)Ct++;let Tt=f.repeat(W);for(;Ct<De;++Ct)Tt+=a.charAt(Se[Ct]);return Tt}t(E,"encode");function A(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;let W=0,$=0,K=0;for(;R[W]===f;)$++,W++;let Ne=(R.length-W)*d+1>>>0,De=new Uint8Array(Ne);for(;R[W];){let br=s[R.charCodeAt(W)];if(br===255)return;let Cr=0;for(let Lr=Ne-1;(br!==0||Cr<K)&&Lr!==-1;Lr--,Cr++)br+=c*De[Lr]>>>0,De[Lr]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");K=Cr,W++}let Se=Ne-K;for(;Se!==Ne&&De[Se]===0;)Se++;let Ct=new Uint8Array($+(Ne-Se)),Tt=$;for(;Se!==Ne;)Ct[Tt++]=De[Se++];return Ct}t(A,"decodeUnsafe");function O(R){let W=A(R);if(W)return W;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(m_r,"base");var fdt=m_r;var h_r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Wfe=fdt(h_r);var t8e="2024-09-02",_dt=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function pdt(){return new wS({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:t8e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:_dt[t8e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(pdt,"getMockEnvironment");var wS=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=pdt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(Wfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var g_r=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function ddt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!g_r.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(ddt,"isRestrictedEnvVariableName");function mdt(a){return!!a.startsWith("ZUPLO_")}t(mdt,"isZuploReadableEnvVariableName");var qBr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return wS.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return wS.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return wS.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return wS.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return wS.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return wS.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return wS.instance.build.COMPATIBILITY_DATE}if(!(ddt(c)&&!mdt(c)))return wS.instance.runtime[c]}});function XQ(a,s,c){return`_${u6(`${a}_${s}_${c}`)}`}t(XQ,"getRawOperationDataIdentifierName");function r8e(a,s,c,f){return`_${u6(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(r8e,"getIdForParameterSchema");function n8e(a,s,c){return`_${u6(a.toLowerCase())}_${s.toLowerCase()}_rb_${u6(c.toLowerCase())}`}t(n8e,"getIdForRequestBodySchema");function ZQ(a,s){return`_${u6(a)}_${u6(s)}`}t(ZQ,"getIdForRefSchema");function u6(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(u6,"sanitizedIdentifierName");var Hyt=jp(sht(),1);import ype from"path";var mK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},lmr=/[$_\p{ID_Start}]/u,umr=/[$_\u200C\u200D\p{ID_Continue}]/u,Y8e=".*";function fmr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(fmr,"Re");function cht(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&lmr.test(O)||A!==f+1&&umr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,R=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!fmr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),R=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),R=!0;break}A+=a[O++]}if(R)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(cht,"v");function lht(a,s={}){let c=cht(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${xC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,R=t(Cr=>{if(E<c.length&&c[E].type===Cr)return c[E++].value},"a"),W=t(()=>R("OTHER_MODIFIER")??R("ASTERISK"),"f"),$=t(Cr=>{let Lr=R(Cr);if(Lr!==void 0)return Lr;let{type:yr,index:_r}=c[E];throw new TypeError(`Unexpected ${yr} at ${_r}, expected ${Cr}`)},"d"),K=t(()=>{let Cr="",Lr;for(;Lr=R("CHAR")??R("ESCAPED_CHAR");)Cr+=Lr;return Cr},"T"),Ne=t(Cr=>Cr,"Se"),De=s.encodePart||Ne,Se="",Ct=t(Cr=>{Se+=Cr},"U"),Tt=t(()=>{Se.length&&(d.push(new mK(3,"","",De(Se),"",3)),Se="")},"$"),br=t((Cr,Lr,yr,_r,sr)=>{let Ts=3;switch(sr){case"?":Ts=1;break;case"*":Ts=0;break;case"+":Ts=2;break}if(!Lr&&!yr&&Ts===3){Ct(Cr);return}if(Tt(),!Lr&&!yr){if(!Cr)return;d.push(new mK(3,"","",De(Cr),"",Ts));return}let Di;yr?yr==="*"?Di=Y8e:Di=yr:Di=f;let _o=2;Di===f?(_o=1,Di=""):Di===Y8e&&(_o=0,Di="");let hi;if(Lr?hi=Lr:yr&&(hi=v++),O.has(hi))throw new TypeError(`Duplicate name '${hi}'.`);O.add(hi),d.push(new mK(_o,hi,De(Cr),Di,De(_r),Ts))},"V");for(;E<c.length;){let Cr=R("CHAR"),Lr=R("NAME"),yr=R("REGEX");if(!Lr&&!yr&&(yr=R("ASTERISK")),Lr||yr){let sr=Cr??"";s.prefixes.indexOf(sr)===-1&&(Ct(sr),sr=""),Tt();let Ts=W();br(sr,Lr,yr,"",Ts);continue}let _r=Cr??R("ESCAPED_CHAR");if(_r){Ct(_r);continue}if(R("OPEN")){let sr=K(),Ts=R("NAME"),Di=R("REGEX");!Ts&&!Di&&(Di=R("ASTERISK"));let _o=K();$("CLOSE");let hi=W();br(sr,Ts,Di,_o,hi);continue}Tt(),$("END")}return d}t(lht,"D");function xC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xC,"S");function aht(a){return a&&a.ignoreCase?"ui":"u"}t(aht,"X");function _mr(a,s,c){return uht(lht(a,c),s,c)}t(_mr,"Z");function wB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(wB,"k");function uht(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=xC(A.value):f+=`(?:${xC(A.value)})${wB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${xC(c.delimiter)}]+?`,R=A.value;if(A.type===1?R=O:A.type===0&&(R=Y8e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${R})${wB(A.modifier)}`:f+=`((?:${R})${wB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${xC(A.prefix)}(${R})${xC(A.suffix)})`,f+=wB(A.modifier);continue}f+=`(?:${xC(A.prefix)}`,f+=`((?:${R})(?:`,f+=xC(A.suffix),f+=xC(A.prefix),f+=`(?:${R}))*)${xC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${xC(c.endsWith)}]|$`,v=`[${xC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,aht(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,aht(c))}t(uht,"F");var FN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},pmr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},dmr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function mmr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(mmr,"J");function fht(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(fht,"Q");function hmr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(hmr,"Ee");function _ht(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(_ht,"W");var pht=["ftp","file","http","https","ws","wss"];function dht(a){if(!a)return!0;for(let s of pht)if(a.test(s))return!0;return!1}t(dht,"N");function gmr(a,s){if(a=fht(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(gmr,"te");function ymr(a,s){if(a=fht(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(ymr,"re");function vmr(a,s){return s||a===""?a:_ht(a)?ght(a):hht(a)}t(vmr,"ne");function bmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(bmr,"se");function Smr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Smr,"ie");function Tmr(a,s,c){if(c||a==="")return a;if(s&&!pht.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Tmr,"ae");function Cmr(a,s,c){return mht(s)===a&&(a=""),c||a===""?a:yht(a)}t(Cmr,"oe");function Emr(a,s){return a=hmr(a,":"),s||a===""?a:X8e(a)}t(Emr,"ce");function mht(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(mht,"_");function X8e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(X8e,"y");function xmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(xmr,"le");function Dmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Dmr,"fe");function hht(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(hht,"z");function ght(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(ght,"j");function yht(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(yht,"K");function Amr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Amr,"he");function kmr(a){return a===""?a:new URL(`data:${a}`).pathname}t(kmr,"ue");function wmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(wmr,"de");function Pmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(Pmr,"pe");var Nmr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=cht(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#k()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#k(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,FN),a.encodePart=X8e;let s=_mr(this.#T(),void 0,a);this.#l=dht(s)}},K8e=["protocol","username","password","hostname","port","pathname","search","hash"],ON="*";function oht(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(oht,"ge");function m6(a,s){return s?dK(a):a}t(m6,"b");function pK(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=m6(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=m6(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=m6(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=m6(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=m6(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=m6(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=m6(f.search.substring(1,f.search.length),c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=m6(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Emr(s.protocol,c)),typeof s.username=="string"&&(a.username=Smr(s.username,c)),typeof s.password=="string"&&(a.password=bmr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=vmr(s.hostname,c)),typeof s.port=="string"&&(a.port=Cmr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!mmr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=m6(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Tmr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=ymr(s.search,c)),typeof s.hash=="string"&&(a.hash=gmr(s.hash,c)),a}t(pK,"w");function dK(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(dK,"C");function Imr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Imr,"Oe");function Omr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${Imr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=dK(A.value);continue}v+=`{${dK(A.value)}}${wB(A.modifier)}`;continue}let O=A.hasCustomName(),R=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),W=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!R&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let K=$.value.length>0?$.value[0]:"";R=d.test(K)}else R=!$.hasCustomName();if(!R&&!A.prefix.length&&W&&W.type===3){let K=W.value[W.value.length-1];R=s.prefixes.includes(K)}R&&(v+="{"),v+=dK(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!W||W.type===3||W.modifier!==3||R||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=dK(A.suffix),R&&(v+="}"),A.modifier!==3&&(v+=wB(A.modifier))}return v}t(Omr,"ke");var vht=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new Nmr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:ON,protocol:ON,username:ON,password:ON,hostname:ON,port:ON,search:ON,hash:ON};this.#r=pK(v,a,!0),mht(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of K8e){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,FN),A.encodePart=X8e;break;case"username":Object.assign(A,FN),A.encodePart=xmr;break;case"password":Object.assign(A,FN),A.encodePart=Dmr;break;case"hostname":Object.assign(A,pmr),_ht(O)?A.encodePart=ght:A.encodePart=hht;break;case"port":Object.assign(A,FN),A.encodePart=yht;break;case"pathname":dht(this.#n.protocol)?(Object.assign(A,dmr,d),A.encodePart=Amr):(Object.assign(A,FN,d),A.encodePart=kmr);break;case"search":Object.assign(A,FN,d),A.encodePart=wmr;break;case"hash":Object.assign(A,FN,d),A.encodePart=Pmr;break}try{this.#s[E]=lht(O,A),this.#n[E]=uht(this.#s[E],this.#e[E],A),this.#t[E]=Omr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(R=>R.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?c=pK(c,a,!1):c=pK(c,oht(a,s),!1)}catch{return!1}let f;for(f of K8e)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?c=pK(c,a,!1):c=pK(c,oht(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of K8e){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let R=v[A+1];E[O]=R}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let R of["type","modifier","prefix","value","suffix"]){if(A[R]<O[R])return-1;if(A[R]!==O[R])return 1}return 0},"o"),d=new mK(3,"","","","",3),v=new mK(0,"","","","",3),E=t((A,O)=>{let R=0;for(;R<Math.min(A.length,O.length);++R){let W=f(A[R],O[R]);if(W)return W}return A.length===O.length?0:f(A[R]??d,O[R]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=vht);import{AssertionError as Fmr}from"assert";function h6(a,s){if(a===!1)throw new Fmr({message:s})}t(h6,"assert");var Jc;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Jc||(Jc={}));function PB(a){return a.type===Jc.Object}t(PB,"isAstObject");function g6(a){return a.type===Jc.Property}t(g6,"isAstProperty");function bht(a){return a.type===Jc.Array}t(bht,"isAstArray");function NB(a){return a.type===Jc.Literal}t(NB,"isAstLiteral");function u7(a){if(a===void 0)throw new Error("Node is undefined");if(!PB(a))throw new Error("Node is not object")}t(u7,"assertAstObject");import{findNodeAtLocation as Lmr,getNodeValue as Rmr,printParseErrorCode as Mmr,visit as jmr}from"jsonc-parser";var Bmr={DEFAULT:{allowTrailingComma:!1}};function hK(a,s=[],c=Bmr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),jmr(a,{onObjectBegin:t((O,R,W)=>{f=v({type:"object",offset:O,length:-1,line:R+1,column:W+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,R,W,$,K)=>{f=v({type:"property",offset:R,length:-1,line:$+1,column:K+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:R,length:W,line:$,column:K,parent:f})},"onObjectProperty"),onObjectEnd:t((O,R)=>{d(O+R),f.length=O+R-f.offset,f=f.parent,d(O+R)},"onObjectEnd"),onArrayBegin:t((O,R,W,$)=>{f=v({type:"array",offset:O,length:-1,line:W+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,R)=>{f.length=O+R-f.offset,f=f.parent,d(O+R)},"onArrayEnd"),onLiteralValue:t((O,R,W,$,K)=>{v({type:Umr(O),offset:R,length:W,line:$+1,column:K+1,parent:f,value:O}),d(R+W)},"onLiteralValue"),onSeparator:t((O,R)=>{f.type==="property"&&(O===":"?f.colonOffset=R:O===","&&d(R))},"onSeparator"),onError:t((O,R,W,$,K)=>{s.push({error:O,offset:R,length:W,line:$+1,column:K+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(hK,"parse");function Umr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(Umr,"getNodeType");function Z8e(a,s){return Lmr(a,s)}t(Z8e,"findNodeAtLocation");function gK(a){return Rmr(a)}t(gK,"getNodeValue");function Sht(a){return Mmr(a)}t(Sht,"printParseErrorCode");var yK=class{static{t(this,"AstAdapter")}parse(s){let f=hK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Jc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Jc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){h6(s.children?.length===2,"Invalid property node");let f={type:Jc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Jc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Jc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Rx={createLiteral:t((a,s)=>({type:Jc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Jc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Jc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Jc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Jc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Jc.Array,parent:s,children:[]};for(let f of a)c.children.push(Rx.createLiteral(f,c));return c},"createArrayOfLiterals")};var $mr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,vK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Jc.Array:return this.generateArray(s,c);case Jc.Object:return this.generateObject(s,c);case Jc.Property:return this.generateProperty(s,c);case Jc.Literal:return this.generateLiteral(s,c);case Jc.FunctionCall:return this.generateFunctionCall(s,c);case Jc.Identifier:return this.generateIdentifier(s,c);case Jc.Raw:return this.generateRaw(s,c);case Jc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=$mr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as Jmr}from"@swc/core";import zmr from"fs/promises";var Tht=t(async a=>{let s=new Set;try{let c=await zmr.readFile(a,"utf-8");(await Jmr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var Cht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var eOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Eht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var tOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var rOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var Myt=jp(ayt(),1),jyt=jp(Ryt(),1);var upe=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new jyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Myt.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],R=E[2]?parseInt(E[2]):0,W=E[3],$=isNaN(R)?void 0:c[O][R][W];v={details:{property:O,index:R,field:W,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),R=O[O.length-1];d.message=`Value of property '${R}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var qN=upe.instance;qN.addSchema(rOe,"route-configuration.schema.json");qN.addSchema(Eht,"policy-configuration.schema.json");qN.addSchema(eOe,"policies.schema.json");qN.addSchema(tOe,"open-api-route-configuration.schema.json");qN.addSchema(Cht,"fragments.schema.json");var zqr=qN.compile(rOe),Byt=qN.compile(tOe),g7e=qN.compile(eOe);var fpe=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=g7e(s),this.results}};var _pe=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Byt(s),this.results}};import Qbr from"path";var y7e=/\$import\((.*)\)/,ppe=/\$env\((.*?)\)/g;var T6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},Gbr=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),VN=t((a,s)=>{if(!a)return!1;let c=Gbr(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||g6(A)&&A.name.value===v?!0:v==="{}"?A.type===Jc.Object:v==="[]"?A.type===Jc.Array:!1:!1})},"testPosition");var dpe=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),PB(s)?s.children.forEach(c=>{this.visitor(c)}):bht(s)?s.children.forEach(c=>{this.visitor(c)}):g6(s)&&this.visitor(s.value)}},Uyt=t((a,s,c)=>f=>{if(!g6(f)||!NB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>VN(f,v))){ppe.test(f.value.value)&&s.push(new T6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(ppe).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Jc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(ppe),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Rx.createTemplateString(v,f))}},"getEnvStatementTransformer");var XK="config/routes.json",Kbr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Ybr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],$yt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Xbr="handler/{}/options/{}/rewritePattern",Zbr="handler/{}/options/{}/baseUrl",mpe=class extends dpe{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!g6(s)||!NB(s.value)||typeof s.value.value!="string")&&VN(s,Xbr)){if(!s.parent||!PB(s.parent)){this.errors.push(new T6("Invalid node, expected object",XK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Jyt(c)},d=Rx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!g6(s)||!NB(s.value)||typeof s.value.value!="string")&&VN(s,Zbr)){if(!s.parent||!PB(s.parent)){this.errors.push(new T6("Invalid node, expected object",XK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Jyt(c)},d=Rx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!g6(s)||!NB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!Ybr.some(A=>VN(s,A))&&!$yt.some(A=>VN(s,A))){if(y7e.test(c)){if(s.name.value==="$ref")return;this.errors.push(new T6("An $import() statement is not expected at this location.",XK,s.location,c))}return}let f=y7e.exec(c);if($yt.some(A=>VN(s,A))&&!f)return;if(!f){this.errors.push(new T6("Invalid $import() statement",XK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=Qbr.join("..",d));let v=this.getImportName(d),E={type:Jc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=Uyt(Kbr,this.errors,XK)};function Jyt(a){return`(request, context) => {
|
|
582
|
+
`),exitCode:v},"Untar process logs")}}t(i_r,"untarFile");async function s_r(a){if(await YIe(a))return await wN.rm(a,{recursive:!0})}t(s_r,"deleteFolder");var du=XIe;var SC=jp(KIe(),1);import{readFile as a_r}from"fs/promises";var n7=class extends Error{static{t(this,"CustomResolveError")}},PN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return YQ.$RefParser.dereference(s,{resolve:{json:!0,file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return YQ.$RefParser.bundle(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return YQ.$RefParser.parse(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return YQ.$RefParser.resolve(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Vfe(a,s){return{order:100,canRead(c){let f=l_r(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=odt(c.url)}catch(E){throw new n7(`Malformed URI: ${c.url}`,{cause:E})}try{du.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=odt(c.url)}catch(d){throw new n7(`Malformed URI: ${c.url}`,{cause:d})}try{return await a_r(f)}catch(d){throw new n7(`Error opening file "${f}"`,{cause:d})}}}}t(Vfe,"customResolver");var ZIe=/^win/.test(globalThis.process?globalThis.process.platform:""),o_r=/\//g,c_r=/^(\w{2,}):\/\//i,e8e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function l_r(a){let s=c_r.exec(a);if(s)return s[1].toLowerCase()}t(l_r,"getProtocol");function odt(a,s){a=decodeURI(a);for(let f=0;f<e8e.length;f+=2)a=a.replace(e8e[f],e8e[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),ZIe&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=ZIe?a:"/"+a)),ZIe&&!c&&(a=a.replace(o_r,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(odt,"toFileSystemPath");var cdt="YOUR_KEY_HERE";async function ldt(a){let c=await new PN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return u_r({...a,relativeOpenApiPath:f},c)}t(ldt,"buildPublicOpenApiFile");async function u_r(a,s){d_r({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=__r(c),f_r(c,a),c=p_r(c,a),udt(c,"x-zuplo"),c}t(u_r,"buildRawOpenApiFile");function f_r(a,{deploymentUrl:s,deploymentName:c,environmentType:f}){let d;s?d=new URL(s).hostname:f&&c&&(d=f===Flt.WORKING_COPY?`${c}.${LNe.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${LNe.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(f_r,"addServerHost");function __r(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(Vj in A&&jue(A[Vj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},R=["delete","get","head","patch","post","put","trace","options"];return R.forEach(W=>{let $=A[W];if(!$)return;if(jue($[Vj])){delete O[W];return}let{parameters:K}=$;if(!K)return;let Ne=K.filter(De=>{if(Vj in De&&jue(De[Vj]))return!1;if("$ref"in De){let Se=De.$ref.split("/").pop();return Se?!f.includes(Se):!0}return!0});O[W]={...$,parameters:Ne}}),R.some(W=>!!O[W])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(__r,"removeHiddenRoutesAndParams");function p_r(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,K)=>{let Ne=s.policies?.find(({name:Ct})=>Ct===K);if(!Ne)return $;if(!(Ne.handler.export==="CompositeInboundPolicy"))return $.concat(K);let Se=Ne.handler.options?.policies;return Se?$.concat(Se):$},[]),R=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="ApiAuthKeyInboundPolicy"||K.handler.export==="ApiKeyInboundPolicy")&&!K.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&R.push(K)})}),R.length>0){let $=R.length>0&&R[0].handler&&R[0].handler.options&&R[0].handler.options.authHeader?R[0].handler.options.authHeader:"Authorization",K=R.length>0&&R[0].handler&&R[0].handler.options&&(R[0].handler.options.authScheme||R[0].handler.options.authScheme==="")?R[0].handler.options.authScheme:"Bearer",Ne=K!==""?`${K} ${cdt}`:cdt,De={name:$,in:"header",required:!0,example:Ne,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Ne}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===De.name)||A.parameters.unshift(De):A.parameters=[De];let Se={type:"http",scheme:K.toLowerCase()},Ct="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(br=>"name"in br&&br.type==="apiKey"||"type"in br&&br.type==="http"&&br.scheme===K)||(a.components.securitySchemes={...a.components.securitySchemes,[Ct]:Se}):(a.components||(a.components={}),a.components.securitySchemes={[Ct]:Se});let Tt={[Ct]:[]};A.security?A.security.some(br=>br[Ct]!==void 0)||A.security.unshift(Tt):A.security=[Tt]}let W=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="RateLimitInboundPolicy"||K.handler.export==="ComplexRateLimitInboundPolicy")&&W.push(K)})}),W.length>0){let $={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},K={...$,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:$,RateLimitWithRetryAfter:K},A.responses||(A.responses={});let Ne=W.some(De=>De.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Ne?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(p_r,"enrichSpecWithZuploData");function udt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&udt(a[c],s)}t(udt,"removePropertiesByPrefix");function d_r({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new Tv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new Tv({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new Tv({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(d_r,"assertIsZuploOpenApiSpec");function m_r(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let R=0;R<s.length;R++)s[R]=255;for(let R=0;R<a.length;R++){let W=a.charAt(R),$=W.charCodeAt(0);if(s[$]!==255)throw new TypeError(W+" is ambiguous");s[$]=R}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";let W=0,$=0,K=0,Ne=R.length;for(;K!==Ne&&R[K]===0;)K++,W++;let De=(Ne-K)*v+1>>>0,Se=new Uint8Array(De);for(;K!==Ne;){let br=R[K],Cr=0;for(let Lr=De-1;(br!==0||Cr<$)&&Lr!==-1;Lr--,Cr++)br+=256*Se[Lr]>>>0,Se[Lr]=br%c>>>0,br=br/c>>>0;if(br!==0)throw new Error("Non-zero carry");$=Cr,K++}let Ct=De-$;for(;Ct!==De&&Se[Ct]===0;)Ct++;let Tt=f.repeat(W);for(;Ct<De;++Ct)Tt+=a.charAt(Se[Ct]);return Tt}t(E,"encode");function A(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;let W=0,$=0,K=0;for(;R[W]===f;)$++,W++;let Ne=(R.length-W)*d+1>>>0,De=new Uint8Array(Ne);for(;R[W];){let br=s[R.charCodeAt(W)];if(br===255)return;let Cr=0;for(let Lr=Ne-1;(br!==0||Cr<K)&&Lr!==-1;Lr--,Cr++)br+=c*De[Lr]>>>0,De[Lr]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");K=Cr,W++}let Se=Ne-K;for(;Se!==Ne&&De[Se]===0;)Se++;let Ct=new Uint8Array($+(Ne-Se)),Tt=$;for(;Se!==Ne;)Ct[Tt++]=De[Se++];return Ct}t(A,"decodeUnsafe");function O(R){let W=A(R);if(W)return W;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(m_r,"base");var fdt=m_r;var h_r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Wfe=fdt(h_r);var t8e="2024-09-02",_dt=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function pdt(){return new wS({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:t8e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:_dt[t8e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(pdt,"getMockEnvironment");var wS=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=pdt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(Wfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var g_r=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function ddt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!g_r.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(ddt,"isRestrictedEnvVariableName");function mdt(a){return!!a.startsWith("ZUPLO_")}t(mdt,"isZuploReadableEnvVariableName");var qBr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return wS.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return wS.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return wS.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return wS.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return wS.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return wS.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return wS.instance.build.COMPATIBILITY_DATE}if(!(ddt(c)&&!mdt(c)))return wS.instance.runtime[c]}});function XQ(a,s,c){return`_${u6(`${a}_${s}_${c}`)}`}t(XQ,"getRawOperationDataIdentifierName");function r8e(a,s,c,f){return`_${u6(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(r8e,"getIdForParameterSchema");function n8e(a,s,c){return`_${u6(a.toLowerCase())}_${s.toLowerCase()}_rb_${u6(c.toLowerCase())}`}t(n8e,"getIdForRequestBodySchema");function ZQ(a,s){return`_${u6(a)}_${u6(s)}`}t(ZQ,"getIdForRefSchema");function u6(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(u6,"sanitizedIdentifierName");var Hyt=jp(sht(),1);import ype from"path";var mK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},lmr=/[$_\p{ID_Start}]/u,umr=/[$_\u200C\u200D\p{ID_Continue}]/u,Y8e=".*";function fmr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(fmr,"Re");function cht(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&lmr.test(O)||A!==f+1&&umr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,R=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!fmr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),R=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),R=!0;break}A+=a[O++]}if(R)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(cht,"v");function lht(a,s={}){let c=cht(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${xC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,R=t(Cr=>{if(E<c.length&&c[E].type===Cr)return c[E++].value},"a"),W=t(()=>R("OTHER_MODIFIER")??R("ASTERISK"),"f"),$=t(Cr=>{let Lr=R(Cr);if(Lr!==void 0)return Lr;let{type:yr,index:_r}=c[E];throw new TypeError(`Unexpected ${yr} at ${_r}, expected ${Cr}`)},"d"),K=t(()=>{let Cr="",Lr;for(;Lr=R("CHAR")??R("ESCAPED_CHAR");)Cr+=Lr;return Cr},"T"),Ne=t(Cr=>Cr,"Se"),De=s.encodePart||Ne,Se="",Ct=t(Cr=>{Se+=Cr},"U"),Tt=t(()=>{Se.length&&(d.push(new mK(3,"","",De(Se),"",3)),Se="")},"$"),br=t((Cr,Lr,yr,_r,sr)=>{let Ts=3;switch(sr){case"?":Ts=1;break;case"*":Ts=0;break;case"+":Ts=2;break}if(!Lr&&!yr&&Ts===3){Ct(Cr);return}if(Tt(),!Lr&&!yr){if(!Cr)return;d.push(new mK(3,"","",De(Cr),"",Ts));return}let Di;yr?yr==="*"?Di=Y8e:Di=yr:Di=f;let _o=2;Di===f?(_o=1,Di=""):Di===Y8e&&(_o=0,Di="");let hi;if(Lr?hi=Lr:yr&&(hi=v++),O.has(hi))throw new TypeError(`Duplicate name '${hi}'.`);O.add(hi),d.push(new mK(_o,hi,De(Cr),Di,De(_r),Ts))},"V");for(;E<c.length;){let Cr=R("CHAR"),Lr=R("NAME"),yr=R("REGEX");if(!Lr&&!yr&&(yr=R("ASTERISK")),Lr||yr){let sr=Cr??"";s.prefixes.indexOf(sr)===-1&&(Ct(sr),sr=""),Tt();let Ts=W();br(sr,Lr,yr,"",Ts);continue}let _r=Cr??R("ESCAPED_CHAR");if(_r){Ct(_r);continue}if(R("OPEN")){let sr=K(),Ts=R("NAME"),Di=R("REGEX");!Ts&&!Di&&(Di=R("ASTERISK"));let _o=K();$("CLOSE");let hi=W();br(sr,Ts,Di,_o,hi);continue}Tt(),$("END")}return d}t(lht,"D");function xC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xC,"S");function aht(a){return a&&a.ignoreCase?"ui":"u"}t(aht,"X");function _mr(a,s,c){return uht(lht(a,c),s,c)}t(_mr,"Z");function wB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(wB,"k");function uht(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=xC(A.value):f+=`(?:${xC(A.value)})${wB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${xC(c.delimiter)}]+?`,R=A.value;if(A.type===1?R=O:A.type===0&&(R=Y8e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${R})${wB(A.modifier)}`:f+=`((?:${R})${wB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${xC(A.prefix)}(${R})${xC(A.suffix)})`,f+=wB(A.modifier);continue}f+=`(?:${xC(A.prefix)}`,f+=`((?:${R})(?:`,f+=xC(A.suffix),f+=xC(A.prefix),f+=`(?:${R}))*)${xC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${xC(c.endsWith)}]|$`,v=`[${xC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,aht(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,aht(c))}t(uht,"F");var FN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},pmr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},dmr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function mmr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(mmr,"J");function fht(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(fht,"Q");function hmr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(hmr,"Ee");function _ht(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(_ht,"W");var pht=["ftp","file","http","https","ws","wss"];function dht(a){if(!a)return!0;for(let s of pht)if(a.test(s))return!0;return!1}t(dht,"N");function gmr(a,s){if(a=fht(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(gmr,"te");function ymr(a,s){if(a=fht(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(ymr,"re");function vmr(a,s){return s||a===""?a:_ht(a)?ght(a):hht(a)}t(vmr,"ne");function bmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(bmr,"se");function Smr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Smr,"ie");function Tmr(a,s,c){if(c||a==="")return a;if(s&&!pht.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Tmr,"ae");function Cmr(a,s,c){return mht(s)===a&&(a=""),c||a===""?a:yht(a)}t(Cmr,"oe");function Emr(a,s){return a=hmr(a,":"),s||a===""?a:X8e(a)}t(Emr,"ce");function mht(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(mht,"_");function X8e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(X8e,"y");function xmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(xmr,"le");function Dmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Dmr,"fe");function hht(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(hht,"z");function ght(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(ght,"j");function yht(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(yht,"K");function Amr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Amr,"he");function kmr(a){return a===""?a:new URL(`data:${a}`).pathname}t(kmr,"ue");function wmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(wmr,"de");function Pmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(Pmr,"pe");var Nmr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=cht(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#k()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#k(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,FN),a.encodePart=X8e;let s=_mr(this.#T(),void 0,a);this.#l=dht(s)}},K8e=["protocol","username","password","hostname","port","pathname","search","hash"],ON="*";function oht(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(oht,"ge");function m6(a,s){return s?dK(a):a}t(m6,"b");function pK(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=m6(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=m6(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=m6(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=m6(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=m6(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=m6(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=m6(f.search.substring(1,f.search.length),c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=m6(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Emr(s.protocol,c)),typeof s.username=="string"&&(a.username=Smr(s.username,c)),typeof s.password=="string"&&(a.password=bmr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=vmr(s.hostname,c)),typeof s.port=="string"&&(a.port=Cmr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!mmr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=m6(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Tmr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=ymr(s.search,c)),typeof s.hash=="string"&&(a.hash=gmr(s.hash,c)),a}t(pK,"w");function dK(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(dK,"C");function Imr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Imr,"Oe");function Omr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${Imr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=dK(A.value);continue}v+=`{${dK(A.value)}}${wB(A.modifier)}`;continue}let O=A.hasCustomName(),R=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),W=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!R&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let K=$.value.length>0?$.value[0]:"";R=d.test(K)}else R=!$.hasCustomName();if(!R&&!A.prefix.length&&W&&W.type===3){let K=W.value[W.value.length-1];R=s.prefixes.includes(K)}R&&(v+="{"),v+=dK(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!W||W.type===3||W.modifier!==3||R||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=dK(A.suffix),R&&(v+="}"),A.modifier!==3&&(v+=wB(A.modifier))}return v}t(Omr,"ke");var vht=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new Nmr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:ON,protocol:ON,username:ON,password:ON,hostname:ON,port:ON,search:ON,hash:ON};this.#r=pK(v,a,!0),mht(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of K8e){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,FN),A.encodePart=X8e;break;case"username":Object.assign(A,FN),A.encodePart=xmr;break;case"password":Object.assign(A,FN),A.encodePart=Dmr;break;case"hostname":Object.assign(A,pmr),_ht(O)?A.encodePart=ght:A.encodePart=hht;break;case"port":Object.assign(A,FN),A.encodePart=yht;break;case"pathname":dht(this.#n.protocol)?(Object.assign(A,dmr,d),A.encodePart=Amr):(Object.assign(A,FN,d),A.encodePart=kmr);break;case"search":Object.assign(A,FN,d),A.encodePart=wmr;break;case"hash":Object.assign(A,FN,d),A.encodePart=Pmr;break}try{this.#s[E]=lht(O,A),this.#n[E]=uht(this.#s[E],this.#e[E],A),this.#t[E]=Omr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(R=>R.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?c=pK(c,a,!1):c=pK(c,oht(a,s),!1)}catch{return!1}let f;for(f of K8e)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?c=pK(c,a,!1):c=pK(c,oht(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of K8e){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let R=v[A+1];E[O]=R}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let R of["type","modifier","prefix","value","suffix"]){if(A[R]<O[R])return-1;if(A[R]!==O[R])return 1}return 0},"o"),d=new mK(3,"","","","",3),v=new mK(0,"","","","",3),E=t((A,O)=>{let R=0;for(;R<Math.min(A.length,O.length);++R){let W=f(A[R],O[R]);if(W)return W}return A.length===O.length?0:f(A[R]??d,O[R]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=vht);import{AssertionError as Fmr}from"assert";function h6(a,s){if(a===!1)throw new Fmr({message:s})}t(h6,"assert");var Jc;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Jc||(Jc={}));function PB(a){return a.type===Jc.Object}t(PB,"isAstObject");function g6(a){return a.type===Jc.Property}t(g6,"isAstProperty");function bht(a){return a.type===Jc.Array}t(bht,"isAstArray");function NB(a){return a.type===Jc.Literal}t(NB,"isAstLiteral");function u7(a){if(a===void 0)throw new Error("Node is undefined");if(!PB(a))throw new Error("Node is not object")}t(u7,"assertAstObject");import{findNodeAtLocation as Lmr,getNodeValue as Rmr,printParseErrorCode as Mmr,visit as jmr}from"jsonc-parser";var Bmr={DEFAULT:{allowTrailingComma:!1}};function hK(a,s=[],c=Bmr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),jmr(a,{onObjectBegin:t((O,R,W)=>{f=v({type:"object",offset:O,length:-1,line:R+1,column:W+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,R,W,$,K)=>{f=v({type:"property",offset:R,length:-1,line:$+1,column:K+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:R,length:W,line:$,column:K,parent:f})},"onObjectProperty"),onObjectEnd:t((O,R)=>{d(O+R),f.length=O+R-f.offset,f=f.parent,d(O+R)},"onObjectEnd"),onArrayBegin:t((O,R,W,$)=>{f=v({type:"array",offset:O,length:-1,line:W+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,R)=>{f.length=O+R-f.offset,f=f.parent,d(O+R)},"onArrayEnd"),onLiteralValue:t((O,R,W,$,K)=>{v({type:Umr(O),offset:R,length:W,line:$+1,column:K+1,parent:f,value:O}),d(R+W)},"onLiteralValue"),onSeparator:t((O,R)=>{f.type==="property"&&(O===":"?f.colonOffset=R:O===","&&d(R))},"onSeparator"),onError:t((O,R,W,$,K)=>{s.push({error:O,offset:R,length:W,line:$+1,column:K+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(hK,"parse");function Umr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(Umr,"getNodeType");function Z8e(a,s){return Lmr(a,s)}t(Z8e,"findNodeAtLocation");function gK(a){return Rmr(a)}t(gK,"getNodeValue");function Sht(a){return Mmr(a)}t(Sht,"printParseErrorCode");var yK=class{static{t(this,"AstAdapter")}parse(s){let f=hK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Jc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Jc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){h6(s.children?.length===2,"Invalid property node");let f={type:Jc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Jc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Jc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Rx={createLiteral:t((a,s)=>({type:Jc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Jc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Jc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Jc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Jc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Jc.Array,parent:s,children:[]};for(let f of a)c.children.push(Rx.createLiteral(f,c));return c},"createArrayOfLiterals")};var $mr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,vK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Jc.Array:return this.generateArray(s,c);case Jc.Object:return this.generateObject(s,c);case Jc.Property:return this.generateProperty(s,c);case Jc.Literal:return this.generateLiteral(s,c);case Jc.FunctionCall:return this.generateFunctionCall(s,c);case Jc.Identifier:return this.generateIdentifier(s,c);case Jc.Raw:return this.generateRaw(s,c);case Jc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=$mr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as Jmr}from"@swc/core";import zmr from"fs/promises";var Tht=t(async a=>{let s=new Set;try{let c=await zmr.readFile(a,"utf-8");(await Jmr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var Cht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var eOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Eht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var tOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var rOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var Myt=jp(ayt(),1),jyt=jp(Ryt(),1);var upe=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new jyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Myt.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],R=E[2]?parseInt(E[2]):0,W=E[3],$=isNaN(R)?void 0:c[O][R][W];v={details:{property:O,index:R,field:W,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),R=O[O.length-1];d.message=`Value of property '${R}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var qN=upe.instance;qN.addSchema(rOe,"route-configuration.schema.json");qN.addSchema(Eht,"policy-configuration.schema.json");qN.addSchema(eOe,"policies.schema.json");qN.addSchema(tOe,"open-api-route-configuration.schema.json");qN.addSchema(Cht,"fragments.schema.json");var zqr=qN.compile(rOe),Byt=qN.compile(tOe),g7e=qN.compile(eOe);var fpe=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=g7e(s),this.results}};var _pe=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Byt(s),this.results}};import Qbr from"path";var y7e=/\$import\((.*)\)/,ppe=/\$env\((.*?)\)/g;var T6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},Gbr=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),VN=t((a,s)=>{if(!a)return!1;let c=Gbr(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||g6(A)&&A.name.value===v?!0:v==="{}"?A.type===Jc.Object:v==="[]"?A.type===Jc.Array:!1:!1})},"testPosition");var dpe=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),PB(s)?s.children.forEach(c=>{this.visitor(c)}):bht(s)?s.children.forEach(c=>{this.visitor(c)}):g6(s)&&this.visitor(s.value)}},Uyt=t((a,s,c)=>f=>{if(!g6(f)||!NB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>VN(f,v))){ppe.test(f.value.value)&&s.push(new T6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(ppe).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Jc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(ppe),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Rx.createTemplateString(v,f))}},"getEnvStatementTransformer");var XK="config/routes.json",Kbr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Ybr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],$yt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Xbr="handler/{}/options/{}/rewritePattern",Zbr="handler/{}/options/{}/baseUrl",mpe=class extends dpe{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!g6(s)||!NB(s.value)||typeof s.value.value!="string")&&VN(s,Xbr)){if(!s.parent||!PB(s.parent)){this.errors.push(new T6("Invalid node, expected object",XK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Jyt(c)},d=Rx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!g6(s)||!NB(s.value)||typeof s.value.value!="string")&&VN(s,Zbr)){if(!s.parent||!PB(s.parent)){this.errors.push(new T6("Invalid node, expected object",XK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Jyt(c)},d=Rx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!g6(s)||!NB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!Ybr.some(A=>VN(s,A))&&!$yt.some(A=>VN(s,A))){if(y7e.test(c)){if(s.name.value==="$ref")return;this.errors.push(new T6("An $import() statement is not expected at this location.",XK,s.location,c))}return}let f=y7e.exec(c);if($yt.some(A=>VN(s,A))&&!f)return;if(!f){this.errors.push(new T6("Invalid $import() statement",XK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=Qbr.join("..",d));let v=this.getImportName(d),E={type:Jc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=Uyt(Kbr,this.errors,XK)};function Jyt(a){return`(request, context) => {
|
|
583
583
|
const { params, url, query, method, headers } = request;
|
|
584
584
|
const { host, hostname, origin, pathname, port, search } = new URL(url);
|
|
585
585
|
const e = encodeURIComponent;
|
package/index.minified.js
CHANGED
|
@@ -579,7 +579,7 @@ globstar while`,s,K,c,Ne,De),this.matchOne(s.slice(K),c.slice(Ne),f))return this
|
|
|
579
579
|
`),stderr:v.join(`
|
|
580
580
|
`),exitCode:E},"Tar process logs")}}t(k_r,"tarFolder");async function w_r({tarFilePath:a,outputDir:s,logger:c}){let f=[],d=[],v;try{await new Promise((E,A)=>{let O=ldt("sh",["-c",`tar -xvf ${a} -C ${s};`]);O.stdout.on("data",L=>{let W=L.toString().trim();W.length>0&&f.push(W.trim())}),O.stderr.on("data",L=>{let W=L.toString().trim();W.length>0&&d.push(W.trim())}),O.on("close",L=>{v=L,L===0?E():A(new Error(`tar process exited with code ${L}`))}),O.on("error",L=>{A(L)})})}catch(E){throw new Error("Failed to untar file",{cause:E})}finally{c.info({stdout:f.join(`
|
|
581
581
|
`),stderr:d.join(`
|
|
582
|
-
`),exitCode:v},"Untar process logs")}}t(w_r,"untarFile");async function P_r(a){if(await n8e(a))return await NN.rm(a,{recursive:!0})}t(P_r,"deleteFolder");var du=i8e;var SC=H_(r8e(),1);import{readFile as N_r}from"fs/promises";var s7=class extends Error{static{t(this,"CustomResolveError")}},IN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return YQ.$RefParser.dereference(s,{resolve:{json:!0,file:Wfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return YQ.$RefParser.bundle(s,{resolve:{file:Wfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return YQ.$RefParser.parse(s,{resolve:{file:Wfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return YQ.$RefParser.resolve(s,{resolve:{file:Wfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Wfe(a,s){return{order:100,canRead(c){let f=F_r(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=pdt(c.url)}catch(E){throw new s7(`Malformed URI: ${c.url}`,{cause:E})}try{du.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=pdt(c.url)}catch(d){throw new s7(`Malformed URI: ${c.url}`,{cause:d})}try{return await N_r(f)}catch(d){throw new s7(`Error opening file "${f}"`,{cause:d})}}}}t(Wfe,"customResolver");var s8e=/^win/.test(globalThis.process?globalThis.process.platform:""),I_r=/\//g,O_r=/^(\w{2,}):\/\//i,a8e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function F_r(a){let s=O_r.exec(a);if(s)return s[1].toLowerCase()}t(F_r,"getProtocol");function pdt(a,s){a=decodeURI(a);for(let f=0;f<a8e.length;f+=2)a=a.replace(a8e[f],a8e[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),s8e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=s8e?a:"/"+a)),s8e&&!c&&(a=a.replace(I_r,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(pdt,"toFileSystemPath");var ddt="YOUR_KEY_HERE";async function mdt(a){let c=await new IN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return L_r({...a,relativeOpenApiPath:f},c)}t(mdt,"buildPublicOpenApiFile");async function L_r(a,s){B_r({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=M_r(c),R_r(c,a),c=j_r(c,a),hdt(c,"x-zuplo"),c}t(L_r,"buildRawOpenApiFile");function R_r(a,{deploymentUrl:s,deploymentName:c,environmentType:f}){let d;s?d=new URL(s).hostname:f&&c&&(d=f===Jlt.WORKING_COPY?`${c}.${$Ne.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${$Ne.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(R_r,"addServerHost");function M_r(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(Hj in A&&Bue(A[Hj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},L=["delete","get","head","patch","post","put","trace","options"];return L.forEach(W=>{let $=A[W];if(!$)return;if(Bue($[Hj])){delete O[W];return}let{parameters:K}=$;if(!K)return;let Ne=K.filter(De=>{if(Hj in De&&Bue(De[Hj]))return!1;if("$ref"in De){let Se=De.$ref.split("/").pop();return Se?!f.includes(Se):!0}return!0});O[W]={...$,parameters:Ne}}),L.some(W=>!!O[W])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(M_r,"removeHiddenRoutesAndParams");function j_r(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,K)=>{let Ne=s.policies?.find(({name:Ct})=>Ct===K);if(!Ne)return $;if(!(Ne.handler.export==="CompositeInboundPolicy"))return $.concat(K);let Se=Ne.handler.options?.policies;return Se?$.concat(Se):$},[]),L=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="ApiAuthKeyInboundPolicy"||K.handler.export==="ApiKeyInboundPolicy")&&!K.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&L.push(K)})}),L.length>0){let $=L.length>0&&L[0].handler&&L[0].handler.options&&L[0].handler.options.authHeader?L[0].handler.options.authHeader:"Authorization",K=L.length>0&&L[0].handler&&L[0].handler.options&&(L[0].handler.options.authScheme||L[0].handler.options.authScheme==="")?L[0].handler.options.authScheme:"Bearer",Ne=K!==""?`${K} ${ddt}`:ddt,De={name:$,in:"header",required:!0,example:Ne,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Ne}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===De.name)||A.parameters.unshift(De):A.parameters=[De];let Se={type:"http",scheme:K.toLowerCase()},Ct="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(br=>"name"in br&&br.type==="apiKey"||"type"in br&&br.type==="http"&&br.scheme===K)||(a.components.securitySchemes={...a.components.securitySchemes,[Ct]:Se}):(a.components||(a.components={}),a.components.securitySchemes={[Ct]:Se});let Tt={[Ct]:[]};A.security?A.security.some(br=>br[Ct]!==void 0)||A.security.unshift(Tt):A.security=[Tt]}let W=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="RateLimitInboundPolicy"||K.handler.export==="ComplexRateLimitInboundPolicy")&&W.push(K)})}),W.length>0){let $={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},K={...$,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:$,RateLimitWithRetryAfter:K},A.responses||(A.responses={});let Ne=W.some(De=>De.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Ne?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(j_r,"enrichSpecWithZuploData");function hdt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&hdt(a[c],s)}t(hdt,"removePropertiesByPrefix");function B_r({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new Tv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new Tv({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new Tv({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(B_r,"assertIsZuploOpenApiSpec");function U_r(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let L=0;L<s.length;L++)s[L]=255;for(let L=0;L<a.length;L++){let W=a.charAt(L),$=W.charCodeAt(0);if(s[$]!==255)throw new TypeError(W+" is ambiguous");s[$]=L}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(L){if(L instanceof Uint8Array||(ArrayBuffer.isView(L)?L=new Uint8Array(L.buffer,L.byteOffset,L.byteLength):Array.isArray(L)&&(L=Uint8Array.from(L))),!(L instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(L.length===0)return"";let W=0,$=0,K=0,Ne=L.length;for(;K!==Ne&&L[K]===0;)K++,W++;let De=(Ne-K)*v+1>>>0,Se=new Uint8Array(De);for(;K!==Ne;){let br=L[K],Cr=0;for(let Lr=De-1;(br!==0||Cr<$)&&Lr!==-1;Lr--,Cr++)br+=256*Se[Lr]>>>0,Se[Lr]=br%c>>>0,br=br/c>>>0;if(br!==0)throw new Error("Non-zero carry");$=Cr,K++}let Ct=De-$;for(;Ct!==De&&Se[Ct]===0;)Ct++;let Tt=f.repeat(W);for(;Ct<De;++Ct)Tt+=a.charAt(Se[Ct]);return Tt}t(E,"encode");function A(L){if(typeof L!="string")throw new TypeError("Expected String");if(L.length===0)return new Uint8Array;let W=0,$=0,K=0;for(;L[W]===f;)$++,W++;let Ne=(L.length-W)*d+1>>>0,De=new Uint8Array(Ne);for(;L[W];){let br=s[L.charCodeAt(W)];if(br===255)return;let Cr=0;for(let Lr=Ne-1;(br!==0||Cr<K)&&Lr!==-1;Lr--,Cr++)br+=c*De[Lr]>>>0,De[Lr]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");K=Cr,W++}let Se=Ne-K;for(;Se!==Ne&&De[Se]===0;)Se++;let Ct=new Uint8Array($+(Ne-Se)),Tt=$;for(;Se!==Ne;)Ct[Tt++]=De[Se++];return Ct}t(A,"decodeUnsafe");function O(L){let W=A(L);if(W)return W;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(U_r,"base");var gdt=U_r;var $_r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Hfe=gdt($_r);var o8e="2024-09-02",ydt=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function vdt(){return new wS({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:o8e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:ydt[o8e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(vdt,"getMockEnvironment");var wS=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=vdt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(Hfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var J_r=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function bdt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!J_r.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(bdt,"isRestrictedEnvVariableName");function Sdt(a){return!!a.startsWith("ZUPLO_")}t(Sdt,"isZuploReadableEnvVariableName");var pUr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return wS.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return wS.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return wS.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return wS.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return wS.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return wS.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return wS.instance.build.COMPATIBILITY_DATE}if(!(bdt(c)&&!Sdt(c)))return wS.instance.runtime[c]}});function XQ(a,s,c){return`_${p6(`${a}_${s}_${c}`)}`}t(XQ,"getRawOperationDataIdentifierName");function c8e(a,s,c,f){return`_${p6(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(c8e,"getIdForParameterSchema");function l8e(a,s,c){return`_${p6(a.toLowerCase())}_${s.toLowerCase()}_rb_${p6(c.toLowerCase())}`}t(l8e,"getIdForRequestBodySchema");function ZQ(a,s){return`_${p6(a)}_${p6(s)}`}t(ZQ,"getIdForRefSchema");function p6(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(p6,"sanitizedIdentifierName");var Zyt=H_(fht(),1);import vpe from"path";var mK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Fmr=/[$_\p{ID_Start}]/u,Lmr=/[$_\u200C\u200D\p{ID_Continue}]/u,nOe=".*";function Rmr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(Rmr,"Re");function dht(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&Fmr.test(O)||A!==f+1&&Lmr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,L=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!Rmr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),L=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),L=!0;break}A+=a[O++]}if(L)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(dht,"v");function mht(a,s={}){let c=dht(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${xC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,L=t(Cr=>{if(E<c.length&&c[E].type===Cr)return c[E++].value},"a"),W=t(()=>L("OTHER_MODIFIER")??L("ASTERISK"),"f"),$=t(Cr=>{let Lr=L(Cr);if(Lr!==void 0)return Lr;let{type:yr,index:_r}=c[E];throw new TypeError(`Unexpected ${yr} at ${_r}, expected ${Cr}`)},"d"),K=t(()=>{let Cr="",Lr;for(;Lr=L("CHAR")??L("ESCAPED_CHAR");)Cr+=Lr;return Cr},"T"),Ne=t(Cr=>Cr,"Se"),De=s.encodePart||Ne,Se="",Ct=t(Cr=>{Se+=Cr},"U"),Tt=t(()=>{Se.length&&(d.push(new mK(3,"","",De(Se),"",3)),Se="")},"$"),br=t((Cr,Lr,yr,_r,sr)=>{let Ts=3;switch(sr){case"?":Ts=1;break;case"*":Ts=0;break;case"+":Ts=2;break}if(!Lr&&!yr&&Ts===3){Ct(Cr);return}if(Tt(),!Lr&&!yr){if(!Cr)return;d.push(new mK(3,"","",De(Cr),"",Ts));return}let Di;yr?yr==="*"?Di=nOe:Di=yr:Di=f;let _o=2;Di===f?(_o=1,Di=""):Di===nOe&&(_o=0,Di="");let hi;if(Lr?hi=Lr:yr&&(hi=v++),O.has(hi))throw new TypeError(`Duplicate name '${hi}'.`);O.add(hi),d.push(new mK(_o,hi,De(Cr),Di,De(_r),Ts))},"V");for(;E<c.length;){let Cr=L("CHAR"),Lr=L("NAME"),yr=L("REGEX");if(!Lr&&!yr&&(yr=L("ASTERISK")),Lr||yr){let sr=Cr??"";s.prefixes.indexOf(sr)===-1&&(Ct(sr),sr=""),Tt();let Ts=W();br(sr,Lr,yr,"",Ts);continue}let _r=Cr??L("ESCAPED_CHAR");if(_r){Ct(_r);continue}if(L("OPEN")){let sr=K(),Ts=L("NAME"),Di=L("REGEX");!Ts&&!Di&&(Di=L("ASTERISK"));let _o=K();$("CLOSE");let hi=W();br(sr,Ts,Di,_o,hi);continue}Tt(),$("END")}return d}t(mht,"D");function xC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xC,"S");function _ht(a){return a&&a.ignoreCase?"ui":"u"}t(_ht,"X");function Mmr(a,s,c){return hht(mht(a,c),s,c)}t(Mmr,"Z");function PB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(PB,"k");function hht(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=xC(A.value):f+=`(?:${xC(A.value)})${PB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${xC(c.delimiter)}]+?`,L=A.value;if(A.type===1?L=O:A.type===0&&(L=nOe),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${L})${PB(A.modifier)}`:f+=`((?:${L})${PB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${xC(A.prefix)}(${L})${xC(A.suffix)})`,f+=PB(A.modifier);continue}f+=`(?:${xC(A.prefix)}`,f+=`((?:${L})(?:`,f+=xC(A.suffix),f+=xC(A.prefix),f+=`(?:${L}))*)${xC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${xC(c.endsWith)}]|$`,v=`[${xC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,_ht(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,_ht(c))}t(hht,"F");var RN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},jmr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Bmr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Umr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Umr,"J");function ght(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(ght,"Q");function $mr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t($mr,"Ee");function yht(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(yht,"W");var vht=["ftp","file","http","https","ws","wss"];function bht(a){if(!a)return!0;for(let s of vht)if(a.test(s))return!0;return!1}t(bht,"N");function Jmr(a,s){if(a=ght(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(Jmr,"te");function zmr(a,s){if(a=ght(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(zmr,"re");function qmr(a,s){return s||a===""?a:yht(a)?Cht(a):Tht(a)}t(qmr,"ne");function Vmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(Vmr,"se");function Wmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Wmr,"ie");function Hmr(a,s,c){if(c||a==="")return a;if(s&&!vht.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Hmr,"ae");function Gmr(a,s,c){return Sht(s)===a&&(a=""),c||a===""?a:Eht(a)}t(Gmr,"oe");function Qmr(a,s){return a=$mr(a,":"),s||a===""?a:iOe(a)}t(Qmr,"ce");function Sht(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Sht,"_");function iOe(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(iOe,"y");function Kmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Kmr,"le");function Ymr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Ymr,"fe");function Tht(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(Tht,"z");function Cht(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Cht,"j");function Eht(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(Eht,"K");function Xmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Xmr,"he");function Zmr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Zmr,"ue");function ehr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(ehr,"de");function thr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(thr,"pe");var rhr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=dht(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#k()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#k(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,RN),a.encodePart=iOe;let s=Mmr(this.#T(),void 0,a);this.#l=bht(s)}},rOe=["protocol","username","password","hostname","port","pathname","search","hash"],LN="*";function pht(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(pht,"ge");function y6(a,s){return s?dK(a):a}t(y6,"b");function pK(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=y6(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=y6(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=y6(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=y6(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=y6(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=y6(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=y6(f.search.substring(1,f.search.length),c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=y6(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Qmr(s.protocol,c)),typeof s.username=="string"&&(a.username=Wmr(s.username,c)),typeof s.password=="string"&&(a.password=Vmr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=qmr(s.hostname,c)),typeof s.port=="string"&&(a.port=Gmr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!Umr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=y6(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Hmr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=zmr(s.search,c)),typeof s.hash=="string"&&(a.hash=Jmr(s.hash,c)),a}t(pK,"w");function dK(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(dK,"C");function nhr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(nhr,"Oe");function ihr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${nhr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=dK(A.value);continue}v+=`{${dK(A.value)}}${PB(A.modifier)}`;continue}let O=A.hasCustomName(),L=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),W=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!L&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let K=$.value.length>0?$.value[0]:"";L=d.test(K)}else L=!$.hasCustomName();if(!L&&!A.prefix.length&&W&&W.type===3){let K=W.value[W.value.length-1];L=s.prefixes.includes(K)}L&&(v+="{"),v+=dK(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!W||W.type===3||W.modifier!==3||L||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=dK(A.suffix),L&&(v+="}"),A.modifier!==3&&(v+=PB(A.modifier))}return v}t(ihr,"ke");var xht=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new rhr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:LN,protocol:LN,username:LN,password:LN,hostname:LN,port:LN,search:LN,hash:LN};this.#r=pK(v,a,!0),Sht(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of rOe){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,RN),A.encodePart=iOe;break;case"username":Object.assign(A,RN),A.encodePart=Kmr;break;case"password":Object.assign(A,RN),A.encodePart=Ymr;break;case"hostname":Object.assign(A,jmr),yht(O)?A.encodePart=Cht:A.encodePart=Tht;break;case"port":Object.assign(A,RN),A.encodePart=Eht;break;case"pathname":bht(this.#n.protocol)?(Object.assign(A,Bmr,d),A.encodePart=Xmr):(Object.assign(A,RN,d),A.encodePart=Zmr);break;case"search":Object.assign(A,RN,d),A.encodePart=ehr;break;case"hash":Object.assign(A,RN,d),A.encodePart=thr;break}try{this.#s[E]=mht(O,A),this.#n[E]=hht(this.#s[E],this.#e[E],A),this.#t[E]=ihr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(L=>L.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?c=pK(c,a,!1):c=pK(c,pht(a,s),!1)}catch{return!1}let f;for(f of rOe)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?c=pK(c,a,!1):c=pK(c,pht(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of rOe){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let L=v[A+1];E[O]=L}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let L of["type","modifier","prefix","value","suffix"]){if(A[L]<O[L])return-1;if(A[L]!==O[L])return 1}return 0},"o"),d=new mK(3,"","","","",3),v=new mK(0,"","","","",3),E=t((A,O)=>{let L=0;for(;L<Math.min(A.length,O.length);++L){let W=f(A[L],O[L]);if(W)return W}return A.length===O.length?0:f(A[L]??d,O[L]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=xht);import{AssertionError as shr}from"assert";function v6(a,s){if(a===!1)throw new shr({message:s})}t(v6,"assert");var Jc;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Jc||(Jc={}));function NB(a){return a.type===Jc.Object}t(NB,"isAstObject");function b6(a){return a.type===Jc.Property}t(b6,"isAstProperty");function Dht(a){return a.type===Jc.Array}t(Dht,"isAstArray");function IB(a){return a.type===Jc.Literal}t(IB,"isAstLiteral");function _7(a){if(a===void 0)throw new Error("Node is undefined");if(!NB(a))throw new Error("Node is not object")}t(_7,"assertAstObject");import{findNodeAtLocation as ahr,getNodeValue as ohr,printParseErrorCode as chr,visit as lhr}from"jsonc-parser";var uhr={DEFAULT:{allowTrailingComma:!1}};function hK(a,s=[],c=uhr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),lhr(a,{onObjectBegin:t((O,L,W)=>{f=v({type:"object",offset:O,length:-1,line:L+1,column:W+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,L,W,$,K)=>{f=v({type:"property",offset:L,length:-1,line:$+1,column:K+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:L,length:W,line:$,column:K,parent:f})},"onObjectProperty"),onObjectEnd:t((O,L)=>{d(O+L),f.length=O+L-f.offset,f=f.parent,d(O+L)},"onObjectEnd"),onArrayBegin:t((O,L,W,$)=>{f=v({type:"array",offset:O,length:-1,line:W+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,L)=>{f.length=O+L-f.offset,f=f.parent,d(O+L)},"onArrayEnd"),onLiteralValue:t((O,L,W,$,K)=>{v({type:fhr(O),offset:L,length:W,line:$+1,column:K+1,parent:f,value:O}),d(L+W)},"onLiteralValue"),onSeparator:t((O,L)=>{f.type==="property"&&(O===":"?f.colonOffset=L:O===","&&d(L))},"onSeparator"),onError:t((O,L,W,$,K)=>{s.push({error:O,offset:L,length:W,line:$+1,column:K+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(hK,"parse");function fhr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(fhr,"getNodeType");function sOe(a,s){return ahr(a,s)}t(sOe,"findNodeAtLocation");function gK(a){return ohr(a)}t(gK,"getNodeValue");function Aht(a){return chr(a)}t(Aht,"printParseErrorCode");var yK=class{static{t(this,"AstAdapter")}parse(s){let f=hK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Jc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Jc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){v6(s.children?.length===2,"Invalid property node");let f={type:Jc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Jc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Jc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Mx={createLiteral:t((a,s)=>({type:Jc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Jc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Jc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Jc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Jc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Jc.Array,parent:s,children:[]};for(let f of a)c.children.push(Mx.createLiteral(f,c));return c},"createArrayOfLiterals")};var _hr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,vK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Jc.Array:return this.generateArray(s,c);case Jc.Object:return this.generateObject(s,c);case Jc.Property:return this.generateProperty(s,c);case Jc.Literal:return this.generateLiteral(s,c);case Jc.FunctionCall:return this.generateFunctionCall(s,c);case Jc.Identifier:return this.generateIdentifier(s,c);case Jc.Raw:return this.generateRaw(s,c);case Jc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=_hr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as phr}from"@swc/core";import dhr from"fs/promises";var kht=t(async a=>{let s=new Set;try{let c=await dhr.readFile(a,"utf-8");(await phr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var wht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var aOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Pht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var oOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var cOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var zyt=H_(_yt(),1),qyt=H_(Jyt(),1);var fpe=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new qyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,zyt.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],L=E[2]?parseInt(E[2]):0,W=E[3],$=isNaN(L)?void 0:c[O][L][W];v={details:{property:O,index:L,field:W,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),L=O[O.length-1];d.message=`Value of property '${L}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var WN=fpe.instance;WN.addSchema(cOe,"route-configuration.schema.json");WN.addSchema(Pht,"policy-configuration.schema.json");WN.addSchema(aOe,"policies.schema.json");WN.addSchema(oOe,"open-api-route-configuration.schema.json");WN.addSchema(wht,"fragments.schema.json");var _Vr=WN.compile(cOe),Vyt=WN.compile(oOe),C7e=WN.compile(aOe);var _pe=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=C7e(s),this.results}};var ppe=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Vyt(s),this.results}};import b2r from"path";var E7e=/\$import\((.*)\)/,dpe=/\$env\((.*?)\)/g;var x6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},v2r=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),HN=t((a,s)=>{if(!a)return!1;let c=v2r(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||b6(A)&&A.name.value===v?!0:v==="{}"?A.type===Jc.Object:v==="[]"?A.type===Jc.Array:!1:!1})},"testPosition");var mpe=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),NB(s)?s.children.forEach(c=>{this.visitor(c)}):Dht(s)?s.children.forEach(c=>{this.visitor(c)}):b6(s)&&this.visitor(s.value)}},Wyt=t((a,s,c)=>f=>{if(!b6(f)||!IB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>HN(f,v))){dpe.test(f.value.value)&&s.push(new x6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(dpe).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Jc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(dpe),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Mx.createTemplateString(v,f))}},"getEnvStatementTransformer");var XK="config/routes.json",S2r=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],T2r=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Hyt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],C2r="handler/{}/options/{}/rewritePattern",E2r="handler/{}/options/{}/baseUrl",hpe=class extends mpe{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!b6(s)||!IB(s.value)||typeof s.value.value!="string")&&HN(s,C2r)){if(!s.parent||!NB(s.parent)){this.errors.push(new x6("Invalid node, expected object",XK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!b6(s)||!IB(s.value)||typeof s.value.value!="string")&&HN(s,E2r)){if(!s.parent||!NB(s.parent)){this.errors.push(new x6("Invalid node, expected object",XK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!b6(s)||!IB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!T2r.some(A=>HN(s,A))&&!Hyt.some(A=>HN(s,A))){if(E7e.test(c)){if(s.name.value==="$ref")return;this.errors.push(new x6("An $import() statement is not expected at this location.",XK,s.location,c))}return}let f=E7e.exec(c);if(Hyt.some(A=>HN(s,A))&&!f)return;if(!f){this.errors.push(new x6("Invalid $import() statement",XK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=b2r.join("..",d));let v=this.getImportName(d),E={type:Jc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=Wyt(S2r,this.errors,XK)};function Gyt(a){return`(request, context) => {
|
|
582
|
+
`),exitCode:v},"Untar process logs")}}t(w_r,"untarFile");async function P_r(a){if(await n8e(a))return await NN.rm(a,{recursive:!0})}t(P_r,"deleteFolder");var du=i8e;var SC=H_(r8e(),1);import{readFile as N_r}from"fs/promises";var s7=class extends Error{static{t(this,"CustomResolveError")}},IN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return YQ.$RefParser.dereference(s,{resolve:{json:!0,file:Wfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return YQ.$RefParser.bundle(s,{resolve:{file:Wfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return YQ.$RefParser.parse(s,{resolve:{file:Wfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return YQ.$RefParser.resolve(s,{resolve:{file:Wfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Wfe(a,s){return{order:100,canRead(c){let f=F_r(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=pdt(c.url)}catch(E){throw new s7(`Malformed URI: ${c.url}`,{cause:E})}try{du.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=pdt(c.url)}catch(d){throw new s7(`Malformed URI: ${c.url}`,{cause:d})}try{return await N_r(f)}catch(d){throw new s7(`Error opening file "${f}"`,{cause:d})}}}}t(Wfe,"customResolver");var s8e=/^win/.test(globalThis.process?globalThis.process.platform:""),I_r=/\//g,O_r=/^(\w{2,}):\/\//i,a8e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function F_r(a){let s=O_r.exec(a);if(s)return s[1].toLowerCase()}t(F_r,"getProtocol");function pdt(a,s){a=decodeURI(a);for(let f=0;f<a8e.length;f+=2)a=a.replace(a8e[f],a8e[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),s8e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=s8e?a:"/"+a)),s8e&&!c&&(a=a.replace(I_r,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(pdt,"toFileSystemPath");var ddt="YOUR_KEY_HERE";async function mdt(a){let c=await new IN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return L_r({...a,relativeOpenApiPath:f},c)}t(mdt,"buildPublicOpenApiFile");async function L_r(a,s){B_r({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=M_r(c),R_r(c,a),c=j_r(c,a),hdt(c,"x-zuplo"),c}t(L_r,"buildRawOpenApiFile");function R_r(a,{deploymentUrl:s,deploymentName:c,environmentType:f}){let d;s?d=new URL(s).hostname:f&&c&&(d=f===Jlt.WORKING_COPY?`${c}.${$Ne.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${$Ne.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(R_r,"addServerHost");function M_r(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(Hj in A&&Bue(A[Hj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},L=["delete","get","head","patch","post","put","trace","options"];return L.forEach(W=>{let $=A[W];if(!$)return;if(Bue($[Hj])){delete O[W];return}let{parameters:K}=$;if(!K)return;let Ne=K.filter(De=>{if(Hj in De&&Bue(De[Hj]))return!1;if("$ref"in De){let Se=De.$ref.split("/").pop();return Se?!f.includes(Se):!0}return!0});O[W]={...$,parameters:Ne}}),L.some(W=>!!O[W])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(M_r,"removeHiddenRoutesAndParams");function j_r(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,K)=>{let Ne=s.policies?.find(({name:Ct})=>Ct===K);if(!Ne)return $;if(!(Ne.handler.export==="CompositeInboundPolicy"))return $.concat(K);let Se=Ne.handler.options?.policies;return Se?$.concat(Se):$},[]),L=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="ApiAuthKeyInboundPolicy"||K.handler.export==="ApiKeyInboundPolicy")&&!K.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&L.push(K)})}),L.length>0){let $=L.length>0&&L[0].handler&&L[0].handler.options&&L[0].handler.options.authHeader?L[0].handler.options.authHeader:"Authorization",K=L.length>0&&L[0].handler&&L[0].handler.options&&(L[0].handler.options.authScheme||L[0].handler.options.authScheme==="")?L[0].handler.options.authScheme:"Bearer",Ne=K!==""?`${K} ${ddt}`:ddt,De={name:$,in:"header",required:!0,example:Ne,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Ne}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===De.name)||A.parameters.unshift(De):A.parameters=[De];let Se={type:"http",scheme:K.toLowerCase()},Ct="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(br=>"name"in br&&br.type==="apiKey"||"type"in br&&br.type==="http"&&br.scheme===K)||(a.components.securitySchemes={...a.components.securitySchemes,[Ct]:Se}):(a.components||(a.components={}),a.components.securitySchemes={[Ct]:Se});let Tt={[Ct]:[]};A.security?A.security.some(br=>br[Ct]!==void 0)||A.security.unshift(Tt):A.security=[Tt]}let W=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="RateLimitInboundPolicy"||K.handler.export==="ComplexRateLimitInboundPolicy")&&W.push(K)})}),W.length>0){let $={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},K={...$,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:$,RateLimitWithRetryAfter:K},A.responses||(A.responses={});let Ne=W.some(De=>De.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Ne?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(j_r,"enrichSpecWithZuploData");function hdt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&hdt(a[c],s)}t(hdt,"removePropertiesByPrefix");function B_r({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new Tv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new Tv({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new Tv({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(B_r,"assertIsZuploOpenApiSpec");function U_r(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let L=0;L<s.length;L++)s[L]=255;for(let L=0;L<a.length;L++){let W=a.charAt(L),$=W.charCodeAt(0);if(s[$]!==255)throw new TypeError(W+" is ambiguous");s[$]=L}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(L){if(L instanceof Uint8Array||(ArrayBuffer.isView(L)?L=new Uint8Array(L.buffer,L.byteOffset,L.byteLength):Array.isArray(L)&&(L=Uint8Array.from(L))),!(L instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(L.length===0)return"";let W=0,$=0,K=0,Ne=L.length;for(;K!==Ne&&L[K]===0;)K++,W++;let De=(Ne-K)*v+1>>>0,Se=new Uint8Array(De);for(;K!==Ne;){let br=L[K],Cr=0;for(let Lr=De-1;(br!==0||Cr<$)&&Lr!==-1;Lr--,Cr++)br+=256*Se[Lr]>>>0,Se[Lr]=br%c>>>0,br=br/c>>>0;if(br!==0)throw new Error("Non-zero carry");$=Cr,K++}let Ct=De-$;for(;Ct!==De&&Se[Ct]===0;)Ct++;let Tt=f.repeat(W);for(;Ct<De;++Ct)Tt+=a.charAt(Se[Ct]);return Tt}t(E,"encode");function A(L){if(typeof L!="string")throw new TypeError("Expected String");if(L.length===0)return new Uint8Array;let W=0,$=0,K=0;for(;L[W]===f;)$++,W++;let Ne=(L.length-W)*d+1>>>0,De=new Uint8Array(Ne);for(;L[W];){let br=s[L.charCodeAt(W)];if(br===255)return;let Cr=0;for(let Lr=Ne-1;(br!==0||Cr<K)&&Lr!==-1;Lr--,Cr++)br+=c*De[Lr]>>>0,De[Lr]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");K=Cr,W++}let Se=Ne-K;for(;Se!==Ne&&De[Se]===0;)Se++;let Ct=new Uint8Array($+(Ne-Se)),Tt=$;for(;Se!==Ne;)Ct[Tt++]=De[Se++];return Ct}t(A,"decodeUnsafe");function O(L){let W=A(L);if(W)return W;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(U_r,"base");var gdt=U_r;var $_r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Hfe=gdt($_r);var o8e="2024-09-02",ydt=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function vdt(){return new wS({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:o8e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:ydt[o8e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(vdt,"getMockEnvironment");var wS=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=vdt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(Hfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var J_r=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function bdt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!J_r.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(bdt,"isRestrictedEnvVariableName");function Sdt(a){return!!a.startsWith("ZUPLO_")}t(Sdt,"isZuploReadableEnvVariableName");var pUr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return wS.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return wS.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return wS.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return wS.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return wS.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return wS.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return wS.instance.build.COMPATIBILITY_DATE}if(!(bdt(c)&&!Sdt(c)))return wS.instance.runtime[c]}});function XQ(a,s,c){return`_${p6(`${a}_${s}_${c}`)}`}t(XQ,"getRawOperationDataIdentifierName");function c8e(a,s,c,f){return`_${p6(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(c8e,"getIdForParameterSchema");function l8e(a,s,c){return`_${p6(a.toLowerCase())}_${s.toLowerCase()}_rb_${p6(c.toLowerCase())}`}t(l8e,"getIdForRequestBodySchema");function ZQ(a,s){return`_${p6(a)}_${p6(s)}`}t(ZQ,"getIdForRefSchema");function p6(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(p6,"sanitizedIdentifierName");var Zyt=H_(fht(),1);import vpe from"path";var mK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Fmr=/[$_\p{ID_Start}]/u,Lmr=/[$_\u200C\u200D\p{ID_Continue}]/u,nOe=".*";function Rmr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(Rmr,"Re");function dht(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&Fmr.test(O)||A!==f+1&&Lmr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,L=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!Rmr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),L=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),L=!0;break}A+=a[O++]}if(L)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(dht,"v");function mht(a,s={}){let c=dht(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${xC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,L=t(Cr=>{if(E<c.length&&c[E].type===Cr)return c[E++].value},"a"),W=t(()=>L("OTHER_MODIFIER")??L("ASTERISK"),"f"),$=t(Cr=>{let Lr=L(Cr);if(Lr!==void 0)return Lr;let{type:yr,index:_r}=c[E];throw new TypeError(`Unexpected ${yr} at ${_r}, expected ${Cr}`)},"d"),K=t(()=>{let Cr="",Lr;for(;Lr=L("CHAR")??L("ESCAPED_CHAR");)Cr+=Lr;return Cr},"T"),Ne=t(Cr=>Cr,"Se"),De=s.encodePart||Ne,Se="",Ct=t(Cr=>{Se+=Cr},"U"),Tt=t(()=>{Se.length&&(d.push(new mK(3,"","",De(Se),"",3)),Se="")},"$"),br=t((Cr,Lr,yr,_r,sr)=>{let Ts=3;switch(sr){case"?":Ts=1;break;case"*":Ts=0;break;case"+":Ts=2;break}if(!Lr&&!yr&&Ts===3){Ct(Cr);return}if(Tt(),!Lr&&!yr){if(!Cr)return;d.push(new mK(3,"","",De(Cr),"",Ts));return}let Di;yr?yr==="*"?Di=nOe:Di=yr:Di=f;let _o=2;Di===f?(_o=1,Di=""):Di===nOe&&(_o=0,Di="");let hi;if(Lr?hi=Lr:yr&&(hi=v++),O.has(hi))throw new TypeError(`Duplicate name '${hi}'.`);O.add(hi),d.push(new mK(_o,hi,De(Cr),Di,De(_r),Ts))},"V");for(;E<c.length;){let Cr=L("CHAR"),Lr=L("NAME"),yr=L("REGEX");if(!Lr&&!yr&&(yr=L("ASTERISK")),Lr||yr){let sr=Cr??"";s.prefixes.indexOf(sr)===-1&&(Ct(sr),sr=""),Tt();let Ts=W();br(sr,Lr,yr,"",Ts);continue}let _r=Cr??L("ESCAPED_CHAR");if(_r){Ct(_r);continue}if(L("OPEN")){let sr=K(),Ts=L("NAME"),Di=L("REGEX");!Ts&&!Di&&(Di=L("ASTERISK"));let _o=K();$("CLOSE");let hi=W();br(sr,Ts,Di,_o,hi);continue}Tt(),$("END")}return d}t(mht,"D");function xC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xC,"S");function _ht(a){return a&&a.ignoreCase?"ui":"u"}t(_ht,"X");function Mmr(a,s,c){return hht(mht(a,c),s,c)}t(Mmr,"Z");function PB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(PB,"k");function hht(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=xC(A.value):f+=`(?:${xC(A.value)})${PB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${xC(c.delimiter)}]+?`,L=A.value;if(A.type===1?L=O:A.type===0&&(L=nOe),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${L})${PB(A.modifier)}`:f+=`((?:${L})${PB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${xC(A.prefix)}(${L})${xC(A.suffix)})`,f+=PB(A.modifier);continue}f+=`(?:${xC(A.prefix)}`,f+=`((?:${L})(?:`,f+=xC(A.suffix),f+=xC(A.prefix),f+=`(?:${L}))*)${xC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${xC(c.endsWith)}]|$`,v=`[${xC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,_ht(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,_ht(c))}t(hht,"F");var RN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},jmr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Bmr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Umr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Umr,"J");function ght(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(ght,"Q");function $mr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t($mr,"Ee");function yht(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(yht,"W");var vht=["ftp","file","http","https","ws","wss"];function bht(a){if(!a)return!0;for(let s of vht)if(a.test(s))return!0;return!1}t(bht,"N");function Jmr(a,s){if(a=ght(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(Jmr,"te");function zmr(a,s){if(a=ght(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(zmr,"re");function qmr(a,s){return s||a===""?a:yht(a)?Cht(a):Tht(a)}t(qmr,"ne");function Vmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(Vmr,"se");function Wmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Wmr,"ie");function Hmr(a,s,c){if(c||a==="")return a;if(s&&!vht.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Hmr,"ae");function Gmr(a,s,c){return Sht(s)===a&&(a=""),c||a===""?a:Eht(a)}t(Gmr,"oe");function Qmr(a,s){return a=$mr(a,":"),s||a===""?a:iOe(a)}t(Qmr,"ce");function Sht(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Sht,"_");function iOe(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(iOe,"y");function Kmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Kmr,"le");function Ymr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Ymr,"fe");function Tht(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(Tht,"z");function Cht(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Cht,"j");function Eht(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(Eht,"K");function Xmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Xmr,"he");function Zmr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Zmr,"ue");function ehr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(ehr,"de");function thr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(thr,"pe");var rhr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=dht(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#k()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#k(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,RN),a.encodePart=iOe;let s=Mmr(this.#T(),void 0,a);this.#l=bht(s)}},rOe=["protocol","username","password","hostname","port","pathname","search","hash"],LN="*";function pht(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(pht,"ge");function y6(a,s){return s?dK(a):a}t(y6,"b");function pK(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=y6(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=y6(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=y6(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=y6(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=y6(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=y6(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=y6(f.search.substring(1,f.search.length),c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=y6(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Qmr(s.protocol,c)),typeof s.username=="string"&&(a.username=Wmr(s.username,c)),typeof s.password=="string"&&(a.password=Vmr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=qmr(s.hostname,c)),typeof s.port=="string"&&(a.port=Gmr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!Umr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=y6(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Hmr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=zmr(s.search,c)),typeof s.hash=="string"&&(a.hash=Jmr(s.hash,c)),a}t(pK,"w");function dK(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(dK,"C");function nhr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(nhr,"Oe");function ihr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${nhr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=dK(A.value);continue}v+=`{${dK(A.value)}}${PB(A.modifier)}`;continue}let O=A.hasCustomName(),L=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),W=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!L&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let K=$.value.length>0?$.value[0]:"";L=d.test(K)}else L=!$.hasCustomName();if(!L&&!A.prefix.length&&W&&W.type===3){let K=W.value[W.value.length-1];L=s.prefixes.includes(K)}L&&(v+="{"),v+=dK(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!W||W.type===3||W.modifier!==3||L||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=dK(A.suffix),L&&(v+="}"),A.modifier!==3&&(v+=PB(A.modifier))}return v}t(ihr,"ke");var xht=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new rhr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:LN,protocol:LN,username:LN,password:LN,hostname:LN,port:LN,search:LN,hash:LN};this.#r=pK(v,a,!0),Sht(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of rOe){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,RN),A.encodePart=iOe;break;case"username":Object.assign(A,RN),A.encodePart=Kmr;break;case"password":Object.assign(A,RN),A.encodePart=Ymr;break;case"hostname":Object.assign(A,jmr),yht(O)?A.encodePart=Cht:A.encodePart=Tht;break;case"port":Object.assign(A,RN),A.encodePart=Eht;break;case"pathname":bht(this.#n.protocol)?(Object.assign(A,Bmr,d),A.encodePart=Xmr):(Object.assign(A,RN,d),A.encodePart=Zmr);break;case"search":Object.assign(A,RN,d),A.encodePart=ehr;break;case"hash":Object.assign(A,RN,d),A.encodePart=thr;break}try{this.#s[E]=mht(O,A),this.#n[E]=hht(this.#s[E],this.#e[E],A),this.#t[E]=ihr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(L=>L.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?c=pK(c,a,!1):c=pK(c,pht(a,s),!1)}catch{return!1}let f;for(f of rOe)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?c=pK(c,a,!1):c=pK(c,pht(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of rOe){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let L=v[A+1];E[O]=L}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let L of["type","modifier","prefix","value","suffix"]){if(A[L]<O[L])return-1;if(A[L]!==O[L])return 1}return 0},"o"),d=new mK(3,"","","","",3),v=new mK(0,"","","","",3),E=t((A,O)=>{let L=0;for(;L<Math.min(A.length,O.length);++L){let W=f(A[L],O[L]);if(W)return W}return A.length===O.length?0:f(A[L]??d,O[L]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=xht);import{AssertionError as shr}from"assert";function v6(a,s){if(a===!1)throw new shr({message:s})}t(v6,"assert");var Jc;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Jc||(Jc={}));function NB(a){return a.type===Jc.Object}t(NB,"isAstObject");function b6(a){return a.type===Jc.Property}t(b6,"isAstProperty");function Dht(a){return a.type===Jc.Array}t(Dht,"isAstArray");function IB(a){return a.type===Jc.Literal}t(IB,"isAstLiteral");function _7(a){if(a===void 0)throw new Error("Node is undefined");if(!NB(a))throw new Error("Node is not object")}t(_7,"assertAstObject");import{findNodeAtLocation as ahr,getNodeValue as ohr,printParseErrorCode as chr,visit as lhr}from"jsonc-parser";var uhr={DEFAULT:{allowTrailingComma:!1}};function hK(a,s=[],c=uhr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),lhr(a,{onObjectBegin:t((O,L,W)=>{f=v({type:"object",offset:O,length:-1,line:L+1,column:W+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,L,W,$,K)=>{f=v({type:"property",offset:L,length:-1,line:$+1,column:K+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:L,length:W,line:$,column:K,parent:f})},"onObjectProperty"),onObjectEnd:t((O,L)=>{d(O+L),f.length=O+L-f.offset,f=f.parent,d(O+L)},"onObjectEnd"),onArrayBegin:t((O,L,W,$)=>{f=v({type:"array",offset:O,length:-1,line:W+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,L)=>{f.length=O+L-f.offset,f=f.parent,d(O+L)},"onArrayEnd"),onLiteralValue:t((O,L,W,$,K)=>{v({type:fhr(O),offset:L,length:W,line:$+1,column:K+1,parent:f,value:O}),d(L+W)},"onLiteralValue"),onSeparator:t((O,L)=>{f.type==="property"&&(O===":"?f.colonOffset=L:O===","&&d(L))},"onSeparator"),onError:t((O,L,W,$,K)=>{s.push({error:O,offset:L,length:W,line:$+1,column:K+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(hK,"parse");function fhr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(fhr,"getNodeType");function sOe(a,s){return ahr(a,s)}t(sOe,"findNodeAtLocation");function gK(a){return ohr(a)}t(gK,"getNodeValue");function Aht(a){return chr(a)}t(Aht,"printParseErrorCode");var yK=class{static{t(this,"AstAdapter")}parse(s){let f=hK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Jc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Jc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){v6(s.children?.length===2,"Invalid property node");let f={type:Jc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Jc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Jc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Mx={createLiteral:t((a,s)=>({type:Jc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Jc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Jc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Jc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Jc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Jc.Array,parent:s,children:[]};for(let f of a)c.children.push(Mx.createLiteral(f,c));return c},"createArrayOfLiterals")};var _hr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,vK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Jc.Array:return this.generateArray(s,c);case Jc.Object:return this.generateObject(s,c);case Jc.Property:return this.generateProperty(s,c);case Jc.Literal:return this.generateLiteral(s,c);case Jc.FunctionCall:return this.generateFunctionCall(s,c);case Jc.Identifier:return this.generateIdentifier(s,c);case Jc.Raw:return this.generateRaw(s,c);case Jc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=_hr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as phr}from"@swc/core";import dhr from"fs/promises";var kht=t(async a=>{let s=new Set;try{let c=await dhr.readFile(a,"utf-8");(await phr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var wht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var aOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Pht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var oOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var cOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var zyt=H_(_yt(),1),qyt=H_(Jyt(),1);var fpe=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new qyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,zyt.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],L=E[2]?parseInt(E[2]):0,W=E[3],$=isNaN(L)?void 0:c[O][L][W];v={details:{property:O,index:L,field:W,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),L=O[O.length-1];d.message=`Value of property '${L}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var WN=fpe.instance;WN.addSchema(cOe,"route-configuration.schema.json");WN.addSchema(Pht,"policy-configuration.schema.json");WN.addSchema(aOe,"policies.schema.json");WN.addSchema(oOe,"open-api-route-configuration.schema.json");WN.addSchema(wht,"fragments.schema.json");var _Vr=WN.compile(cOe),Vyt=WN.compile(oOe),C7e=WN.compile(aOe);var _pe=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=C7e(s),this.results}};var ppe=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Vyt(s),this.results}};import b2r from"path";var E7e=/\$import\((.*)\)/,dpe=/\$env\((.*?)\)/g;var x6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},v2r=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),HN=t((a,s)=>{if(!a)return!1;let c=v2r(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||b6(A)&&A.name.value===v?!0:v==="{}"?A.type===Jc.Object:v==="[]"?A.type===Jc.Array:!1:!1})},"testPosition");var mpe=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),NB(s)?s.children.forEach(c=>{this.visitor(c)}):Dht(s)?s.children.forEach(c=>{this.visitor(c)}):b6(s)&&this.visitor(s.value)}},Wyt=t((a,s,c)=>f=>{if(!b6(f)||!IB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>HN(f,v))){dpe.test(f.value.value)&&s.push(new x6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(dpe).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Jc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(dpe),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Mx.createTemplateString(v,f))}},"getEnvStatementTransformer");var XK="config/routes.json",S2r=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],T2r=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Hyt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],C2r="handler/{}/options/{}/rewritePattern",E2r="handler/{}/options/{}/baseUrl",hpe=class extends mpe{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!b6(s)||!IB(s.value)||typeof s.value.value!="string")&&HN(s,C2r)){if(!s.parent||!NB(s.parent)){this.errors.push(new x6("Invalid node, expected object",XK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!b6(s)||!IB(s.value)||typeof s.value.value!="string")&&HN(s,E2r)){if(!s.parent||!NB(s.parent)){this.errors.push(new x6("Invalid node, expected object",XK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!b6(s)||!IB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!T2r.some(A=>HN(s,A))&&!Hyt.some(A=>HN(s,A))){if(E7e.test(c)){if(s.name.value==="$ref")return;this.errors.push(new x6("An $import() statement is not expected at this location.",XK,s.location,c))}return}let f=E7e.exec(c);if(Hyt.some(A=>HN(s,A))&&!f)return;if(!f){this.errors.push(new x6("Invalid $import() statement",XK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=b2r.join("..",d));let v=this.getImportName(d),E={type:Jc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=Wyt(S2r,this.errors,XK)};function Gyt(a){return`(request, context) => {
|
|
583
583
|
const { params, url, query, method, headers } = request;
|
|
584
584
|
const { host, hostname, origin, pathname, port, search } = new URL(url);
|
|
585
585
|
const e = encodeURIComponent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/core",
|
|
3
|
-
"version": "6.40.
|
|
3
|
+
"version": "6.40.4",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"prettier": "^3.3.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@zuplo/graphql": "^6.40.
|
|
44
|
-
"@zuplo/otel": "^6.40.
|
|
45
|
-
"@zuplo/runtime": "^6.40.
|
|
43
|
+
"@zuplo/graphql": "^6.40.4",
|
|
44
|
+
"@zuplo/otel": "^6.40.4",
|
|
45
|
+
"@zuplo/runtime": "^6.40.4"
|
|
46
46
|
}
|
|
47
47
|
}
|