fern-api 5.3.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +8 -8
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -2459,7 +2459,7 @@ Url: ${PHt(e)}`),!0}return!1}function hhl(e,t){return t?.length?SHt(e).some(r=>B
|
|
|
2459
2459
|
`)+r,i=n+1,n=e.indexOf(`
|
|
2460
2460
|
`,i)}while(n!==-1);return o+=e.slice(i),o}var{stdout:DUs,stderr:RUs}=TUs,wbi=Symbol("GENERATOR"),H8e=Symbol("STYLER"),XSt=Symbol("IS_EMPTY"),FUs=["ansi","ansi","ansi256","ansi16m"],K8e=Object.create(null),O4l=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=DUs?DUs.level:0;e.level=t.level===void 0?r:t.level};var P4l=e=>{let t=(...r)=>r.join(" ");return O4l(t,e),Object.setPrototypeOf(t,ZSt.prototype),t};function ZSt(e){return P4l(e)}Object.setPrototypeOf(ZSt.prototype,Function.prototype);for(let[e,t]of Object.entries(uG))K8e[e]={get(){let r=ber(this,Sbi(t.open,t.close,this[H8e]),this[XSt]);return Object.defineProperty(this,e,{value:r}),r}};K8e.visible={get(){let e=ber(this,this[H8e],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var xbi=(e,t,r,...n)=>e==="rgb"?t==="ansi16m"?uG[r].ansi16m(...n):t==="ansi256"?uG[r].ansi256(uG.rgbToAnsi256(...n)):uG[r].ansi(uG.rgbToAnsi(...n)):e==="hex"?xbi("rgb",t,r,...uG.hexToRgb(...n)):uG[r][e](...n),D4l=["rgb","hex","ansi256"];for(let e of D4l){K8e[e]={get(){let{level:r}=this;return function(...n){let i=Sbi(xbi(e,FUs[r],"color",...n),uG.color.close,this[H8e]);return ber(this,i,this[XSt])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);K8e[t]={get(){let{level:r}=this;return function(...n){let i=Sbi(xbi(e,FUs[r],"bgColor",...n),uG.bgColor.close,this[H8e]);return ber(this,i,this[XSt])}}}}var R4l=Object.defineProperties(()=>{},{...K8e,level:{enumerable:!0,get(){return this[wbi].level},set(e){this[wbi].level=e}}}),Sbi=(e,t,r)=>{let n,i;return r===void 0?(n=e,i=t):(n=r.openAll+e,i=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:i,parent:r}},ber=(e,t,r)=>{let n=(...i)=>F4l(n,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(n,R4l),n[wbi]=e,n[H8e]=t,n[XSt]=r,n},F4l=(e,t)=>{if(e.level<=0||!t)return e[XSt]?"":t;let r=e[H8e];if(r===void 0)return t;let{openAll:n,closeAll:i}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=OUs(t,r.close,r.open),r=r.parent;let o=t.indexOf(`
|
|
2461
2461
|
`);return o!==-1&&(t=PUs(t,i,n,o)),n+t+i};Object.defineProperties(ZSt.prototype,K8e);var k4l=ZSt(),bqg=ZSt({level:RUs?RUs.level:0});var ve=k4l;jt();Xt();function lqe(e){return"asyncapi"in e}function Ose(e){return"fern"in e}function Pse(e){return"openapi"in e}var uS={RequestReference:"requestReference",InlinedRequestProperty:"inlinedRequestProperty",Response:"response",StreamingResponse:"streamingResponse"};jt();jt();var ph={};ne(ph,{AsymmetricAlgorithmSchema:()=>S5s,AvailabilityStatusSchema:()=>c5s,FernDefinitionError:()=>S_t,FernDefinitionTimeoutError:()=>__t,FormDataBodyEncodingStyle:()=>A5s,HttpMethodSchema:()=>y5s,ObjectPropertyAccess:()=>I5s,StreamFormat:()=>b5s,SupportedSdkLanguageSchema:()=>d5s,UnionDiscriminatorContext:()=>v5s,WebSocketOrigin:()=>R5s,WebhookMethodSchema:()=>_5s,WebhookPayloadBodySortSchema:()=>B5s,WebhookPayloadComponentSchema:()=>T5s,WebhookSignatureAlgorithmSchema:()=>O5s,WebhookSignatureEncodingSchema:()=>P5s,WebhookTimestampFormatSchema:()=>D5s,auth:()=>a5s,availability:()=>bEi,commons:()=>u5s,encoding:()=>l5s,environments:()=>p5s,errors:()=>f5s,examples:()=>EEi,file:()=>m5s,pagination:()=>h5s,products:()=>g5s,serialization:()=>HEi,service:()=>IEi,source:()=>E5s,types:()=>vEi,validation:()=>C5s,variables:()=>w5s,versioning:()=>x5s,webhooks:()=>CEi,websocket:()=>wEi});var a5s={};var bEi={};ne(bEi,{AvailabilityStatusSchema:()=>c5s});var c5s={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var u5s={};var l5s={};var p5s={};var f5s={};var EEi={};ne(EEi,{SupportedSdkLanguageSchema:()=>d5s});var d5s={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Js:"js",Node:"node",Ts:"ts",Nodets:"nodets",Golang:"golang",Dotnet:"dotnet",Jvm:"jvm",Csharp2:"c#"};var m5s={};var h5s={};var g5s={};var IEi={};ne(IEi,{FormDataBodyEncodingStyle:()=>A5s,HttpMethodSchema:()=>y5s,StreamFormat:()=>b5s});var A5s={Json:"json",Exploded:"exploded",Form:"form"};var y5s={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var b5s={Sse:"sse",Json:"json"};var E5s={};var vEi={};ne(vEi,{ObjectPropertyAccess:()=>I5s,UnionDiscriminatorContext:()=>v5s});var I5s={ReadOnly:"read-only",WriteOnly:"write-only"};var v5s={Data:"data",Protocol:"protocol"};var C5s={};var w5s={};var x5s={};var CEi={};ne(CEi,{AsymmetricAlgorithmSchema:()=>S5s,WebhookMethodSchema:()=>_5s,WebhookPayloadBodySortSchema:()=>B5s,WebhookPayloadComponentSchema:()=>T5s,WebhookSignatureAlgorithmSchema:()=>O5s,WebhookSignatureEncodingSchema:()=>P5s,WebhookTimestampFormatSchema:()=>D5s});var S5s={RsaSha256:"rsa-sha256",RsaSha384:"rsa-sha384",RsaSha512:"rsa-sha512",EcdsaSha256:"ecdsa-sha256",EcdsaSha384:"ecdsa-sha384",EcdsaSha512:"ecdsa-sha512",Ed25519:"ed25519"};var _5s={Post:"POST",Get:"GET"};var B5s={Alphabetical:"alphabetical"};var T5s={Body:"body",Timestamp:"timestamp",NotificationUrl:"notification-url",MessageId:"message-id"};var O5s={Sha256:"sha256",Sha1:"sha1",Sha384:"sha384",Sha512:"sha512"};var P5s={Base64:"base64",Hex:"hex"};var D5s={UnixSeconds:"unix-seconds",UnixMillis:"unix-millis",Iso8601:"iso8601"};var wEi={};ne(wEi,{WebSocketOrigin:()=>R5s});var R5s={Client:"client",Server:"server"};var HEi={};ne(HEi,{AliasSchema:()=>jrr,AnyAuthItem:()=>atr,AnyAuthSchemesSchema:()=>ctr,ApiAuthSchema:()=>ptr,AsymmetricAlgorithmSchema:()=>cnr,AsymmetricSignatureSchema:()=>lnr,AuthSchemeDeclarationSchema:()=>_tr,AuthSchemeKey:()=>Aqe,AuthSchemeReferenceSchema:()=>mqe,AuthScope:()=>gqe,AuthVariable:()=>gDe,AvailabilitySchema:()=>Ttr,AvailabilityStatusSchema:()=>yqe,AvailabilityUnionSchema:()=>Otr,BaseTypeDeclarationSchema:()=>l3,BaseTypeReferenceSchema:()=>wqe,BasicAuthSchemeSchema:()=>ftr,BearerAuthSchemeSchema:()=>ytr,CasingOverridesSchema:()=>$rr,CursorPaginationSchema:()=>wrr,CustomPaginationSchema:()=>xrr,DeclarationSchema:()=>cH,DeclarationWithNameSchema:()=>c8s,DeclarationWithoutDocsSchema:()=>Ptr,DefinitionFileSchema:()=>Cnr,DiscriminatedUnionSchema:()=>Wrr,EncodingSchema:()=>Eqe,EndpointSecuritySchema:()=>ltr,EndpointSecuritySchemaDetails:()=>utr,EnumSchema:()=>Jrr,EnumValue:()=>Krr,EnumValueSchema:()=>Hrr,EnvironmentSchema:()=>Ltr,ErrorDeclarationSchema:()=>Vtr,ErrorDiscriminationSchema:()=>Snr,ExampleBodyResponseSchema:()=>qtr,ExampleCodeSampleSchema:()=>Htr,ExampleCodeSampleSchemaLanguage:()=>Gtr,ExampleCodeSampleSchemaSdk:()=>$tr,ExampleEndpointCallArraySchema:()=>u8s,ExampleEndpointCallSchema:()=>Cqe,ExampleResponseSchema:()=>Xtr,ExampleSseEventSchema:()=>Ktr,ExampleSseResponseSchema:()=>Jtr,ExampleStreamResponseSchema:()=>Ytr,ExampleTypeReferenceSchema:()=>Gw,ExampleTypeSchema:()=>vqe,ExampleTypeValueSchema:()=>ztr,ExampleWebSocketMessage:()=>err,ExampleWebSocketSession:()=>trr,ExampleWebhookCallSchema:()=>Ztr,Export:()=>Bnr,ExportDetailed:()=>_nr,FormDataBodyEncodingStyle:()=>drr,GrpcTransport:()=>krr,HeaderAuthSchemeSchema:()=>btr,HmacSignatureSchema:()=>hnr,HttpEndpointAuth:()=>arr,HttpEndpointSchema:()=>Nrr,HttpEndpointSecurity:()=>srr,HttpEndpointSecurityItem:()=>orr,HttpHeaderSchema:()=>c3,HttpInlineFileRequestBodyPropertySchema:()=>mrr,HttpInlineRequestBodyPropertySchema:()=>hrr,HttpInlineRequestBodySchema:()=>grr,HttpMethodSchema:()=>crr,HttpPathParameterSchema:()=>uH,HttpQueryParameterSchema:()=>xqe,HttpReferencedRequestBodySchema:()=>Arr,HttpRequest:()=>Err,HttpRequestBodySchema:()=>yrr,HttpRequestSchema:()=>brr,HttpResponseSchema:()=>Sqe,HttpResponseSchemaDetailed:()=>Irr,HttpResponseStreamSchema:()=>_qe,HttpResponseStreamSchemaDetailed:()=>Crr,HttpServiceSchema:()=>Qrr,InferredAuthenticatedRequestHeader:()=>dtr,InferredBearerAuthSchema:()=>gtr,InferredGetTokenEndpointSchema:()=>htr,InferredGetTokenEndpointSchemaObject:()=>mtr,ListValidationSchema:()=>Rtr,MapValidationSchema:()=>Ftr,MultipleBaseUrlsEnvironmentSchema:()=>jtr,Navigation:()=>Tnr,NumberValidationSchema:()=>ktr,OAuthAccessTokenRequestPropertiesSchema:()=>Etr,OAuthAccessTokenResponsePropertiesSchema:()=>Itr,OAuthGetTokenEndpointSchema:()=>vtr,OAuthRefreshTokenEndpointSchema:()=>xtr,OAuthRefreshTokenRequestPropertiesSchema:()=>Ctr,OAuthRefreshTokenResponsePropertiesSchema:()=>wtr,OAuthSchemeSchema:()=>Str,ObjectExtendsSchema:()=>u3,ObjectPropertyAccess:()=>Yrr,ObjectPropertySchema:()=>Ohe,ObjectPropertyWithAccessSchema:()=>Xrr,ObjectSchema:()=>Zrr,OffsetPaginationSchema:()=>Srr,OpenApiSourceSchema:()=>rrr,PackageMarkerFileSchema:()=>l8s,Pagination:()=>Trr,PaginationSchema:()=>Bqe,PathPaginationSchema:()=>_rr,ProductDeclarationHeaderObjectSchema:()=>Onr,ProductDeclarationHeaderSchema:()=>Pnr,ProductDeclarationSchema:()=>jnr,ProductValue:()=>Qnr,ProductValueDetailed:()=>Nnr,PropertyBasedErrorDiscrimination:()=>wnr,ProtobufSourceSchema:()=>nrr,ProtobufTypeSchema:()=>Qtr,QueryParameterTypeReferenceDetailed:()=>frr,ResponseError:()=>Prr,ResponseErrorWithDocsSchema:()=>Orr,ResponseErrorsSchema:()=>Drr,RetriesConfiguration:()=>Frr,RetriesDisabledSchema:()=>Rrr,RootApiFileSchema:()=>p8s,ServerVariableSchema:()=>Iqe,ServiceTransport:()=>Tqe,SingleBaseUrlEnvironmentSchema:()=>Mtr,SingleUndiscriminatedUnionTypeDetailedSchema:()=>enr,SingleUndiscriminatedUnionTypeSchema:()=>tnr,SingleUnionTypeDetailedSchema:()=>Urr,SingleUnionTypeKey:()=>Lrr,SingleUnionTypeKeySchema:()=>Mrr,SingleUnionTypeSchema:()=>zrr,SourceSchema:()=>The,StatusCodeBasedErrorDiscrimination:()=>xnr,StreamFormat:()=>vrr,StringValidationSchema:()=>Ntr,SupportedSdkLanguageSchema:()=>Wtr,TokenBearerAuthSchema:()=>Atr,TypeDeclarationSchema:()=>nnr,TypeReferenceDeclarationWithEnvOverride:()=>prr,TypeReferenceDeclarationWithEnvOverrideSchema:()=>lrr,TypeReferenceDeclarationWithName:()=>a3,TypeReferenceDeclarationWithNameSchema:()=>f8s,TypeReferenceDetailedSchema:()=>irr,TypeReferenceSchema:()=>hG,UndiscriminatedUnionSchema:()=>rnr,UnionDiscriminant:()=>Grr,UnionDiscriminantSchema:()=>qrr,UnionDiscriminatorContext:()=>Vrr,UriPaginationSchema:()=>Brr,ValidationSchema:()=>Bhe,VariableDeclarationDetailed:()=>Mnr,VariableDeclarationSchema:()=>Lnr,VariableReferenceSchema:()=>urr,VersionDeclarationHeaderObjectSchema:()=>Dnr,VersionDeclarationHeaderSchema:()=>Rnr,VersionDeclarationSchema:()=>Rqe,VersionValue:()=>knr,VersionValueDetailed:()=>Fnr,WebSocketChannelInlinedMessageSchema:()=>Anr,WebSocketChannelMessageBodySchema:()=>bnr,WebSocketChannelMessageSchema:()=>Inr,WebSocketChannelReferencedMessageSchema:()=>ynr,WebSocketChannelSchema:()=>vnr,WebSocketOrigin:()=>Enr,WebhookInlinedPayloadSchema:()=>onr,WebhookMethodSchema:()=>inr,WebhookPayloadBodySortSchema:()=>pnr,WebhookPayloadComponentSchema:()=>fnr,WebhookPayloadFormatSchema:()=>dnr,WebhookPayloadSchema:()=>anr,WebhookReferencedPayloadSchema:()=>snr,WebhookSchema:()=>gnr,WebhookSignatureAlgorithmSchema:()=>mnr,WebhookSignatureEncodingSchema:()=>Oqe,WebhookSignatureSchema:()=>Dqe,WebhookTimestampFormatSchema:()=>unr,WebhookTimestampSchema:()=>Pqe,WithAudiences:()=>fS,WithAuthSchema:()=>Btr,WithAvailability:()=>YT,WithDisplayName:()=>dS,WithDocsSchema:()=>To,WithEnvironmentVariable:()=>hqe,WithEnvironmentsSchema:()=>Utr,WithHeadersSchema:()=>Unr,WithMethodName:()=>Dtr,WithName:()=>of,WithValidation:()=>bqe,auth:()=>OEi,availability:()=>PEi,commons:()=>DEi,encoding:()=>REi,environments:()=>FEi,errors:()=>kEi,examples:()=>NEi,file:()=>QEi,pagination:()=>jEi,products:()=>MEi,service:()=>LEi,source:()=>UEi,types:()=>zEi,validation:()=>VEi,variables:()=>qEi,versioning:()=>GEi,webhooks:()=>WEi,websocket:()=>$Ei});var OEi={};ne(OEi,{AnyAuthItem:()=>atr,AnyAuthSchemesSchema:()=>ctr,ApiAuthSchema:()=>ptr,AuthSchemeDeclarationSchema:()=>_tr,AuthSchemeKey:()=>Aqe,AuthSchemeReferenceSchema:()=>mqe,AuthScope:()=>gqe,AuthVariable:()=>gDe,BasicAuthSchemeSchema:()=>ftr,BearerAuthSchemeSchema:()=>ytr,EndpointSecuritySchema:()=>ltr,EndpointSecuritySchemaDetails:()=>utr,HeaderAuthSchemeSchema:()=>btr,InferredAuthenticatedRequestHeader:()=>dtr,InferredBearerAuthSchema:()=>gtr,InferredGetTokenEndpointSchema:()=>htr,InferredGetTokenEndpointSchemaObject:()=>mtr,OAuthAccessTokenRequestPropertiesSchema:()=>Etr,OAuthAccessTokenResponsePropertiesSchema:()=>Itr,OAuthGetTokenEndpointSchema:()=>vtr,OAuthRefreshTokenEndpointSchema:()=>xtr,OAuthRefreshTokenRequestPropertiesSchema:()=>Ctr,OAuthRefreshTokenResponsePropertiesSchema:()=>wtr,OAuthSchemeSchema:()=>Str,TokenBearerAuthSchema:()=>Atr,WithAuthSchema:()=>Btr,WithEnvironmentVariable:()=>hqe});var F5s=(e,t,r)=>JSON.stringify(e,t,r);var ge={};ne(ge,{JsonError:()=>pqe,ParseError:()=>fqe,any:()=>H5s,bigint:()=>N5s,boolean:()=>K5s,booleanLiteral:()=>W5s,date:()=>Q5s,discriminant:()=>o8s,enum_:()=>ntr,getObjectLikeUtils:()=>mG,getObjectUtils:()=>hDe,getSchemaUtils:()=>ym,isProperty:()=>Rse,lazy:()=>j5s,lazyObject:()=>q5s,list:()=>otr,never:()=>J5s,number:()=>Y5s,object:()=>itr,objectWithoutOptionalProperties:()=>V5s,optional:()=>xEi,property:()=>L5s,record:()=>t8s,set:()=>r8s,string:()=>X5s,stringLiteral:()=>$5s,transform:()=>SEi,undiscriminatedUnion:()=>i8s,union:()=>a8s,unknown:()=>Z5s,withParsedProperties:()=>TEi});var Lu={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function Rd(e,t){return`Expected ${t}. Received ${YUl(e)}.`}function YUl(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function lS(e){return{...e,json:k5s(e.json),parse:k5s(e.parse)}}function k5s(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
2462
|
-
`)),{ok:!0,value:t}):n}}function rtr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var pqe=class extends Error{errors;constructor(t){super(t.map(rtr).join("; ")),this.errors=t,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};var fqe=class extends Error{errors;constructor(t){super(t.map(rtr).join("; ")),this.errors=t,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};function ym(e){return{nullable:()=>XUl(e),optional:()=>xEi(e),optionalNullable:()=>ZUl(e),transform:t=>SEi(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new fqe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new pqe(n.errors)}}}function XUl(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Lu.NULLABLE};return{...t,...ym(t)}}function xEi(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Lu.OPTIONAL};return{...t,...ym(t)}}function ZUl(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>Lu.OPTIONAL_NULLABLE};return{...t,...ym(t)}}function SEi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...ym(r)}}function N5s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:Rd(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:Rd(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Lu.BIGINT};return{...lS(e),...ym(e)}}var ezl=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function Q5s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Rd(t,"string")}]}:ezl.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Rd(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Rd(t,"Date object")}]},getType:()=>Lu.DATE};return{...lS(e),...ym(e)}}function pS(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...lS(r),...ym(r)}}}function ntr(e){let t=new Set(e);return pS(Lu.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:Rd(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:Rd(n,"enum")}]}:{ok:!0,value:n})()}function j5s(e){let t=_Ei(e);return{...t,...ym(t)}}function _Ei(e){return{parse:(t,r)=>dqe(e).parse(t,r),json:(t,r)=>dqe(e).json(t,r),getType:()=>dqe(e).getType()}}function dqe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function BEi(e){return Object.entries(e)}function w_t(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function Dse(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function x_t(e){return Object.keys(e)}function M5s(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var tzl=Object.prototype.hasOwnProperty;function mG(e){return{withParsedProperties:t=>TEi(e,t)}}function TEi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(tzl.call(t,a)){let c=t[a];s[a]=typeof c=="function"?c(o.value):c}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Dse(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Rd(n,"object")}]};let o=new Set(Object.keys(t)),s=w_t(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...ym(r),...mG(r)}}function L5s(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Rse(e){return e.isProperty}var rzl=Object.prototype.hasOwnProperty;function itr(e){let t;function r(){if(t==null){t={};for(let[d,f]of BEi(e)){let m=Rse(f)?f.rawKey:d,h=Rse(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of BEi(e)){let m=Rse(f)?f.rawKey:d,h=Rse(f)?f.valueSchema:f;nzl(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function c(){return i==null&&a(),i}function u(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>Rse(f)?f.rawKey:d),_getParsedProperties:()=>x_t(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return U5s({value:d,requiredKeys:a(),requiredKeysSet:u(),getProperty:h=>{let A=r()[h];if(A!=null)return{transformedKey:A.parsedKey,transform:b=>{let v=[...m,h];return A.valueSchema.parse(b,{...f,breadcrumbsPrefix:v})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return U5s({value:d,requiredKeys:c(),requiredKeysSet:l(),getProperty:h=>{let A=e[h];if(A!=null)return Rse(A)?{transformedKey:A.rawKey,transform:b=>{let v=[...m,h];return A.valueSchema.json(b,{...f,breadcrumbsPrefix:v})}}:{transformedKey:h,transform:b=>{let v=[...m,h];return A.json(b,{...f,breadcrumbsPrefix:v})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>Lu.OBJECT};return{...lS(p),...ym(p),...mG(p),...hDe(p)}}function U5s({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Dse(e))return{ok:!1,errors:[{path:s,message:Rd(e,"object")}]};let a=t.length,c=[],u={};for(let l in e){if(!rzl.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?u[d.transformedKey]=f.value:(u[l]=p,c.push(...f.errors))}else switch(i){case"fail":c.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=p;break}}if(a>0)for(let l of t)l in e||c.push({path:s,message:`Missing required key "${l}"`});return c.length===0||o?{ok:!0,value:u}:{ok:!1,errors:c}}function hDe(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>z5s({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>z5s({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Lu.OBJECT};return{...r,...ym(r),...mG(r),...hDe(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))t.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))r.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},getType:()=>Lu.OBJECT};return{...n,...ym(n),...mG(n),...hDe(n)}}}}function z5s({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Dse(t))return{ok:!1,errors:[{path:i,message:Rd(t,"object")}]};let o=new Set(e),[s,a]=M5s(x_t(t),l=>o.has(l)),c=r(w_t(t,a)),u=n(w_t(t,s));return c.ok&&u.ok?{ok:!0,value:{...c.value,...u.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...u.ok?[]:u.errors]}}function nzl(e){return!izl(e)}function izl(e){switch(e.getType()){case Lu.ANY:case Lu.UNKNOWN:case Lu.OPTIONAL:case Lu.OPTIONAL_NULLABLE:return!0;default:return!1}}function V5s(e){return itr(e)}function q5s(e){let t={..._Ei(e),_getRawProperties:()=>dqe(e)._getRawProperties(),_getParsedProperties:()=>dqe(e)._getParsedProperties()};return{...t,...ym(t),...mG(t),...hDe(t)}}function otr(e){let t={parse:(r,n)=>G5s(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>G5s(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>Lu.LIST};return{...lS(t),...ym(t)}}function G5s(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:Rd(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function W5s(e){return pS(Lu.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Rd(r,`${e.toString()}`)}]})()}function $5s(e){return pS(Lu.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Rd(r,`"${e}"`)}]})()}var H5s=pS(Lu.ANY,e=>({ok:!0,value:e}));var K5s=pS(Lu.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Rd(e,"boolean")}]});var J5s=pS(Lu.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var Y5s=pS(Lu.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Rd(e,"number")}]});var X5s=pS(Lu.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Rd(e,"string")}]});var Z5s=pS(Lu.UNKNOWN,e=>({ok:!0,value:e}));var ozl=Object.prototype.hasOwnProperty;function t8s(e,t){let r={parse:(n,i)=>e8s({value:n,isKeyNumeric:e.getType()===Lu.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>e8s({value:n,isKeyNumeric:e.getType()===Lu.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Lu.RECORD};return{...lS(r),...ym(r)}}function e8s({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Dse(e))return{ok:!1,errors:[{path:i,message:Rd(e,"object")}]};let o={},s=[];for(let a in e){if(!ozl.call(e,a))continue;let c=e[a];if(c===void 0)continue;let u=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(u=d)}let l=r(u),p=n(c,u);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function r8s(e){let t=otr(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Rd(n,"Set")}]},getType:()=>Lu.SET};return{...lS(r),...ym(r)}}function i8s(e){let t={parse:(r,n)=>n8s((i,o)=>i.parse(r,o),e,n),json:(r,n)=>n8s((i,o)=>i.json(r,o),e,n),getType:()=>Lu.UNDISCRIMINATED_UNION};return{...lS(t),...ym(t)}}function n8s(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function o8s(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var szl=Object.prototype.hasOwnProperty;function a8s(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=ntr(x_t(t)),o={parse:(s,a)=>s8s({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.parse(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>s8s({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.json(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>Lu.UNION};return{...lS(o),...ym(o),...mG(o)}}function s8s({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Dse(e))return{ok:!1,errors:[{path:a,message:Rd(e,"object")}]};let c=e[t],u={};for(let f in e)szl.call(e,f)&&f!==t&&(u[f]=e[f]);if(c==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(c);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...u}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(u,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var To=ge.object({docs:ge.string().optional()});var mqe=ge.object({scheme:ge.string()}).extend(To);var atr=ge.undiscriminatedUnion([ge.string(),mqe]);var ctr=ge.object({any:ge.list(atr)}).extend(To);var utr=ge.object({});var ltr=ge.object({"endpoint-security":utr}).extend(To);var ptr=ge.undiscriminatedUnion([ge.string(),mqe,ctr,ltr]);var of=ge.object({name:ge.string().optional()});var hqe=ge.object({env:ge.string().optional()});var gDe=ge.object({omit:ge.boolean().optional(),placeholder:ge.string().optional()}).extend(hqe).extend(of);var ftr=ge.object({scheme:ge.stringLiteral("basic"),username:gDe.optional(),password:gDe.optional()}).extend(To);var dtr=ge.object({"response-property":ge.string(),"header-name":ge.string(),"value-prefix":ge.string().optional()});var mtr=ge.object({endpoint:ge.string(),"expiry-response-property":ge.string().optional(),"authenticated-request-headers":ge.list(dtr).optional()});var htr=ge.undiscriminatedUnion([ge.string(),mtr]);var gtr=ge.object({scheme:ge.stringLiteral("bearer"),"get-token":htr}).extend(To);var Atr=ge.object({scheme:ge.stringLiteral("bearer"),token:gDe.optional()}).extend(To);var ytr=ge.undiscriminatedUnion([Atr,gtr]);var btr=ge.object({header:ge.string(),type:ge.string().optional(),prefix:ge.string().optional(),placeholder:ge.string().optional()}).extend(hqe).extend(of).extend(To);var gqe=ge.string();var Etr=ge.object({"client-id":ge.string().optional(),"client-secret":ge.string().optional(),scopes:ge.string().optional()});var Itr=ge.object({"access-token":ge.string().optional(),"expires-in":ge.string().optional(),"refresh-token":ge.string().optional()});var vtr=ge.object({endpoint:ge.string(),"request-properties":Etr.optional(),"response-properties":Itr.optional()});var Ctr=ge.object({"refresh-token":ge.string()});var wtr=ge.object({"access-token":ge.string().optional(),"expires-in":ge.string().optional(),"refresh-token":ge.string().optional()});var xtr=ge.object({endpoint:ge.string(),"request-properties":Ctr.optional(),"response-properties":wtr.optional()});var Str=ge.object({scheme:ge.stringLiteral("oauth"),type:ge.stringLiteral("client-credentials"),scopes:ge.list(gqe).optional(),"client-id-env":ge.string().optional(),"client-secret-env":ge.string().optional(),"token-prefix":ge.string().optional(),"token-header":ge.string().optional(),"get-token":vtr,"refresh-token":xtr.optional()}).extend(To);var _tr=ge.undiscriminatedUnion([Str,btr,ftr,ytr]);var Aqe=ge.string();var Btr=ge.object({auth:ptr.optional(),"auth-schemes":ge.record(Aqe,_tr).optional()});var PEi={};ne(PEi,{AvailabilitySchema:()=>Ttr,AvailabilityStatusSchema:()=>yqe,AvailabilityUnionSchema:()=>Otr});var yqe=ge.enum_(["in-development","pre-release","deprecated","generally-available"]);var Ttr=ge.object({status:yqe,message:ge.string().optional()});var Otr=ge.undiscriminatedUnion([yqe,Ttr]);var DEi={};ne(DEi,{DeclarationSchema:()=>cH,DeclarationWithNameSchema:()=>c8s,DeclarationWithoutDocsSchema:()=>Ptr,WithAudiences:()=>fS,WithAvailability:()=>YT,WithDisplayName:()=>dS,WithDocsSchema:()=>To,WithMethodName:()=>Dtr,WithName:()=>of,WithValidation:()=>bqe});var fS=ge.object({audiences:ge.list(ge.string()).optional()});var YT=ge.object({availability:Otr.optional()});var cH=ge.object({}).extend(To).extend(YT).extend(fS);var c8s=ge.object({}).extend(cH).extend(of);var Ptr=ge.object({}).extend(YT).extend(fS);var dS=ge.object({"display-name":ge.string().optional()});var Dtr=ge.object({"method-name":ge.string().optional()});var Rtr=ge.object({minItems:ge.number().optional(),maxItems:ge.number().optional()});var Ftr=ge.object({minProperties:ge.number().optional(),maxProperties:ge.number().optional()});var ktr=ge.object({min:ge.number().optional(),max:ge.number().optional(),exclusiveMin:ge.boolean().optional(),exclusiveMax:ge.boolean().optional(),multipleOf:ge.number().optional()});var Ntr=ge.object({minLength:ge.number().optional(),maxLength:ge.number().optional(),pattern:ge.string().optional(),format:ge.string().optional()});var Bhe=ge.undiscriminatedUnion([Ntr,ktr,Rtr,Ftr]);var bqe=ge.object({validation:Bhe.optional()});var REi={};ne(REi,{EncodingSchema:()=>Eqe,ProtobufTypeSchema:()=>Qtr});var Qtr=ge.object({type:ge.string()});var Eqe=ge.object({proto:Qtr.optional()});var FEi={};ne(FEi,{EnvironmentSchema:()=>Ltr,MultipleBaseUrlsEnvironmentSchema:()=>jtr,ServerVariableSchema:()=>Iqe,SingleBaseUrlEnvironmentSchema:()=>Mtr,WithEnvironmentsSchema:()=>Utr});var Iqe=ge.object({id:ge.string(),default:ge.string().optional(),values:ge.list(ge.string()).optional()});var jtr=ge.object({urls:ge.record(ge.string(),ge.string()),"url-templates":ge.record(ge.string(),ge.string()).optional(),"default-urls":ge.record(ge.string(),ge.string()).optional(),variables:ge.record(ge.string(),ge.list(Iqe)).optional()}).extend(fS).extend(To);var Mtr=ge.object({url:ge.string(),"default-url":ge.string().optional(),"url-template":ge.string().optional(),variables:ge.list(Iqe).optional()}).extend(fS).extend(To);var Ltr=ge.undiscriminatedUnion([ge.string(),Mtr,jtr]);var Utr=ge.object({"default-url":ge.string().optional(),"default-environment":ge.string().optional(),environments:ge.record(ge.string(),Ltr).optional()});var kEi={};ne(kEi,{ErrorDeclarationSchema:()=>Vtr});var ztr=ge.unknown();var vqe=ge.object({value:ztr}).extend(of).extend(To);var Vtr=ge.object({"status-code":ge.number(),type:ge.string().optional(),examples:ge.list(vqe).optional()}).extend(To);var NEi={};ne(NEi,{ExampleBodyResponseSchema:()=>qtr,ExampleCodeSampleSchema:()=>Htr,ExampleCodeSampleSchemaLanguage:()=>Gtr,ExampleCodeSampleSchemaSdk:()=>$tr,ExampleEndpointCallArraySchema:()=>u8s,ExampleEndpointCallSchema:()=>Cqe,ExampleResponseSchema:()=>Xtr,ExampleSseEventSchema:()=>Ktr,ExampleSseResponseSchema:()=>Jtr,ExampleStreamResponseSchema:()=>Ytr,ExampleTypeReferenceSchema:()=>Gw,ExampleTypeSchema:()=>vqe,ExampleTypeValueSchema:()=>ztr,ExampleWebSocketMessage:()=>err,ExampleWebSocketSession:()=>trr,ExampleWebhookCallSchema:()=>Ztr,SupportedSdkLanguageSchema:()=>Wtr});var Gw=ge.unknown();var qtr=ge.object({error:ge.string().optional(),body:Gw.optional()});var Gtr=ge.object({language:ge.string(),code:ge.string(),install:ge.string().optional()}).extend(To).extend(of);var Wtr=ge.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]);var $tr=ge.object({sdk:Wtr,code:ge.string()}).extend(To).extend(of);var Htr=ge.undiscriminatedUnion([$tr,Gtr]);var Ktr=ge.object({event:ge.string(),data:Gw.optional()});var Jtr=ge.object({stream:ge.list(Ktr)});var Ytr=ge.object({stream:ge.list(Gw)});var Xtr=ge.undiscriminatedUnion([qtr,Ytr,Jtr]);var Cqe=ge.object({id:ge.string().optional(),"path-parameters":ge.record(ge.string(),Gw).optional(),"query-parameters":ge.record(ge.string(),Gw).optional(),headers:ge.record(ge.string(),Gw).optional(),request:Gw.optional(),response:Xtr.optional(),"code-samples":ge.list(Htr).optional()}).extend(of).extend(To);var u8s=ge.list(Cqe);var Ztr=ge.object({id:ge.string().optional(),payload:Gw}).extend(of).extend(To);var err=ge.object({type:ge.string(),body:ge.unknown()});var trr=ge.object({"path-parameters":ge.record(ge.string(),Gw).optional(),"query-parameters":ge.record(ge.string(),Gw).optional(),headers:ge.record(ge.string(),Gw).optional(),messages:ge.list(err)}).extend(of).extend(To);var QEi={};ne(QEi,{DefinitionFileSchema:()=>Cnr,ErrorDiscriminationSchema:()=>Snr,Export:()=>Bnr,ExportDetailed:()=>_nr,Navigation:()=>Tnr,PackageMarkerFileSchema:()=>l8s,PropertyBasedErrorDiscrimination:()=>wnr,RootApiFileSchema:()=>p8s,StatusCodeBasedErrorDiscrimination:()=>xnr,WithHeadersSchema:()=>Unr});var rrr=ge.object({openapi:ge.string()});var nrr=ge.object({proto:ge.string()});var The=ge.undiscriminatedUnion([rrr,nrr]);var wqe=ge.object({default:ge.unknown().optional(),"client-default":ge.unknown().optional(),encoding:Eqe.optional(),validation:Bhe.optional()}).extend(To).extend(YT);var irr=ge.object({type:ge.string()}).extend(wqe).extend(of).extend(fS);var hG=ge.undiscriminatedUnion([ge.string(),irr]);var orr=ge.record(Aqe,ge.list(gqe));var srr=ge.list(orr);var arr=ge.undiscriminatedUnion([ge.boolean(),srr]);var crr=ge.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD"]);var urr=ge.object({variable:ge.string()}).extend(YT).extend(To);var uH=ge.undiscriminatedUnion([hG,urr]);var a3=ge.object({type:ge.string()}).extend(wqe).extend(of).extend(fS);var lrr=ge.object({env:ge.string().optional()}).extend(a3);var prr=ge.undiscriminatedUnion([ge.string(),lrr]);var c3=prr;var frr=ge.object({"allow-multiple":ge.boolean().optional(),explode:ge.boolean().optional()}).extend(a3);var xqe=ge.undiscriminatedUnion([ge.string(),frr]);var u3=ge.undiscriminatedUnion([ge.string(),ge.list(ge.string())]);var drr=ge.enum_(["json","exploded","form"]);var mrr=ge.object({style:drr.optional(),"content-type":ge.string().optional()}).extend(a3);var hrr=ge.undiscriminatedUnion([ge.string(),mrr]);var grr=ge.object({extends:u3.optional(),"extra-properties":ge.boolean().optional(),properties:ge.record(ge.string(),hrr).optional()});var Arr=ge.object({type:ge.string()}).extend(To);var yrr=ge.undiscriminatedUnion([ge.string(),Arr,grr]);var brr=ge.object({"content-type":ge.string().optional(),"path-parameters":ge.record(ge.string(),uH).optional(),"query-parameters":ge.record(ge.string(),xqe).optional(),headers:ge.record(ge.string(),c3).optional(),body:yrr.optional()}).extend(of).extend(To);var Err=ge.undiscriminatedUnion([ge.string(),brr]);var Irr=ge.object({type:ge.string().optional(),property:ge.string().optional(),"status-code":ge.number().optional()}).extend(To);var Sqe=ge.undiscriminatedUnion([ge.string(),Irr]);var vrr=ge.enum_(["sse","json"]);var Crr=ge.object({type:ge.string(),format:vrr.optional(),terminator:ge.string().optional()}).extend(To);var _qe=ge.undiscriminatedUnion([ge.string(),Crr]);var wrr=ge.object({cursor:ge.string(),next_cursor:ge.string(),results:ge.string()});var xrr=ge.object({type:ge.stringLiteral("custom"),results:ge.string()});var Srr=ge.object({offset:ge.string(),results:ge.string(),step:ge.string().optional(),"has-next-page":ge.string().optional()});var _rr=ge.object({next_path:ge.string(),results:ge.string()});var Brr=ge.object({next_uri:ge.string(),results:ge.string()});var Bqe=ge.undiscriminatedUnion([wrr,Srr,xrr,Brr,_rr]);var Trr=ge.undiscriminatedUnion([Bqe,ge.boolean()]);var Orr=ge.object({error:ge.string()}).extend(To);var Prr=ge.undiscriminatedUnion([ge.string(),Orr]);var Drr=ge.list(Prr);var Rrr=ge.object({disabled:ge.boolean().optional()});var Frr=ge.undiscriminatedUnion([Rrr]);var krr=ge.object({"service-name":ge.string()});var Tqe=ge.object({grpc:krr.optional()});var Nrr=ge.object({method:crr.optional(),"base-path":ge.string().optional(),path:ge.string(),url:ge.string().optional(),"path-parameters":ge.record(ge.string(),uH).optional(),auth:arr.optional(),idempotent:ge.boolean().optional(),"stream-condition":ge.string().optional(),request:Err.optional(),response:Sqe.optional(),"response-stream":_qe.optional(),errors:Drr.optional(),examples:ge.list(Cqe).optional(),pagination:Trr.optional(),transport:Tqe.optional(),source:The.optional(),retries:Frr.optional()}).extend(dS).extend(cH);var Qrr=ge.object({auth:ge.boolean(),url:ge.string().optional(),"base-path":ge.string(),"path-parameters":ge.record(ge.string(),hG).optional(),idempotent:ge.boolean().optional(),headers:ge.record(ge.string(),hG).optional(),transport:Tqe.optional(),source:The.optional(),endpoints:ge.record(ge.string(),Nrr)}).extend(Ptr).extend(dS);var l3=ge.object({examples:ge.list(vqe).optional(),encoding:Eqe.optional(),source:The.optional(),inline:ge.boolean().optional()}).extend(To).extend(YT).extend(fS);var jrr=ge.object({type:ge.string(),validation:Bhe.optional()}).extend(l3);var Mrr=ge.object({value:ge.string()}).extend(of);var Lrr=ge.undiscriminatedUnion([ge.string(),Mrr]);var Urr=ge.object({type:ge.string().optional(),key:Lrr.optional()}).extend(To).extend(of).extend(YT).extend(dS).extend(bqe);var zrr=ge.undiscriminatedUnion([ge.string(),Urr]);var Vrr=ge.enum_(["data","protocol"]);var qrr=ge.object({value:ge.string(),context:Vrr.optional()}).extend(of);var Grr=ge.undiscriminatedUnion([ge.string(),qrr]);var Wrr=ge.object({discriminant:Grr.optional(),extends:u3.optional(),"base-properties":ge.record(ge.string(),hG).optional(),union:ge.record(ge.string(),zrr),"default-variant":ge.string().optional()}).extend(l3);var $rr=ge.object({camel:ge.string().optional(),snake:ge.string().optional(),pascal:ge.string().optional(),"screaming-snake":ge.string().optional()});var Hrr=ge.object({value:ge.string(),casing:$rr.optional()}).extend(To).extend(of);var Krr=ge.undiscriminatedUnion([ge.string(),Hrr]);var Jrr=ge.object({default:ge.string().optional(),enum:ge.list(Krr),"forward-compatible":ge.boolean().optional()}).extend(l3);var Yrr=ge.enum_(["read-only","write-only"]);var Xrr=ge.object({access:Yrr.optional()}).extend(a3);var Ohe=ge.undiscriminatedUnion([ge.string(),Xrr]);var Zrr=ge.object({extends:u3.optional(),properties:ge.record(ge.string(),Ohe).optional(),"extra-properties":ge.boolean().optional()}).extend(l3);var enr=ge.object({type:ge.string()}).extend(To).extend(dS).extend(bqe);var tnr=ge.undiscriminatedUnion([ge.string(),enr]);var rnr=ge.object({discriminated:ge.booleanLiteral(!1),"base-properties":ge.record(ge.string(),hG).optional(),union:ge.list(tnr)}).extend(l3);var nnr=ge.undiscriminatedUnion([ge.string(),Zrr,Jrr,Wrr,rnr,jrr]);var inr=ge.enum_(["POST","GET"]);var onr=ge.object({name:ge.string(),extends:u3.optional(),properties:ge.record(ge.string(),Ohe).optional()});var snr=ge.object({type:ge.string()}).extend(To);var anr=ge.undiscriminatedUnion([ge.string(),snr,onr]);var cnr=ge.enum_(["rsa-sha256","rsa-sha384","rsa-sha512","ecdsa-sha256","ecdsa-sha384","ecdsa-sha512","ed25519"]);var Oqe=ge.enum_(["base64","hex"]);var unr=ge.enum_(["unix-seconds","unix-millis","iso8601"]);var Pqe=ge.object({header:ge.string(),format:unr.optional(),tolerance:ge.number().optional()});var lnr=ge.object({header:ge.string(),"asymmetric-algorithm":cnr,encoding:Oqe.optional(),"signature-prefix":ge.string().optional(),"jwks-url":ge.string().optional(),"key-id-header":ge.string().optional(),timestamp:Pqe.optional()});var pnr=ge.enum_(["alphabetical"]);var fnr=ge.enum_(["body","timestamp","notification-url","message-id"]);var dnr=ge.object({components:ge.list(fnr),delimiter:ge.string().optional(),"body-sort":pnr.optional()});var mnr=ge.enum_(["sha256","sha1","sha384","sha512"]);var hnr=ge.object({header:ge.string(),algorithm:mnr.optional(),encoding:Oqe.optional(),"signature-prefix":ge.string().optional(),"payload-format":dnr.optional(),timestamp:Pqe.optional()});var Dqe=ge.union("type",{hmac:hnr,asymmetric:lnr}).transform({transform:e=>e,untransform:e=>e});var gnr=ge.object({method:inr,headers:ge.record(ge.string(),c3).optional(),payload:anr,signature:Dqe.optional(),response:Sqe.optional(),"response-stream":_qe.optional(),examples:ge.list(Ztr).optional()}).extend(YT).extend(fS).extend(To).extend(dS);var Anr=ge.object({name:ge.string(),extends:u3.optional(),properties:ge.record(ge.string(),Ohe).optional()});var ynr=ge.object({type:ge.string()}).extend(To);var bnr=ge.undiscriminatedUnion([ge.string(),ynr,Anr]);var Enr=ge.enum_(["client","server"]);var Inr=ge.object({origin:Enr,body:bnr}).extend(cH).extend(dS).extend(Dtr);var vnr=ge.object({auth:ge.boolean(),url:ge.string().optional(),path:ge.string(),"connect-method-name":ge.string().optional(),headers:ge.record(ge.string(),c3).optional(),"path-parameters":ge.record(ge.string(),uH).optional(),"query-parameters":ge.record(ge.string(),xqe).optional(),messages:ge.record(ge.string(),Inr).optional(),examples:ge.list(trr).optional()}).extend(cH).extend(dS);var Cnr=ge.object({imports:ge.record(ge.string(),ge.string()).optional(),types:ge.record(ge.string(),nnr).optional(),service:Qrr.optional(),errors:ge.record(ge.string(),Vtr).optional(),webhooks:ge.record(ge.string(),gnr).optional(),"webhook-signature":Dqe.optional(),channel:vnr.optional()}).extend(To);var wnr=ge.object({strategy:ge.stringLiteral("property"),"property-name":ge.string()});var xnr=ge.object({strategy:ge.stringLiteral("status-code")});var Snr=ge.undiscriminatedUnion([wnr,xnr]);var _nr=ge.object({dependency:ge.string(),url:ge.string().optional()});var Bnr=ge.undiscriminatedUnion([ge.string(),_nr]);var Tnr=ge.undiscriminatedUnion([ge.string(),ge.list(ge.string())]);var l8s=ge.object({navigation:Tnr.optional(),export:Bnr.optional()}).extend(Cnr);var Onr=ge.object({name:ge.string().optional(),env:ge.string().optional(),value:ge.string()});var Pnr=ge.undiscriminatedUnion([ge.string(),Onr]);var Dnr=ge.object({name:ge.string().optional(),env:ge.string().optional(),value:ge.string()});var Rnr=ge.undiscriminatedUnion([ge.string(),Dnr]);var Fnr=ge.object({value:ge.string()}).extend(To).extend(of);var knr=ge.undiscriminatedUnion([ge.string(),Fnr]);var Rqe=ge.object({default:ge.string().optional(),values:ge.list(knr),header:Rnr});var Nnr=ge.object({value:ge.string(),versions:Rqe.optional()}).extend(To).extend(of);var Qnr=ge.undiscriminatedUnion([ge.string(),Nnr]);var jnr=ge.object({default:ge.string().optional(),values:ge.list(Qnr),header:Pnr});var Mnr=ge.object({type:ge.string()}).extend(To);var Lnr=ge.undiscriminatedUnion([ge.string(),Mnr]);var Unr=ge.object({headers:ge.record(ge.string(),c3).optional()});var p8s=ge.object({name:ge.string(),imports:ge.record(ge.string(),ge.string()).optional(),"error-discrimination":Snr.optional(),audiences:ge.list(ge.string()).optional(),errors:ge.list(ge.string()).optional(),"base-path":ge.string().optional(),"path-parameters":ge.record(ge.string(),uH).optional(),"idempotency-headers":ge.record(ge.string(),c3).optional(),variables:ge.record(ge.string(),Lnr).optional(),pagination:Bqe.optional(),product:jnr.optional(),version:Rqe.optional()}).extend(To).extend(dS).extend(Utr).extend(Btr).extend(Unr);var jEi={};ne(jEi,{CursorPaginationSchema:()=>wrr,CustomPaginationSchema:()=>xrr,OffsetPaginationSchema:()=>Srr,PaginationSchema:()=>Bqe,PathPaginationSchema:()=>_rr,UriPaginationSchema:()=>Brr});var MEi={};ne(MEi,{ProductDeclarationHeaderObjectSchema:()=>Onr,ProductDeclarationHeaderSchema:()=>Pnr,ProductDeclarationSchema:()=>jnr,ProductValue:()=>Qnr,ProductValueDetailed:()=>Nnr});var LEi={};ne(LEi,{FormDataBodyEncodingStyle:()=>drr,GrpcTransport:()=>krr,HttpEndpointAuth:()=>arr,HttpEndpointSchema:()=>Nrr,HttpEndpointSecurity:()=>srr,HttpEndpointSecurityItem:()=>orr,HttpHeaderSchema:()=>c3,HttpInlineFileRequestBodyPropertySchema:()=>mrr,HttpInlineRequestBodyPropertySchema:()=>hrr,HttpInlineRequestBodySchema:()=>grr,HttpMethodSchema:()=>crr,HttpPathParameterSchema:()=>uH,HttpQueryParameterSchema:()=>xqe,HttpReferencedRequestBodySchema:()=>Arr,HttpRequest:()=>Err,HttpRequestBodySchema:()=>yrr,HttpRequestSchema:()=>brr,HttpResponseSchema:()=>Sqe,HttpResponseSchemaDetailed:()=>Irr,HttpResponseStreamSchema:()=>_qe,HttpResponseStreamSchemaDetailed:()=>Crr,HttpServiceSchema:()=>Qrr,Pagination:()=>Trr,QueryParameterTypeReferenceDetailed:()=>frr,ResponseError:()=>Prr,ResponseErrorWithDocsSchema:()=>Orr,ResponseErrorsSchema:()=>Drr,RetriesConfiguration:()=>Frr,RetriesDisabledSchema:()=>Rrr,ServiceTransport:()=>Tqe,StreamFormat:()=>vrr,TypeReferenceDeclarationWithEnvOverride:()=>prr,TypeReferenceDeclarationWithEnvOverrideSchema:()=>lrr});var UEi={};ne(UEi,{OpenApiSourceSchema:()=>rrr,ProtobufSourceSchema:()=>nrr,SourceSchema:()=>The});var zEi={};ne(zEi,{AliasSchema:()=>jrr,BaseTypeDeclarationSchema:()=>l3,BaseTypeReferenceSchema:()=>wqe,CasingOverridesSchema:()=>$rr,DiscriminatedUnionSchema:()=>Wrr,EnumSchema:()=>Jrr,EnumValue:()=>Krr,EnumValueSchema:()=>Hrr,ObjectExtendsSchema:()=>u3,ObjectPropertyAccess:()=>Yrr,ObjectPropertySchema:()=>Ohe,ObjectPropertyWithAccessSchema:()=>Xrr,ObjectSchema:()=>Zrr,SingleUndiscriminatedUnionTypeDetailedSchema:()=>enr,SingleUndiscriminatedUnionTypeSchema:()=>tnr,SingleUnionTypeDetailedSchema:()=>Urr,SingleUnionTypeKey:()=>Lrr,SingleUnionTypeKeySchema:()=>Mrr,SingleUnionTypeSchema:()=>zrr,TypeDeclarationSchema:()=>nnr,TypeReferenceDeclarationWithName:()=>a3,TypeReferenceDeclarationWithNameSchema:()=>f8s,TypeReferenceDetailedSchema:()=>irr,TypeReferenceSchema:()=>hG,UndiscriminatedUnionSchema:()=>rnr,UnionDiscriminant:()=>Grr,UnionDiscriminantSchema:()=>qrr,UnionDiscriminatorContext:()=>Vrr});var f8s=ge.undiscriminatedUnion([ge.string(),a3]);var VEi={};ne(VEi,{ListValidationSchema:()=>Rtr,MapValidationSchema:()=>Ftr,NumberValidationSchema:()=>ktr,StringValidationSchema:()=>Ntr,ValidationSchema:()=>Bhe});var qEi={};ne(qEi,{VariableDeclarationDetailed:()=>Mnr,VariableDeclarationSchema:()=>Lnr,VariableReferenceSchema:()=>urr});var GEi={};ne(GEi,{VersionDeclarationHeaderObjectSchema:()=>Dnr,VersionDeclarationHeaderSchema:()=>Rnr,VersionDeclarationSchema:()=>Rqe,VersionValue:()=>knr,VersionValueDetailed:()=>Fnr});var WEi={};ne(WEi,{AsymmetricAlgorithmSchema:()=>cnr,AsymmetricSignatureSchema:()=>lnr,HmacSignatureSchema:()=>hnr,WebhookInlinedPayloadSchema:()=>onr,WebhookMethodSchema:()=>inr,WebhookPayloadBodySortSchema:()=>pnr,WebhookPayloadComponentSchema:()=>fnr,WebhookPayloadFormatSchema:()=>dnr,WebhookPayloadSchema:()=>anr,WebhookReferencedPayloadSchema:()=>snr,WebhookSchema:()=>gnr,WebhookSignatureAlgorithmSchema:()=>mnr,WebhookSignatureEncodingSchema:()=>Oqe,WebhookSignatureSchema:()=>Dqe,WebhookTimestampFormatSchema:()=>unr,WebhookTimestampSchema:()=>Pqe});var $Ei={};ne($Ei,{WebSocketChannelInlinedMessageSchema:()=>Anr,WebSocketChannelMessageBodySchema:()=>bnr,WebSocketChannelMessageSchema:()=>Inr,WebSocketChannelReferencedMessageSchema:()=>ynr,WebSocketChannelSchema:()=>vnr,WebSocketOrigin:()=>Enr});var S_t=class extends Error{statusCode;body;rawResponse;constructor({message:t,statusCode:r,body:n,rawResponse:i}){super(azl({message:t,statusCode:r,body:n})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=r,this.body=n,this.rawResponse=i}};function azl({message:e,statusCode:t,body:r}){let n=[];return e!=null&&n.push(e),t!=null&&n.push(`Status code: ${t.toString()}`),r!=null&&n.push(`Body: ${F5s(r,void 0,2)}`),n.join(`
|
|
2462
|
+
`)),{ok:!0,value:t}):n}}function rtr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var pqe=class extends Error{errors;constructor(t){super(t.map(rtr).join("; ")),this.errors=t,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};var fqe=class extends Error{errors;constructor(t){super(t.map(rtr).join("; ")),this.errors=t,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};function ym(e){return{nullable:()=>XUl(e),optional:()=>xEi(e),optionalNullable:()=>ZUl(e),transform:t=>SEi(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new fqe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new pqe(n.errors)}}}function XUl(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Lu.NULLABLE};return{...t,...ym(t)}}function xEi(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Lu.OPTIONAL};return{...t,...ym(t)}}function ZUl(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>Lu.OPTIONAL_NULLABLE};return{...t,...ym(t)}}function SEi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...ym(r)}}function N5s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:Rd(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:Rd(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Lu.BIGINT};return{...lS(e),...ym(e)}}var ezl=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function Q5s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Rd(t,"string")}]}:ezl.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Rd(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Rd(t,"Date object")}]},getType:()=>Lu.DATE};return{...lS(e),...ym(e)}}function pS(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...lS(r),...ym(r)}}}function ntr(e){let t=new Set(e);return pS(Lu.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:Rd(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:Rd(n,"enum")}]}:{ok:!0,value:n})()}function j5s(e){let t=_Ei(e);return{...t,...ym(t)}}function _Ei(e){return{parse:(t,r)=>dqe(e).parse(t,r),json:(t,r)=>dqe(e).json(t,r),getType:()=>dqe(e).getType()}}function dqe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function BEi(e){return Object.entries(e)}function w_t(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function Dse(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function x_t(e){return Object.keys(e)}function M5s(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var tzl=Object.prototype.hasOwnProperty;function mG(e){return{withParsedProperties:t=>TEi(e,t)}}function TEi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(tzl.call(t,a)){let c=t[a];s[a]=typeof c=="function"?c(o.value):c}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Dse(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Rd(n,"object")}]};let o=new Set(Object.keys(t)),s=w_t(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...ym(r),...mG(r)}}function L5s(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Rse(e){return e.isProperty}var rzl=Object.prototype.hasOwnProperty;function itr(e){let t;function r(){if(t==null){t={};for(let[d,f]of BEi(e)){let m=Rse(f)?f.rawKey:d,h=Rse(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of BEi(e)){let m=Rse(f)?f.rawKey:d,h=Rse(f)?f.valueSchema:f;nzl(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function c(){return i==null&&a(),i}function u(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>Rse(f)?f.rawKey:d),_getParsedProperties:()=>x_t(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return U5s({value:d,requiredKeys:a(),requiredKeysSet:u(),getProperty:h=>{let A=r()[h];if(A!=null)return{transformedKey:A.parsedKey,transform:b=>{let v=[...m,h];return A.valueSchema.parse(b,{...f,breadcrumbsPrefix:v})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return U5s({value:d,requiredKeys:c(),requiredKeysSet:l(),getProperty:h=>{let A=e[h];if(A!=null)return Rse(A)?{transformedKey:A.rawKey,transform:b=>{let v=[...m,h];return A.valueSchema.json(b,{...f,breadcrumbsPrefix:v})}}:{transformedKey:h,transform:b=>{let v=[...m,h];return A.json(b,{...f,breadcrumbsPrefix:v})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>Lu.OBJECT};return{...lS(p),...ym(p),...mG(p),...hDe(p)}}function U5s({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Dse(e))return{ok:!1,errors:[{path:s,message:Rd(e,"object")}]};let a=t.length,c=[],u={};for(let l in e){if(!rzl.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?u[d.transformedKey]=f.value:(u[l]=p,c.push(...f.errors))}else switch(i){case"fail":c.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=p;break}}if(a>0)for(let l of t)l in e||c.push({path:s,message:`Missing required key "${l}"`});return c.length===0||o?{ok:!0,value:u}:{ok:!1,errors:c}}function hDe(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>z5s({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>z5s({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Lu.OBJECT};return{...r,...ym(r),...mG(r),...hDe(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))t.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))r.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},getType:()=>Lu.OBJECT};return{...n,...ym(n),...mG(n),...hDe(n)}}}}function z5s({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Dse(t))return{ok:!1,errors:[{path:i,message:Rd(t,"object")}]};let o=new Set(e),[s,a]=M5s(x_t(t),l=>o.has(l)),c=r(w_t(t,a)),u=n(w_t(t,s));return c.ok&&u.ok?{ok:!0,value:{...c.value,...u.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...u.ok?[]:u.errors]}}function nzl(e){return!izl(e)}function izl(e){switch(e.getType()){case Lu.ANY:case Lu.UNKNOWN:case Lu.OPTIONAL:case Lu.OPTIONAL_NULLABLE:return!0;default:return!1}}function V5s(e){return itr(e)}function q5s(e){let t={..._Ei(e),_getRawProperties:()=>dqe(e)._getRawProperties(),_getParsedProperties:()=>dqe(e)._getParsedProperties()};return{...t,...ym(t),...mG(t),...hDe(t)}}function otr(e){let t={parse:(r,n)=>G5s(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>G5s(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>Lu.LIST};return{...lS(t),...ym(t)}}function G5s(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:Rd(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function W5s(e){return pS(Lu.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Rd(r,`${e.toString()}`)}]})()}function $5s(e){return pS(Lu.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Rd(r,`"${e}"`)}]})()}var H5s=pS(Lu.ANY,e=>({ok:!0,value:e}));var K5s=pS(Lu.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Rd(e,"boolean")}]});var J5s=pS(Lu.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var Y5s=pS(Lu.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Rd(e,"number")}]});var X5s=pS(Lu.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Rd(e,"string")}]});var Z5s=pS(Lu.UNKNOWN,e=>({ok:!0,value:e}));var ozl=Object.prototype.hasOwnProperty;function t8s(e,t){let r={parse:(n,i)=>e8s({value:n,isKeyNumeric:e.getType()===Lu.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>e8s({value:n,isKeyNumeric:e.getType()===Lu.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Lu.RECORD};return{...lS(r),...ym(r)}}function e8s({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Dse(e))return{ok:!1,errors:[{path:i,message:Rd(e,"object")}]};let o={},s=[];for(let a in e){if(!ozl.call(e,a))continue;let c=e[a];if(c===void 0)continue;let u=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(u=d)}let l=r(u),p=n(c,u);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function r8s(e){let t=otr(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Rd(n,"Set")}]},getType:()=>Lu.SET};return{...lS(r),...ym(r)}}function i8s(e){let t={parse:(r,n)=>n8s((i,o)=>i.parse(r,o),e,n),json:(r,n)=>n8s((i,o)=>i.json(r,o),e,n),getType:()=>Lu.UNDISCRIMINATED_UNION};return{...lS(t),...ym(t)}}function n8s(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function o8s(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var szl=Object.prototype.hasOwnProperty;function a8s(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=ntr(x_t(t)),o={parse:(s,a)=>s8s({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.parse(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>s8s({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.json(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>Lu.UNION};return{...lS(o),...ym(o),...mG(o)}}function s8s({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Dse(e))return{ok:!1,errors:[{path:a,message:Rd(e,"object")}]};let c=e[t],u={};for(let f in e)szl.call(e,f)&&f!==t&&(u[f]=e[f]);if(c==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(c);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...u}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(u,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var To=ge.object({docs:ge.string().optional()});var mqe=ge.object({scheme:ge.string()}).extend(To);var atr=ge.undiscriminatedUnion([ge.string(),mqe]);var ctr=ge.object({any:ge.list(atr)}).extend(To);var utr=ge.object({});var ltr=ge.object({"endpoint-security":utr}).extend(To);var ptr=ge.undiscriminatedUnion([ge.string(),mqe,ctr,ltr]);var of=ge.object({name:ge.string().optional()});var hqe=ge.object({env:ge.string().optional()});var gDe=ge.object({omit:ge.boolean().optional(),placeholder:ge.string().optional()}).extend(hqe).extend(of);var ftr=ge.object({scheme:ge.stringLiteral("basic"),username:gDe.optional(),password:gDe.optional()}).extend(To);var dtr=ge.object({"response-property":ge.string(),"header-name":ge.string(),"value-prefix":ge.string().optional()});var mtr=ge.object({endpoint:ge.string(),"expiry-response-property":ge.string().optional(),"authenticated-request-headers":ge.list(dtr).optional()});var htr=ge.undiscriminatedUnion([ge.string(),mtr]);var gtr=ge.object({scheme:ge.stringLiteral("bearer"),"get-token":htr}).extend(To);var Atr=ge.object({scheme:ge.stringLiteral("bearer"),token:gDe.optional()}).extend(To);var ytr=ge.undiscriminatedUnion([Atr,gtr]);var btr=ge.object({header:ge.string(),type:ge.string().optional(),prefix:ge.string().optional(),placeholder:ge.string().optional()}).extend(hqe).extend(of).extend(To);var gqe=ge.string();var Etr=ge.object({"client-id":ge.string().optional(),"client-secret":ge.string().optional(),scopes:ge.string().optional()});var Itr=ge.object({"access-token":ge.string().optional(),"expires-in":ge.string().optional(),"refresh-token":ge.string().optional()});var vtr=ge.object({endpoint:ge.string(),"request-properties":Etr.optional(),"response-properties":Itr.optional()});var Ctr=ge.object({"refresh-token":ge.string()});var wtr=ge.object({"access-token":ge.string().optional(),"expires-in":ge.string().optional(),"refresh-token":ge.string().optional()});var xtr=ge.object({endpoint:ge.string(),"request-properties":Ctr.optional(),"response-properties":wtr.optional()});var Str=ge.object({scheme:ge.stringLiteral("oauth"),type:ge.stringLiteral("client-credentials"),scopes:ge.list(gqe).optional(),"client-id-env":ge.string().optional(),"client-secret-env":ge.string().optional(),"token-prefix":ge.string().optional(),"token-header":ge.string().optional(),"get-token":vtr,"refresh-token":xtr.optional()}).extend(To);var _tr=ge.undiscriminatedUnion([Str,btr,ftr,ytr]);var Aqe=ge.string();var Btr=ge.object({auth:ptr.optional(),"auth-schemes":ge.record(Aqe,_tr).optional()});var PEi={};ne(PEi,{AvailabilitySchema:()=>Ttr,AvailabilityStatusSchema:()=>yqe,AvailabilityUnionSchema:()=>Otr});var yqe=ge.enum_(["in-development","pre-release","deprecated","generally-available"]);var Ttr=ge.object({status:yqe,message:ge.string().optional()});var Otr=ge.undiscriminatedUnion([yqe,Ttr]);var DEi={};ne(DEi,{DeclarationSchema:()=>cH,DeclarationWithNameSchema:()=>c8s,DeclarationWithoutDocsSchema:()=>Ptr,WithAudiences:()=>fS,WithAvailability:()=>YT,WithDisplayName:()=>dS,WithDocsSchema:()=>To,WithMethodName:()=>Dtr,WithName:()=>of,WithValidation:()=>bqe});var fS=ge.object({audiences:ge.list(ge.string()).optional()});var YT=ge.object({availability:Otr.optional()});var cH=ge.object({}).extend(To).extend(YT).extend(fS);var c8s=ge.object({}).extend(cH).extend(of);var Ptr=ge.object({}).extend(YT).extend(fS);var dS=ge.object({"display-name":ge.string().optional()});var Dtr=ge.object({"method-name":ge.string().optional()});var Rtr=ge.object({minItems:ge.number().optional(),maxItems:ge.number().optional()});var Ftr=ge.object({minProperties:ge.number().optional(),maxProperties:ge.number().optional()});var ktr=ge.object({min:ge.number().optional(),max:ge.number().optional(),exclusiveMin:ge.boolean().optional(),exclusiveMax:ge.boolean().optional(),multipleOf:ge.number().optional()});var Ntr=ge.object({minLength:ge.number().optional(),maxLength:ge.number().optional(),pattern:ge.string().optional(),format:ge.string().optional()});var Bhe=ge.undiscriminatedUnion([Ntr,ktr,Rtr,Ftr]);var bqe=ge.object({validation:Bhe.optional()});var REi={};ne(REi,{EncodingSchema:()=>Eqe,ProtobufTypeSchema:()=>Qtr});var Qtr=ge.object({type:ge.string()});var Eqe=ge.object({proto:Qtr.optional()});var FEi={};ne(FEi,{EnvironmentSchema:()=>Ltr,MultipleBaseUrlsEnvironmentSchema:()=>jtr,ServerVariableSchema:()=>Iqe,SingleBaseUrlEnvironmentSchema:()=>Mtr,WithEnvironmentsSchema:()=>Utr});var Iqe=ge.object({id:ge.string(),default:ge.string().optional(),values:ge.list(ge.string()).optional()});var jtr=ge.object({urls:ge.record(ge.string(),ge.string()),"url-templates":ge.record(ge.string(),ge.string()).optional(),"default-urls":ge.record(ge.string(),ge.string()).optional(),variables:ge.record(ge.string(),ge.list(Iqe)).optional()}).extend(fS).extend(To);var Mtr=ge.object({url:ge.string(),"default-url":ge.string().optional(),"url-template":ge.string().optional(),variables:ge.list(Iqe).optional()}).extend(fS).extend(To);var Ltr=ge.undiscriminatedUnion([ge.string(),Mtr,jtr]);var Utr=ge.object({"default-url":ge.string().optional(),"default-environment":ge.string().optional(),environments:ge.record(ge.string(),Ltr).optional()});var kEi={};ne(kEi,{ErrorDeclarationSchema:()=>Vtr});var ztr=ge.unknown();var vqe=ge.object({value:ztr}).extend(of).extend(To);var Vtr=ge.object({"status-code":ge.number(),type:ge.string().optional(),examples:ge.list(vqe).optional()}).extend(To);var NEi={};ne(NEi,{ExampleBodyResponseSchema:()=>qtr,ExampleCodeSampleSchema:()=>Htr,ExampleCodeSampleSchemaLanguage:()=>Gtr,ExampleCodeSampleSchemaSdk:()=>$tr,ExampleEndpointCallArraySchema:()=>u8s,ExampleEndpointCallSchema:()=>Cqe,ExampleResponseSchema:()=>Xtr,ExampleSseEventSchema:()=>Ktr,ExampleSseResponseSchema:()=>Jtr,ExampleStreamResponseSchema:()=>Ytr,ExampleTypeReferenceSchema:()=>Gw,ExampleTypeSchema:()=>vqe,ExampleTypeValueSchema:()=>ztr,ExampleWebSocketMessage:()=>err,ExampleWebSocketSession:()=>trr,ExampleWebhookCallSchema:()=>Ztr,SupportedSdkLanguageSchema:()=>Wtr});var Gw=ge.unknown();var qtr=ge.object({error:ge.string().optional(),body:Gw.optional()});var Gtr=ge.object({language:ge.string(),code:ge.string(),install:ge.string().optional()}).extend(To).extend(of);var Wtr=ge.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]);var $tr=ge.object({sdk:Wtr,code:ge.string()}).extend(To).extend(of);var Htr=ge.undiscriminatedUnion([$tr,Gtr]);var Ktr=ge.object({event:ge.string(),data:Gw.optional()});var Jtr=ge.object({stream:ge.list(Ktr)});var Ytr=ge.object({stream:ge.list(Gw)});var Xtr=ge.undiscriminatedUnion([qtr,Ytr,Jtr]);var Cqe=ge.object({id:ge.string().optional(),"path-parameters":ge.record(ge.string(),Gw).optional(),"query-parameters":ge.record(ge.string(),Gw).optional(),headers:ge.record(ge.string(),Gw).optional(),request:Gw.optional(),response:Xtr.optional(),"code-samples":ge.list(Htr).optional()}).extend(of).extend(To);var u8s=ge.list(Cqe);var Ztr=ge.object({id:ge.string().optional(),payload:Gw}).extend(of).extend(To);var err=ge.object({type:ge.string(),body:ge.unknown()});var trr=ge.object({"path-parameters":ge.record(ge.string(),Gw).optional(),"query-parameters":ge.record(ge.string(),Gw).optional(),headers:ge.record(ge.string(),Gw).optional(),messages:ge.list(err)}).extend(of).extend(To);var QEi={};ne(QEi,{DefinitionFileSchema:()=>Cnr,ErrorDiscriminationSchema:()=>Snr,Export:()=>Bnr,ExportDetailed:()=>_nr,Navigation:()=>Tnr,PackageMarkerFileSchema:()=>l8s,PropertyBasedErrorDiscrimination:()=>wnr,RootApiFileSchema:()=>p8s,StatusCodeBasedErrorDiscrimination:()=>xnr,WithHeadersSchema:()=>Unr});var rrr=ge.object({openapi:ge.string()});var nrr=ge.object({proto:ge.string()});var The=ge.undiscriminatedUnion([rrr,nrr]);var wqe=ge.object({default:ge.unknown().optional(),"client-default":ge.unknown().optional(),encoding:Eqe.optional(),validation:Bhe.optional()}).extend(To).extend(YT);var irr=ge.object({type:ge.string()}).extend(wqe).extend(of).extend(fS);var hG=ge.undiscriminatedUnion([ge.string(),irr]);var orr=ge.record(Aqe,ge.list(gqe));var srr=ge.list(orr);var arr=ge.undiscriminatedUnion([ge.boolean(),srr]);var crr=ge.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD"]);var urr=ge.object({variable:ge.string()}).extend(YT).extend(To);var uH=ge.undiscriminatedUnion([hG,urr]);var a3=ge.object({type:ge.string()}).extend(wqe).extend(of).extend(fS);var lrr=ge.object({env:ge.string().optional()}).extend(a3);var prr=ge.undiscriminatedUnion([ge.string(),lrr]);var c3=prr;var frr=ge.object({"allow-multiple":ge.boolean().optional(),explode:ge.boolean().optional()}).extend(a3);var xqe=ge.undiscriminatedUnion([ge.string(),frr]);var u3=ge.undiscriminatedUnion([ge.string(),ge.list(ge.string())]);var drr=ge.enum_(["json","exploded","form"]);var mrr=ge.object({style:drr.optional(),"content-type":ge.string().optional()}).extend(a3);var hrr=ge.undiscriminatedUnion([ge.string(),mrr]);var grr=ge.object({extends:u3.optional(),"extra-properties":ge.boolean().optional(),properties:ge.record(ge.string(),hrr).optional()});var Arr=ge.object({type:ge.string()}).extend(To);var yrr=ge.undiscriminatedUnion([ge.string(),Arr,grr]);var brr=ge.object({"content-type":ge.string().optional(),"path-parameters":ge.record(ge.string(),uH).optional(),"query-parameters":ge.record(ge.string(),xqe).optional(),headers:ge.record(ge.string(),c3).optional(),body:yrr.optional()}).extend(of).extend(To);var Err=ge.undiscriminatedUnion([ge.string(),brr]);var Irr=ge.object({type:ge.string().optional(),property:ge.string().optional(),"status-code":ge.number().optional()}).extend(To);var Sqe=ge.undiscriminatedUnion([ge.string(),Irr]);var vrr=ge.enum_(["sse","json"]);var Crr=ge.object({type:ge.string(),format:vrr.optional(),terminator:ge.string().optional()}).extend(To);var _qe=ge.undiscriminatedUnion([ge.string(),Crr]);var wrr=ge.object({cursor:ge.string(),next_cursor:ge.string(),results:ge.string()});var xrr=ge.object({type:ge.stringLiteral("custom"),results:ge.string()});var Srr=ge.object({offset:ge.string(),results:ge.string(),step:ge.string().optional(),"has-next-page":ge.string().optional()});var _rr=ge.object({next_path:ge.string(),results:ge.string()});var Brr=ge.object({next_uri:ge.string(),results:ge.string()});var Bqe=ge.undiscriminatedUnion([wrr,Srr,xrr,Brr,_rr]);var Trr=ge.undiscriminatedUnion([Bqe,ge.boolean()]);var Orr=ge.object({error:ge.string()}).extend(To);var Prr=ge.undiscriminatedUnion([ge.string(),Orr]);var Drr=ge.list(Prr);var Rrr=ge.object({disabled:ge.boolean().optional()});var Frr=ge.undiscriminatedUnion([Rrr]);var krr=ge.object({"service-name":ge.string()});var Tqe=ge.object({grpc:krr.optional()});var Nrr=ge.object({method:crr.optional(),"base-path":ge.string().optional(),path:ge.string(),url:ge.string().optional(),"path-parameters":ge.record(ge.string(),uH).optional(),auth:arr.optional(),idempotent:ge.boolean().optional(),"stream-condition":ge.string().optional(),request:Err.optional(),response:Sqe.optional(),"response-stream":_qe.optional(),errors:Drr.optional(),examples:ge.list(Cqe).optional(),pagination:Trr.optional(),transport:Tqe.optional(),source:The.optional(),retries:Frr.optional()}).extend(dS).extend(cH);var Qrr=ge.object({auth:ge.boolean().optional(),url:ge.string().optional(),"base-path":ge.string(),"path-parameters":ge.record(ge.string(),hG).optional(),idempotent:ge.boolean().optional(),headers:ge.record(ge.string(),hG).optional(),transport:Tqe.optional(),source:The.optional(),endpoints:ge.record(ge.string(),Nrr)}).extend(Ptr).extend(dS);var l3=ge.object({examples:ge.list(vqe).optional(),encoding:Eqe.optional(),source:The.optional(),inline:ge.boolean().optional()}).extend(To).extend(YT).extend(fS);var jrr=ge.object({type:ge.string(),validation:Bhe.optional()}).extend(l3);var Mrr=ge.object({value:ge.string()}).extend(of);var Lrr=ge.undiscriminatedUnion([ge.string(),Mrr]);var Urr=ge.object({type:ge.string().optional(),key:Lrr.optional()}).extend(To).extend(of).extend(YT).extend(dS).extend(bqe);var zrr=ge.undiscriminatedUnion([ge.string(),Urr]);var Vrr=ge.enum_(["data","protocol"]);var qrr=ge.object({value:ge.string(),context:Vrr.optional()}).extend(of);var Grr=ge.undiscriminatedUnion([ge.string(),qrr]);var Wrr=ge.object({discriminant:Grr.optional(),extends:u3.optional(),"base-properties":ge.record(ge.string(),hG).optional(),union:ge.record(ge.string(),zrr),"default-variant":ge.string().optional()}).extend(l3);var $rr=ge.object({camel:ge.string().optional(),snake:ge.string().optional(),pascal:ge.string().optional(),"screaming-snake":ge.string().optional()});var Hrr=ge.object({value:ge.string(),casing:$rr.optional()}).extend(To).extend(of);var Krr=ge.undiscriminatedUnion([ge.string(),Hrr]);var Jrr=ge.object({default:ge.string().optional(),enum:ge.list(Krr),"forward-compatible":ge.boolean().optional()}).extend(l3);var Yrr=ge.enum_(["read-only","write-only"]);var Xrr=ge.object({access:Yrr.optional()}).extend(a3);var Ohe=ge.undiscriminatedUnion([ge.string(),Xrr]);var Zrr=ge.object({extends:u3.optional(),properties:ge.record(ge.string(),Ohe).optional(),"extra-properties":ge.boolean().optional()}).extend(l3);var enr=ge.object({type:ge.string()}).extend(To).extend(dS).extend(bqe);var tnr=ge.undiscriminatedUnion([ge.string(),enr]);var rnr=ge.object({discriminated:ge.booleanLiteral(!1),"base-properties":ge.record(ge.string(),hG).optional(),union:ge.list(tnr)}).extend(l3);var nnr=ge.undiscriminatedUnion([ge.string(),Zrr,Jrr,Wrr,rnr,jrr]);var inr=ge.enum_(["POST","GET"]);var onr=ge.object({name:ge.string(),extends:u3.optional(),properties:ge.record(ge.string(),Ohe).optional()});var snr=ge.object({type:ge.string()}).extend(To);var anr=ge.undiscriminatedUnion([ge.string(),snr,onr]);var cnr=ge.enum_(["rsa-sha256","rsa-sha384","rsa-sha512","ecdsa-sha256","ecdsa-sha384","ecdsa-sha512","ed25519"]);var Oqe=ge.enum_(["base64","hex"]);var unr=ge.enum_(["unix-seconds","unix-millis","iso8601"]);var Pqe=ge.object({header:ge.string(),format:unr.optional(),tolerance:ge.number().optional()});var lnr=ge.object({header:ge.string(),"asymmetric-algorithm":cnr,encoding:Oqe.optional(),"signature-prefix":ge.string().optional(),"jwks-url":ge.string().optional(),"key-id-header":ge.string().optional(),timestamp:Pqe.optional()});var pnr=ge.enum_(["alphabetical"]);var fnr=ge.enum_(["body","timestamp","notification-url","message-id"]);var dnr=ge.object({components:ge.list(fnr),delimiter:ge.string().optional(),"body-sort":pnr.optional()});var mnr=ge.enum_(["sha256","sha1","sha384","sha512"]);var hnr=ge.object({header:ge.string(),algorithm:mnr.optional(),encoding:Oqe.optional(),"signature-prefix":ge.string().optional(),"payload-format":dnr.optional(),timestamp:Pqe.optional()});var Dqe=ge.union("type",{hmac:hnr,asymmetric:lnr}).transform({transform:e=>e,untransform:e=>e});var gnr=ge.object({method:inr,headers:ge.record(ge.string(),c3).optional(),payload:anr,signature:Dqe.optional(),response:Sqe.optional(),"response-stream":_qe.optional(),examples:ge.list(Ztr).optional()}).extend(YT).extend(fS).extend(To).extend(dS);var Anr=ge.object({name:ge.string(),extends:u3.optional(),properties:ge.record(ge.string(),Ohe).optional()});var ynr=ge.object({type:ge.string()}).extend(To);var bnr=ge.undiscriminatedUnion([ge.string(),ynr,Anr]);var Enr=ge.enum_(["client","server"]);var Inr=ge.object({origin:Enr,body:bnr}).extend(cH).extend(dS).extend(Dtr);var vnr=ge.object({auth:ge.boolean(),url:ge.string().optional(),path:ge.string(),"connect-method-name":ge.string().optional(),headers:ge.record(ge.string(),c3).optional(),"path-parameters":ge.record(ge.string(),uH).optional(),"query-parameters":ge.record(ge.string(),xqe).optional(),messages:ge.record(ge.string(),Inr).optional(),examples:ge.list(trr).optional()}).extend(cH).extend(dS);var Cnr=ge.object({imports:ge.record(ge.string(),ge.string()).optional(),types:ge.record(ge.string(),nnr).optional(),service:Qrr.optional(),errors:ge.record(ge.string(),Vtr).optional(),webhooks:ge.record(ge.string(),gnr).optional(),"webhook-signature":Dqe.optional(),channel:vnr.optional()}).extend(To);var wnr=ge.object({strategy:ge.stringLiteral("property"),"property-name":ge.string()});var xnr=ge.object({strategy:ge.stringLiteral("status-code")});var Snr=ge.undiscriminatedUnion([wnr,xnr]);var _nr=ge.object({dependency:ge.string(),url:ge.string().optional()});var Bnr=ge.undiscriminatedUnion([ge.string(),_nr]);var Tnr=ge.undiscriminatedUnion([ge.string(),ge.list(ge.string())]);var l8s=ge.object({navigation:Tnr.optional(),export:Bnr.optional()}).extend(Cnr);var Onr=ge.object({name:ge.string().optional(),env:ge.string().optional(),value:ge.string()});var Pnr=ge.undiscriminatedUnion([ge.string(),Onr]);var Dnr=ge.object({name:ge.string().optional(),env:ge.string().optional(),value:ge.string()});var Rnr=ge.undiscriminatedUnion([ge.string(),Dnr]);var Fnr=ge.object({value:ge.string()}).extend(To).extend(of);var knr=ge.undiscriminatedUnion([ge.string(),Fnr]);var Rqe=ge.object({default:ge.string().optional(),values:ge.list(knr),header:Rnr});var Nnr=ge.object({value:ge.string(),versions:Rqe.optional()}).extend(To).extend(of);var Qnr=ge.undiscriminatedUnion([ge.string(),Nnr]);var jnr=ge.object({default:ge.string().optional(),values:ge.list(Qnr),header:Pnr});var Mnr=ge.object({type:ge.string()}).extend(To);var Lnr=ge.undiscriminatedUnion([ge.string(),Mnr]);var Unr=ge.object({headers:ge.record(ge.string(),c3).optional()});var p8s=ge.object({name:ge.string(),imports:ge.record(ge.string(),ge.string()).optional(),"error-discrimination":Snr.optional(),audiences:ge.list(ge.string()).optional(),errors:ge.list(ge.string()).optional(),"base-path":ge.string().optional(),"path-parameters":ge.record(ge.string(),uH).optional(),"idempotency-headers":ge.record(ge.string(),c3).optional(),variables:ge.record(ge.string(),Lnr).optional(),pagination:Bqe.optional(),product:jnr.optional(),version:Rqe.optional()}).extend(To).extend(dS).extend(Utr).extend(Btr).extend(Unr);var jEi={};ne(jEi,{CursorPaginationSchema:()=>wrr,CustomPaginationSchema:()=>xrr,OffsetPaginationSchema:()=>Srr,PaginationSchema:()=>Bqe,PathPaginationSchema:()=>_rr,UriPaginationSchema:()=>Brr});var MEi={};ne(MEi,{ProductDeclarationHeaderObjectSchema:()=>Onr,ProductDeclarationHeaderSchema:()=>Pnr,ProductDeclarationSchema:()=>jnr,ProductValue:()=>Qnr,ProductValueDetailed:()=>Nnr});var LEi={};ne(LEi,{FormDataBodyEncodingStyle:()=>drr,GrpcTransport:()=>krr,HttpEndpointAuth:()=>arr,HttpEndpointSchema:()=>Nrr,HttpEndpointSecurity:()=>srr,HttpEndpointSecurityItem:()=>orr,HttpHeaderSchema:()=>c3,HttpInlineFileRequestBodyPropertySchema:()=>mrr,HttpInlineRequestBodyPropertySchema:()=>hrr,HttpInlineRequestBodySchema:()=>grr,HttpMethodSchema:()=>crr,HttpPathParameterSchema:()=>uH,HttpQueryParameterSchema:()=>xqe,HttpReferencedRequestBodySchema:()=>Arr,HttpRequest:()=>Err,HttpRequestBodySchema:()=>yrr,HttpRequestSchema:()=>brr,HttpResponseSchema:()=>Sqe,HttpResponseSchemaDetailed:()=>Irr,HttpResponseStreamSchema:()=>_qe,HttpResponseStreamSchemaDetailed:()=>Crr,HttpServiceSchema:()=>Qrr,Pagination:()=>Trr,QueryParameterTypeReferenceDetailed:()=>frr,ResponseError:()=>Prr,ResponseErrorWithDocsSchema:()=>Orr,ResponseErrorsSchema:()=>Drr,RetriesConfiguration:()=>Frr,RetriesDisabledSchema:()=>Rrr,ServiceTransport:()=>Tqe,StreamFormat:()=>vrr,TypeReferenceDeclarationWithEnvOverride:()=>prr,TypeReferenceDeclarationWithEnvOverrideSchema:()=>lrr});var UEi={};ne(UEi,{OpenApiSourceSchema:()=>rrr,ProtobufSourceSchema:()=>nrr,SourceSchema:()=>The});var zEi={};ne(zEi,{AliasSchema:()=>jrr,BaseTypeDeclarationSchema:()=>l3,BaseTypeReferenceSchema:()=>wqe,CasingOverridesSchema:()=>$rr,DiscriminatedUnionSchema:()=>Wrr,EnumSchema:()=>Jrr,EnumValue:()=>Krr,EnumValueSchema:()=>Hrr,ObjectExtendsSchema:()=>u3,ObjectPropertyAccess:()=>Yrr,ObjectPropertySchema:()=>Ohe,ObjectPropertyWithAccessSchema:()=>Xrr,ObjectSchema:()=>Zrr,SingleUndiscriminatedUnionTypeDetailedSchema:()=>enr,SingleUndiscriminatedUnionTypeSchema:()=>tnr,SingleUnionTypeDetailedSchema:()=>Urr,SingleUnionTypeKey:()=>Lrr,SingleUnionTypeKeySchema:()=>Mrr,SingleUnionTypeSchema:()=>zrr,TypeDeclarationSchema:()=>nnr,TypeReferenceDeclarationWithName:()=>a3,TypeReferenceDeclarationWithNameSchema:()=>f8s,TypeReferenceDetailedSchema:()=>irr,TypeReferenceSchema:()=>hG,UndiscriminatedUnionSchema:()=>rnr,UnionDiscriminant:()=>Grr,UnionDiscriminantSchema:()=>qrr,UnionDiscriminatorContext:()=>Vrr});var f8s=ge.undiscriminatedUnion([ge.string(),a3]);var VEi={};ne(VEi,{ListValidationSchema:()=>Rtr,MapValidationSchema:()=>Ftr,NumberValidationSchema:()=>ktr,StringValidationSchema:()=>Ntr,ValidationSchema:()=>Bhe});var qEi={};ne(qEi,{VariableDeclarationDetailed:()=>Mnr,VariableDeclarationSchema:()=>Lnr,VariableReferenceSchema:()=>urr});var GEi={};ne(GEi,{VersionDeclarationHeaderObjectSchema:()=>Dnr,VersionDeclarationHeaderSchema:()=>Rnr,VersionDeclarationSchema:()=>Rqe,VersionValue:()=>knr,VersionValueDetailed:()=>Fnr});var WEi={};ne(WEi,{AsymmetricAlgorithmSchema:()=>cnr,AsymmetricSignatureSchema:()=>lnr,HmacSignatureSchema:()=>hnr,WebhookInlinedPayloadSchema:()=>onr,WebhookMethodSchema:()=>inr,WebhookPayloadBodySortSchema:()=>pnr,WebhookPayloadComponentSchema:()=>fnr,WebhookPayloadFormatSchema:()=>dnr,WebhookPayloadSchema:()=>anr,WebhookReferencedPayloadSchema:()=>snr,WebhookSchema:()=>gnr,WebhookSignatureAlgorithmSchema:()=>mnr,WebhookSignatureEncodingSchema:()=>Oqe,WebhookSignatureSchema:()=>Dqe,WebhookTimestampFormatSchema:()=>unr,WebhookTimestampSchema:()=>Pqe});var $Ei={};ne($Ei,{WebSocketChannelInlinedMessageSchema:()=>Anr,WebSocketChannelMessageBodySchema:()=>bnr,WebSocketChannelMessageSchema:()=>Inr,WebSocketChannelReferencedMessageSchema:()=>ynr,WebSocketChannelSchema:()=>vnr,WebSocketOrigin:()=>Enr});var S_t=class extends Error{statusCode;body;rawResponse;constructor({message:t,statusCode:r,body:n,rawResponse:i}){super(azl({message:t,statusCode:r,body:n})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=r,this.body=n,this.rawResponse=i}};function azl({message:e,statusCode:t,body:r}){let n=[];return e!=null&&n.push(e),t!=null&&n.push(`Status code: ${t.toString()}`),r!=null&&n.push(`Body: ${F5s(r,void 0,2)}`),n.join(`
|
|
2463
2463
|
`)}var __t=class extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};function KEi(e){return e.scheme==="oauth"}var czl={optional:"optional",nullable:"nullable",set:"set",list:"list",map:"map",literal:"literal"},d8s=new Set(Object.values(czl));function Jb(e){let t=e.match(/([\w.]+)<([\w,\s]+)>/);if(t?.[0]!=null&&t[1]!=null&&t[2]!=null&&!d8s.has(t[1].trim()))return{name:t[1].trim(),arguments:t[2].split(",").map(r=>r.trim())}}function p3(e){return Jb(e)!=null}function JEi(e){if(e.request!=null)return typeof e.request=="string"?e.request:e.request.body}var Fse=class{REFERENCE_REGEX=/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/;validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let n=t.match(this.REFERENCE_REGEX);if(!(n==null||n[2]==null||n[3]==null))return{namespace:n[1],method:n[2],path:n[3]}}};function gg(e){return typeof e=="string"?!1:e?.extends!=null||e?.properties!=null}function ADe(e){return e?e.proto!=null:!1}var uzl="text";function Phe(e){return e===uzl}var Zt={};ne(Zt,{ApiDefinitionSource:()=>kk,ApiVersionScheme:()=>Fhe,AsymmetricAlgorithm:()=>Z1,AsymmetricKeySource:()=>bG,AuthScheme:()=>Gp,AuthSchemesRequirement:()=>Ww,AvailabilityStatus:()=>vC,ContainerType:()=>js,Environments:()=>J0,ErrorDeclarationDiscriminantValue:()=>Rhe,ErrorDiscriminationStrategy:()=>n6,ExampleCodeSample:()=>t6,ExampleContainer:()=>Al,ExampleEndpointSuccessResponse:()=>vA,ExamplePrimitive:()=>Bi,ExampleQueryParameterShape:()=>$w,ExampleRequestBody:()=>ZT,ExampleResponse:()=>Ag,ExampleSingleUnionTypeProperties:()=>dH,ExampleStyle:()=>Gnr,ExampleTypeReferenceShape:()=>mo,ExampleTypeShape:()=>Uu,ExampleWebSocketMessageBody:()=>i6,FileProperty:()=>Fk,FileUploadBodyPropertyEncoding:()=>B_t,FileUploadRequestProperty:()=>wC,HmacAlgorithm:()=>EG,HttpEndpointSource:()=>eO,HttpMethod:()=>Fd,HttpRequestBody:()=>ld,HttpResponseBody:()=>Iu,InvocationSource:()=>Fqe,JsonResponse:()=>Yb,Literal:()=>tv,NamedTypeDefault:()=>kqe,NonStreamHttpResponseBody:()=>J1,OAuthConfiguration:()=>lH,ObjectPropertyAccess:()=>yDe,Pagination:()=>Y0,PathParameterLocation:()=>T_t,PrimitiveTypeV1:()=>fs,PrimitiveTypeV2:()=>ti,ProtobufMethodType:()=>AG,ProtobufType:()=>Bp,PublishTarget:()=>d0,PublishingConfig:()=>fH,RequestPropertyValue:()=>Y1,ResolvedTypeReference:()=>X1,SdkRequestBodyType:()=>gG,SdkRequestShape:()=>d3,ShapeType:()=>yG,SingleUnionTypeProperties:()=>mS,Source:()=>kse,StreamingResponse:()=>tI,SupportedSdkLanguage:()=>r6,Transport:()=>m3,Type:()=>Cc,TypeReference:()=>jr,UnionDiscriminatorContext:()=>Nse,V2AuthValues:()=>f3,V2EndpointLocationHttpMethod:()=>pH,V2HttpEndpointResponseBody:()=>CC,WebSocketMessageBody:()=>eB,WebSocketMessageOrigin:()=>$nr,WebhookHttpMethod:()=>Wnr,WebhookPayload:()=>hS,WebhookPayloadBodySort:()=>O_t,WebhookPayloadComponent:()=>h3,WebhookSignatureEncoding:()=>bDe,WebhookSignatureVerification:()=>IG,WebhookTimestampFormat:()=>Qse,WellKnownProtobufType:()=>mi,audience:()=>m8s,auth:()=>YEi,commons:()=>XEi,constants:()=>h8s,dynamic:()=>$t,environment:()=>sIi,errors:()=>aIi,examples:()=>cIi,generatorExec:()=>pc,http:()=>lIi,ir:()=>pIi,proto:()=>fIi,publish:()=>dIi,types:()=>mIi,variables:()=>j8s,webhooks:()=>hIi,websocket:()=>gIi});var m8s={};var YEi={};ne(YEi,{AuthScheme:()=>Gp,AuthSchemesRequirement:()=>Ww,OAuthConfiguration:()=>lH});var Gp={bearer:e=>({...e,type:"bearer",_visit:function(t){return Gp._visit(this,t)}}),basic:e=>({...e,type:"basic",_visit:function(t){return Gp._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return Gp._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return Gp._visit(this,t)}}),inferred:e=>({...e,type:"inferred",_visit:function(t){return Gp._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"bearer":return t.bearer(e);case"basic":return t.basic(e);case"header":return t.header(e);case"oauth":return t.oauth(e);case"inferred":return t.inferred(e);default:return t._other(e)}}};var lzl={All:"ALL",Any:"ANY",EndpointSecurity:"ENDPOINT_SECURITY"},Ww={...lzl,_visit:(e,t)=>{switch(e){case Ww.All:return t.all();case Ww.Any:return t.any();case Ww.EndpointSecurity:return t.endpointSecurity();default:return t._other()}}};var lH={clientCredentials:e=>({...e,type:"clientCredentials",_visit:function(t){return lH._visit(this,t)}}),_visit:(e,t)=>e.type==="clientCredentials"?t.clientCredentials(e):t._other(e)};var XEi={};ne(XEi,{AvailabilityStatus:()=>vC});var pzl={InDevelopment:"IN_DEVELOPMENT",PreRelease:"PRE_RELEASE",GeneralAvailability:"GENERAL_AVAILABILITY",Deprecated:"DEPRECATED"},vC={...pzl,_visit:(e,t)=>{switch(e){case vC.InDevelopment:return t.inDevelopment();case vC.PreRelease:return t.preRelease();case vC.GeneralAvailability:return t.generalAvailability();case vC.Deprecated:return t.deprecated();default:return t._other()}}};var h8s={};var $t={};ne($t,{Auth:()=>g8s,AuthValues:()=>A8s,Environments:()=>x8s,ErrorSeverity:()=>znr,FileUploadRequestBodyProperty:()=>E8s,GeneratorOutputConfig:()=>S8s,HttpMethod:()=>Dhe,InlinedRequestBody:()=>I8s,LiteralType:()=>B8s,NamedType:()=>T8s,ObjectPropertyAccess:()=>Vnr,PrimitiveTypeV1:()=>XT,PublishInfo:()=>_8s,ReferencedRequestBodyType:()=>v8s,Request:()=>C8s,Response:()=>w8s,SingleDiscriminatedUnionType:()=>O8s,TypeReference:()=>P8s,auth:()=>ZEi,commons:()=>y8s,declaration:()=>b8s,endpoints:()=>eIi,environment:()=>tIi,http:()=>rIi,ir:()=>nIi,snippets:()=>iIi,types:()=>oIi,variables:()=>D8s});var ZEi={};ne(ZEi,{Auth:()=>g8s,AuthValues:()=>A8s});var g8s={basic:e=>({...e,type:"basic",_visit:function(t){return $t.Auth._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return $t.Auth._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return $t.Auth._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return $t.Auth._visit(this,t)}}),inferred:e=>({...e,type:"inferred",_visit:function(t){return $t.Auth._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"oauth":return t.oauth(e);case"inferred":return t.inferred(e);default:return t._other(e)}}};var A8s={basic:e=>({...e,type:"basic",_visit:function(t){return $t.AuthValues._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return $t.AuthValues._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return $t.AuthValues._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return $t.AuthValues._visit(this,t)}}),inferred:e=>({...e,type:"inferred",_visit:function(t){return $t.AuthValues._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"oauth":return t.oauth(e);case"inferred":return t.inferred(e);default:return t._other(e)}}};var y8s={};var b8s={};var eIi={};ne(eIi,{FileUploadRequestBodyProperty:()=>E8s,InlinedRequestBody:()=>I8s,ReferencedRequestBodyType:()=>v8s,Request:()=>C8s,Response:()=>w8s});var E8s={file:e=>({...e,type:"file",_visit:function(t){return $t.FileUploadRequestBodyProperty._visit(this,t)}}),fileArray:e=>({...e,type:"fileArray",_visit:function(t){return $t.FileUploadRequestBodyProperty._visit(this,t)}}),bodyProperty:e=>({...e,type:"bodyProperty",_visit:function(t){return $t.FileUploadRequestBodyProperty._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"fileArray":return t.fileArray(e);case"bodyProperty":return t.bodyProperty(e);default:return t._other(e)}}};var I8s={properties:e=>({value:e,type:"properties",_visit:function(t){return $t.InlinedRequestBody._visit(this,t)}}),referenced:e=>({...e,type:"referenced",_visit:function(t){return $t.InlinedRequestBody._visit(this,t)}}),fileUpload:e=>({...e,type:"fileUpload",_visit:function(t){return $t.InlinedRequestBody._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"properties":return t.properties(e.value);case"referenced":return t.referenced(e);case"fileUpload":return t.fileUpload(e);default:return t._other(e)}}};var v8s={bytes:()=>({type:"bytes",_visit:function(e){return $t.ReferencedRequestBodyType._visit(this,e)}}),typeReference:e=>({value:e,type:"typeReference",_visit:function(t){return $t.ReferencedRequestBodyType._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"bytes":return t.bytes();case"typeReference":return t.typeReference(e.value);default:return t._other(e)}}};var C8s={body:e=>({...e,type:"body",_visit:function(t){return $t.Request._visit(this,t)}}),inlined:e=>({...e,type:"inlined",_visit:function(t){return $t.Request._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"body":return t.body(e);case"inlined":return t.inlined(e);default:return t._other(e)}}};var w8s={json:()=>({type:"json",_visit:function(e){return $t.Response._visit(this,e)}}),streaming:()=>({type:"streaming",_visit:function(e){return $t.Response._visit(this,e)}}),streamParameter:()=>({type:"streamParameter",_visit:function(e){return $t.Response._visit(this,e)}}),fileDownload:()=>({type:"fileDownload",_visit:function(e){return $t.Response._visit(this,e)}}),text:()=>({type:"text",_visit:function(e){return $t.Response._visit(this,e)}}),bytes:()=>({type:"bytes",_visit:function(e){return $t.Response._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"json":return t.json();case"streaming":return t.streaming();case"streamParameter":return t.streamParameter();case"fileDownload":return t.fileDownload();case"text":return t.text();case"bytes":return t.bytes();default:return t._other(e)}}};var tIi={};ne(tIi,{Environments:()=>x8s});var x8s={singleBaseUrl:e=>({...e,type:"singleBaseUrl",_visit:function(t){return $t.Environments._visit(this,t)}}),multipleBaseUrls:e=>({...e,type:"multipleBaseUrls",_visit:function(t){return $t.Environments._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"singleBaseUrl":return t.singleBaseUrl(e);case"multipleBaseUrls":return t.multipleBaseUrls(e);default:return t._other(e)}}};var rIi={};ne(rIi,{HttpMethod:()=>Dhe});var fzl={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"},Dhe={...fzl,_visit:(e,t)=>{switch(e){case Dhe.Get:return t.get();case Dhe.Post:return t.post();case Dhe.Put:return t.put();case Dhe.Patch:return t.patch();case Dhe.Delete:return t.delete();case Dhe.Head:return t.head();default:return t._other()}}};var nIi={};ne(nIi,{GeneratorOutputConfig:()=>S8s,PublishInfo:()=>_8s});var S8s={publish:e=>({value:e,type:"publish",_visit:function(t){return $t.GeneratorOutputConfig._visit(this,t)}}),local:()=>({type:"local",_visit:function(e){return $t.GeneratorOutputConfig._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"publish":return t.publish(e.value);case"local":return t.local();default:return t._other(e)}}};var _8s={go:e=>({...e,type:"go",_visit:function(t){return $t.PublishInfo._visit(this,t)}}),swift:e=>({...e,type:"swift",_visit:function(t){return $t.PublishInfo._visit(this,t)}}),maven:e=>({...e,type:"maven",_visit:function(t){return $t.PublishInfo._visit(this,t)}}),npm:e=>({...e,type:"npm",_visit:function(t){return $t.PublishInfo._visit(this,t)}}),nuget:e=>({...e,type:"nuget",_visit:function(t){return $t.PublishInfo._visit(this,t)}}),pypi:e=>({...e,type:"pypi",_visit:function(t){return $t.PublishInfo._visit(this,t)}}),rubygems:e=>({...e,type:"rubygems",_visit:function(t){return $t.PublishInfo._visit(this,t)}}),crates:e=>({...e,type:"crates",_visit:function(t){return $t.PublishInfo._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"go":return t.go(e);case"swift":return t.swift(e);case"maven":return t.maven(e);case"npm":return t.npm(e);case"nuget":return t.nuget(e);case"pypi":return t.pypi(e);case"rubygems":return t.rubygems(e);case"crates":return t.crates(e);default:return t._other(e)}}};var iIi={};ne(iIi,{ErrorSeverity:()=>znr});var dzl={Critical:"CRITICAL",Warning:"WARNING"},znr={...dzl,_visit:(e,t)=>{switch(e){case znr.Critical:return t.critical();case znr.Warning:return t.warning();default:return t._other()}}};var oIi={};ne(oIi,{LiteralType:()=>B8s,NamedType:()=>T8s,ObjectPropertyAccess:()=>Vnr,PrimitiveTypeV1:()=>XT,SingleDiscriminatedUnionType:()=>O8s,TypeReference:()=>P8s});var B8s={boolean:e=>({value:e,type:"boolean",_visit:function(t){return $t.LiteralType._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return $t.LiteralType._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var T8s={alias:e=>({...e,type:"alias",_visit:function(t){return $t.NamedType._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return $t.NamedType._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return $t.NamedType._visit(this,t)}}),discriminatedUnion:e=>({...e,type:"discriminatedUnion",_visit:function(t){return $t.NamedType._visit(this,t)}}),undiscriminatedUnion:e=>({...e,type:"undiscriminatedUnion",_visit:function(t){return $t.NamedType._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"alias":return t.alias(e);case"enum":return t.enum(e);case"object":return t.object(e);case"discriminatedUnion":return t.discriminatedUnion(e);case"undiscriminatedUnion":return t.undiscriminatedUnion(e);default:return t._other(e)}}};var mzl={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"},Vnr={...mzl,_visit:(e,t)=>{switch(e){case Vnr.ReadOnly:return t.readOnly();case Vnr.WriteOnly:return t.writeOnly();default:return t._other()}}};var hzl={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",DateTimeRfc2822:"DATE_TIME_RFC_2822",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"},XT={...hzl,_visit:(e,t)=>{switch(e){case XT.Integer:return t.integer();case XT.Long:return t.long();case XT.Uint:return t.uint();case XT.Uint64:return t.uint64();case XT.Float:return t.float();case XT.Double:return t.double();case XT.Boolean:return t.boolean();case XT.String:return t.string();case XT.Date:return t.date();case XT.DateTime:return t.dateTime();case XT.DateTimeRfc2822:return t.dateTimeRfc2822();case XT.Uuid:return t.uuid();case XT.Base64:return t.base64();case XT.BigInteger:return t.bigInteger();default:return t._other()}}};var O8s={samePropertiesAsObject:e=>({...e,type:"samePropertiesAsObject",_visit:function(t){return $t.SingleDiscriminatedUnionType._visit(this,t)}}),singleProperty:e=>({...e,type:"singleProperty",_visit:function(t){return $t.SingleDiscriminatedUnionType._visit(this,t)}}),noProperties:e=>({...e,type:"noProperties",_visit:function(t){return $t.SingleDiscriminatedUnionType._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"samePropertiesAsObject":return t.samePropertiesAsObject(e);case"singleProperty":return t.singleProperty(e);case"noProperties":return t.noProperties(e);default:return t._other(e)}}};var P8s={list:e=>({value:e,type:"list",_visit:function(t){return $t.TypeReference._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return $t.TypeReference._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return $t.TypeReference._visit(this,t)}}),named:e=>({value:e,type:"named",_visit:function(t){return $t.TypeReference._visit(this,t)}}),nullable:e=>({value:e,type:"nullable",_visit:function(t){return $t.TypeReference._visit(this,t)}}),optional:e=>({value:e,type:"optional",_visit:function(t){return $t.TypeReference._visit(this,t)}}),primitive:e=>({value:e,type:"primitive",_visit:function(t){return $t.TypeReference._visit(this,t)}}),set:e=>({value:e,type:"set",_visit:function(t){return $t.TypeReference._visit(this,t)}}),unknown:()=>({type:"unknown",_visit:function(e){return $t.TypeReference._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"list":return t.list(e.value);case"literal":return t.literal(e.value);case"map":return t.map(e);case"named":return t.named(e.value);case"nullable":return t.nullable(e.value);case"optional":return t.optional(e.value);case"primitive":return t.primitive(e.value);case"set":return t.set(e.value);case"unknown":return t.unknown();default:return t._other(e)}}};var D8s={};var sIi={};ne(sIi,{Environments:()=>J0});var J0={singleBaseUrl:e=>({...e,type:"singleBaseUrl",_visit:function(t){return J0._visit(this,t)}}),multipleBaseUrls:e=>({...e,type:"multipleBaseUrls",_visit:function(t){return J0._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"singleBaseUrl":return t.singleBaseUrl(e);case"multipleBaseUrls":return t.multipleBaseUrls(e);default:return t._other(e)}}};var aIi={};ne(aIi,{ErrorDeclarationDiscriminantValue:()=>Rhe});var Rhe={property:e=>({value:e,type:"property",_visit:function(t){return Rhe._visit(this,t)}}),statusCode:()=>({type:"statusCode",_visit:function(e){return Rhe._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"property":return t.property(e.value);case"statusCode":return t.statusCode();default:return t._other(e)}}};var cIi={};ne(cIi,{V2AuthValues:()=>f3,V2EndpointLocationHttpMethod:()=>pH,V2HttpEndpointResponseBody:()=>CC});var f3={basic:e=>({...e,type:"basic",_visit:function(t){return f3._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return f3._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return f3._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return f3._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"oauth":return t.oauth(e);default:return t._other(e)}}};var gzl={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"},pH={...gzl,_visit:(e,t)=>{switch(e){case pH.Get:return t.get();case pH.Post:return t.post();case pH.Put:return t.put();case pH.Patch:return t.patch();case pH.Delete:return t.delete();case pH.Head:return t.head();default:return t._other()}}};var CC={error:e=>({value:e,type:"error",_visit:function(t){return CC._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return CC._visit(this,t)}}),stream:e=>({value:e,type:"stream",_visit:function(t){return CC._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"error":return t.error(e.value);case"json":return t.json(e.value);case"stream":return t.stream(e.value);default:return t._other(e)}}};var pc={};ne(pc,{GeneratorEnvironment:()=>R8s,GeneratorPublishTarget:()=>F8s,GithubPublishInfo:()=>k8s,LicenseConfig:()=>N8s,LicenseId:()=>qnr,OutputMode:()=>Q8s,config:()=>uIi});var uIi={};ne(uIi,{GeneratorEnvironment:()=>R8s,GeneratorPublishTarget:()=>F8s,GithubPublishInfo:()=>k8s,LicenseConfig:()=>N8s,LicenseId:()=>qnr,OutputMode:()=>Q8s});var R8s={local:()=>({type:"local",_visit:function(e){return pc.GeneratorEnvironment._visit(this,e)}}),remote:e=>({...e,type:"remote",_visit:function(t){return pc.GeneratorEnvironment._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"local":return t.local();case"remote":return t.remote(e);default:return t._other(e)}}};var F8s={maven:e=>({...e,type:"maven",_visit:function(t){return pc.GeneratorPublishTarget._visit(this,t)}}),npm:e=>({...e,type:"npm",_visit:function(t){return pc.GeneratorPublishTarget._visit(this,t)}}),pypi:e=>({...e,type:"pypi",_visit:function(t){return pc.GeneratorPublishTarget._visit(this,t)}}),postman:e=>({...e,type:"postman",_visit:function(t){return pc.GeneratorPublishTarget._visit(this,t)}}),rubygems:e=>({...e,type:"rubygems",_visit:function(t){return pc.GeneratorPublishTarget._visit(this,t)}}),nuget:e=>({...e,type:"nuget",_visit:function(t){return pc.GeneratorPublishTarget._visit(this,t)}}),crates:e=>({...e,type:"crates",_visit:function(t){return pc.GeneratorPublishTarget._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"maven":return t.maven(e);case"npm":return t.npm(e);case"pypi":return t.pypi(e);case"postman":return t.postman(e);case"rubygems":return t.rubygems(e);case"nuget":return t.nuget(e);case"crates":return t.crates(e);default:return t._other(e)}}};var k8s={npm:e=>({...e,type:"npm",_visit:function(t){return pc.GithubPublishInfo._visit(this,t)}}),maven:e=>({...e,type:"maven",_visit:function(t){return pc.GithubPublishInfo._visit(this,t)}}),postman:e=>({...e,type:"postman",_visit:function(t){return pc.GithubPublishInfo._visit(this,t)}}),pypi:e=>({...e,type:"pypi",_visit:function(t){return pc.GithubPublishInfo._visit(this,t)}}),rubygems:e=>({...e,type:"rubygems",_visit:function(t){return pc.GithubPublishInfo._visit(this,t)}}),nuget:e=>({...e,type:"nuget",_visit:function(t){return pc.GithubPublishInfo._visit(this,t)}}),crates:e=>({...e,type:"crates",_visit:function(t){return pc.GithubPublishInfo._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"npm":return t.npm(e);case"maven":return t.maven(e);case"postman":return t.postman(e);case"pypi":return t.pypi(e);case"rubygems":return t.rubygems(e);case"nuget":return t.nuget(e);case"crates":return t.crates(e);default:return t._other(e)}}};var N8s={basic:e=>({...e,type:"basic",_visit:function(t){return pc.LicenseConfig._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return pc.LicenseConfig._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"custom":return t.custom(e);default:return t._other(e)}}};var Azl={Mit:"MIT",Apache2:"Apache-2.0"},qnr={...Azl,_visit:(e,t)=>{switch(e){case qnr.Mit:return t.mit();case qnr.Apache2:return t.apache2();default:return t._other()}}};var Q8s={publish:e=>({...e,type:"publish",_visit:function(t){return pc.OutputMode._visit(this,t)}}),downloadFiles:()=>({type:"downloadFiles",_visit:function(e){return pc.OutputMode._visit(this,e)}}),github:e=>({...e,type:"github",_visit:function(t){return pc.OutputMode._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"publish":return t.publish(e);case"downloadFiles":return t.downloadFiles();case"github":return t.github(e);default:return t._other(e)}}};var lIi={};ne(lIi,{ExampleCodeSample:()=>t6,ExampleEndpointSuccessResponse:()=>vA,ExampleQueryParameterShape:()=>$w,ExampleRequestBody:()=>ZT,ExampleResponse:()=>Ag,FileProperty:()=>Fk,FileUploadBodyPropertyEncoding:()=>B_t,FileUploadRequestProperty:()=>wC,HttpEndpointSource:()=>eO,HttpMethod:()=>Fd,HttpRequestBody:()=>ld,HttpResponseBody:()=>Iu,JsonResponse:()=>Yb,NonStreamHttpResponseBody:()=>J1,Pagination:()=>Y0,PathParameterLocation:()=>T_t,RequestPropertyValue:()=>Y1,SdkRequestBodyType:()=>gG,SdkRequestShape:()=>d3,StreamingResponse:()=>tI,SupportedSdkLanguage:()=>r6,Transport:()=>m3});var t6={language:e=>({...e,type:"language",_visit:function(t){return t6._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return t6._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"language":return t.language(e);case"sdk":return t.sdk(e);default:return t._other(e)}}};var vA={body:e=>({value:e,type:"body",_visit:function(t){return vA._visit(this,t)}}),stream:e=>({value:e,type:"stream",_visit:function(t){return vA._visit(this,t)}}),sse:e=>({value:e,type:"sse",_visit:function(t){return vA._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"body":return t.body(e.value);case"stream":return t.stream(e.value);case"sse":return t.sse(e.value);default:return t._other(e)}}};var $w={single:()=>({type:"single",_visit:function(e){return $w._visit(this,e)}}),exploded:()=>({type:"exploded",_visit:function(e){return $w._visit(this,e)}}),commaSeparated:()=>({type:"commaSeparated",_visit:function(e){return $w._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"single":return t.single();case"exploded":return t.exploded();case"commaSeparated":return t.commaSeparated();default:return t._other(e)}}};var ZT={inlinedRequestBody:e=>({...e,type:"inlinedRequestBody",_visit:function(t){return ZT._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return ZT._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"inlinedRequestBody":return t.inlinedRequestBody(e);case"reference":return t.reference(e);default:return t._other(e)}}};var Ag={ok:e=>({value:e,type:"ok",_visit:function(t){return Ag._visit(this,t)}}),error:e=>({...e,type:"error",_visit:function(t){return Ag._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"ok":return t.ok(e.value);case"error":return t.error(e);default:return t._other(e)}}};var Fk={file:e=>({...e,type:"file",_visit:function(t){return Fk._visit(this,t)}}),fileArray:e=>({...e,type:"fileArray",_visit:function(t){return Fk._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"fileArray":return t.fileArray(e);default:return t._other(e)}}};var yzl={Exploded:"exploded",Json:"json",Form:"form"},B_t={...yzl,_visit:(e,t)=>{switch(e){case B_t.Exploded:return t.exploded();case B_t.Json:return t.json();case B_t.Form:return t.form();default:return t._other()}}};var wC={file:e=>({value:e,type:"file",_visit:function(t){return wC._visit(this,t)}}),bodyProperty:e=>({...e,type:"bodyProperty",_visit:function(t){return wC._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e.value);case"bodyProperty":return t.bodyProperty(e);default:return t._other(e)}}};var eO={proto:e=>({...e,type:"proto",_visit:function(t){return eO._visit(this,t)}}),openapi:()=>({type:"openapi",_visit:function(e){return eO._visit(this,e)}}),openrpc:()=>({type:"openrpc",_visit:function(e){return eO._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"proto":return t.proto(e);case"openapi":return t.openapi();case"openrpc":return t.openrpc();default:return t._other(e)}}};var bzl={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"},Fd={...bzl,_visit:(e,t)=>{switch(e){case Fd.Get:return t.get();case Fd.Post:return t.post();case Fd.Put:return t.put();case Fd.Patch:return t.patch();case Fd.Delete:return t.delete();case Fd.Head:return t.head();default:return t._other()}}};var ld={inlinedRequestBody:e=>({...e,type:"inlinedRequestBody",_visit:function(t){return ld._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return ld._visit(this,t)}}),fileUpload:e=>({...e,type:"fileUpload",_visit:function(t){return ld._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return ld._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"inlinedRequestBody":return t.inlinedRequestBody(e);case"reference":return t.reference(e);case"fileUpload":return t.fileUpload(e);case"bytes":return t.bytes(e);default:return t._other(e)}}};var Iu={json:e=>({value:e,type:"json",_visit:function(t){return Iu._visit(this,t)}}),fileDownload:e=>({...e,type:"fileDownload",_visit:function(t){return Iu._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Iu._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return Iu._visit(this,t)}}),streaming:e=>({value:e,type:"streaming",_visit:function(t){return Iu._visit(this,t)}}),streamParameter:e=>({...e,type:"streamParameter",_visit:function(t){return Iu._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"json":return t.json(e.value);case"fileDownload":return t.fileDownload(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streaming":return t.streaming(e.value);case"streamParameter":return t.streamParameter(e);default:return t._other(e)}}};var Yb={response:e=>({...e,type:"response",_visit:function(t){return Yb._visit(this,t)}}),nestedPropertyAsResponse:e=>({...e,type:"nestedPropertyAsResponse",_visit:function(t){return Yb._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"response":return t.response(e);case"nestedPropertyAsResponse":return t.nestedPropertyAsResponse(e);default:return t._other(e)}}};var J1={json:e=>({value:e,type:"json",_visit:function(t){return J1._visit(this,t)}}),fileDownload:e=>({...e,type:"fileDownload",_visit:function(t){return J1._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return J1._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return J1._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"json":return t.json(e.value);case"fileDownload":return t.fileDownload(e);case"text":return t.text(e);case"bytes":return t.bytes(e);default:return t._other(e)}}};var Y0={cursor:e=>({...e,type:"cursor",_visit:function(t){return Y0._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return Y0._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return Y0._visit(this,t)}}),uri:e=>({...e,type:"uri",_visit:function(t){return Y0._visit(this,t)}}),path:e=>({...e,type:"path",_visit:function(t){return Y0._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);case"uri":return t.uri(e);case"path":return t.path(e);default:return t._other(e)}}};var Ezl={Root:"ROOT",Service:"SERVICE",Endpoint:"ENDPOINT"},T_t={...Ezl,_visit:(e,t)=>{switch(e){case T_t.Root:return t.root();case T_t.Service:return t.service();case T_t.Endpoint:return t.endpoint();default:return t._other()}}};var Y1={query:e=>({...e,type:"query",_visit:function(t){return Y1._visit(this,t)}}),body:e=>({...e,type:"body",_visit:function(t){return Y1._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"query":return t.query(e);case"body":return t.body(e);default:return t._other(e)}}};var gG={typeReference:e=>({...e,type:"typeReference",_visit:function(t){return gG._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return gG._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"typeReference":return t.typeReference(e);case"bytes":return t.bytes(e);default:return t._other(e)}}};var d3={justRequestBody:e=>({value:e,type:"justRequestBody",_visit:function(t){return d3._visit(this,t)}}),wrapper:e=>({...e,type:"wrapper",_visit:function(t){return d3._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"justRequestBody":return t.justRequestBody(e.value);case"wrapper":return t.wrapper(e);default:return t._other(e)}}};var tI={json:e=>({...e,type:"json",_visit:function(t){return tI._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return tI._visit(this,t)}}),sse:e=>({...e,type:"sse",_visit:function(t){return tI._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"json":return t.json(e);case"text":return t.text(e);case"sse":return t.sse(e);default:return t._other(e)}}};var Izl={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Php:"php",Rust:"rust",Swift:"swift"},r6={...Izl,_visit:(e,t)=>{switch(e){case r6.Curl:return t.curl();case r6.Python:return t.python();case r6.Javascript:return t.javascript();case r6.Typescript:return t.typescript();case r6.Go:return t.go();case r6.Ruby:return t.ruby();case r6.Csharp:return t.csharp();case r6.Java:return t.java();case r6.Php:return t.php();case r6.Rust:return t.rust();case r6.Swift:return t.swift();default:return t._other()}}};var m3={http:()=>({type:"http",_visit:function(e){return m3._visit(this,e)}}),grpc:e=>({...e,type:"grpc",_visit:function(t){return m3._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"http":return t.http();case"grpc":return t.grpc(e);default:return t._other(e)}}};var pIi={};ne(pIi,{ApiDefinitionSource:()=>kk,ApiVersionScheme:()=>Fhe,ErrorDiscriminationStrategy:()=>n6,ExampleStyle:()=>Gnr,InvocationSource:()=>Fqe});var kk={proto:e=>({...e,type:"proto",_visit:function(t){return kk._visit(this,t)}}),openapi:()=>({type:"openapi",_visit:function(e){return kk._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"proto":return t.proto(e);case"openapi":return t.openapi();default:return t._other(e)}}};var Fhe={header:e=>({...e,type:"header",_visit:function(t){return Fhe._visit(this,t)}}),_visit:(e,t)=>e.type==="header"?t.header(e):t._other(e)};var n6={statusCode:()=>({type:"statusCode",_visit:function(e){return n6._visit(this,e)}}),property:e=>({...e,type:"property",_visit:function(t){return n6._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"statusCode":return t.statusCode();case"property":return t.property(e);default:return t._other(e)}}};var vzl={Minimal:"minimal",Comprehensive:"comprehensive"},Gnr={...vzl,_visit:(e,t)=>{switch(e){case Gnr.Minimal:return t.minimal();case Gnr.Comprehensive:return t.comprehensive();default:return t._other()}}};var Czl={Autopilot:"autopilot",Autorelease:"autorelease",Ci:"ci",Manual:"manual"},Fqe={...Czl,_visit:(e,t)=>{switch(e){case Fqe.Autopilot:return t.autopilot();case Fqe.Autorelease:return t.autorelease();case Fqe.Ci:return t.ci();case Fqe.Manual:return t.manual();default:return t._other()}}};var fIi={};ne(fIi,{ProtobufMethodType:()=>AG,ProtobufType:()=>Bp,WellKnownProtobufType:()=>mi});var wzl={Unary:"UNARY",ClientStream:"CLIENT_STREAM",ServerStream:"SERVER_STREAM",BidirectionalStream:"BIDIRECTIONAL_STREAM"},AG={...wzl,_visit:(e,t)=>{switch(e){case AG.Unary:return t.unary();case AG.ClientStream:return t.clientStream();case AG.ServerStream:return t.serverStream();case AG.BidirectionalStream:return t.bidirectionalStream();default:return t._other()}}};var Bp={wellKnown:e=>({value:e,type:"wellKnown",_visit:function(t){return Bp._visit(this,t)}}),userDefined:e=>({...e,type:"userDefined",_visit:function(t){return Bp._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"wellKnown":return t.wellKnown(e.value);case"userDefined":return t.userDefined(e);default:return t._other(e)}}};var mi={any:()=>({type:"any",_visit:function(e){return mi._visit(this,e)}}),api:()=>({type:"api",_visit:function(e){return mi._visit(this,e)}}),boolValue:()=>({type:"boolValue",_visit:function(e){return mi._visit(this,e)}}),bytesValue:()=>({type:"bytesValue",_visit:function(e){return mi._visit(this,e)}}),doubleValue:()=>({type:"doubleValue",_visit:function(e){return mi._visit(this,e)}}),duration:()=>({type:"duration",_visit:function(e){return mi._visit(this,e)}}),empty:()=>({type:"empty",_visit:function(e){return mi._visit(this,e)}}),enum:()=>({type:"enum",_visit:function(e){return mi._visit(this,e)}}),enumValue:()=>({type:"enumValue",_visit:function(e){return mi._visit(this,e)}}),field:()=>({type:"field",_visit:function(e){return mi._visit(this,e)}}),fieldCardinality:()=>({type:"fieldCardinality",_visit:function(e){return mi._visit(this,e)}}),fieldKind:()=>({type:"fieldKind",_visit:function(e){return mi._visit(this,e)}}),fieldMask:()=>({type:"fieldMask",_visit:function(e){return mi._visit(this,e)}}),floatValue:()=>({type:"floatValue",_visit:function(e){return mi._visit(this,e)}}),int32Value:()=>({type:"int32Value",_visit:function(e){return mi._visit(this,e)}}),int64Value:()=>({type:"int64Value",_visit:function(e){return mi._visit(this,e)}}),listValue:()=>({type:"listValue",_visit:function(e){return mi._visit(this,e)}}),method:()=>({type:"method",_visit:function(e){return mi._visit(this,e)}}),mixin:()=>({type:"mixin",_visit:function(e){return mi._visit(this,e)}}),nullValue:()=>({type:"nullValue",_visit:function(e){return mi._visit(this,e)}}),option:()=>({type:"option",_visit:function(e){return mi._visit(this,e)}}),sourceContext:()=>({type:"sourceContext",_visit:function(e){return mi._visit(this,e)}}),stringValue:()=>({type:"stringValue",_visit:function(e){return mi._visit(this,e)}}),struct:()=>({type:"struct",_visit:function(e){return mi._visit(this,e)}}),syntax:()=>({type:"syntax",_visit:function(e){return mi._visit(this,e)}}),timestamp:()=>({type:"timestamp",_visit:function(e){return mi._visit(this,e)}}),type:()=>({type:"type",_visit:function(e){return mi._visit(this,e)}}),uint32Value:()=>({type:"uint32Value",_visit:function(e){return mi._visit(this,e)}}),uint64Value:()=>({type:"uint64Value",_visit:function(e){return mi._visit(this,e)}}),value:()=>({type:"value",_visit:function(e){return mi._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"any":return t.any();case"api":return t.api();case"boolValue":return t.boolValue();case"bytesValue":return t.bytesValue();case"doubleValue":return t.doubleValue();case"duration":return t.duration();case"empty":return t.empty();case"enum":return t.enum();case"enumValue":return t.enumValue();case"field":return t.field();case"fieldCardinality":return t.fieldCardinality();case"fieldKind":return t.fieldKind();case"fieldMask":return t.fieldMask();case"floatValue":return t.floatValue();case"int32Value":return t.int32Value();case"int64Value":return t.int64Value();case"listValue":return t.listValue();case"method":return t.method();case"mixin":return t.mixin();case"nullValue":return t.nullValue();case"option":return t.option();case"sourceContext":return t.sourceContext();case"stringValue":return t.stringValue();case"struct":return t.struct();case"syntax":return t.syntax();case"timestamp":return t.timestamp();case"type":return t.type();case"uint32Value":return t.uint32Value();case"uint64Value":return t.uint64Value();case"value":return t.value();default:return t._other(e)}}};var dIi={};ne(dIi,{PublishTarget:()=>d0,PublishingConfig:()=>fH});var fH={github:e=>({...e,type:"github",_visit:function(t){return fH._visit(this,t)}}),direct:e=>({...e,type:"direct",_visit:function(t){return fH._visit(this,t)}}),filesystem:e=>({...e,type:"filesystem",_visit:function(t){return fH._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"github":return t.github(e);case"direct":return t.direct(e);case"filesystem":return t.filesystem(e);default:return t._other(e)}}};var d0={postman:e=>({...e,type:"postman",_visit:function(t){return d0._visit(this,t)}}),npm:e=>({...e,type:"npm",_visit:function(t){return d0._visit(this,t)}}),maven:e=>({...e,type:"maven",_visit:function(t){return d0._visit(this,t)}}),pypi:e=>({...e,type:"pypi",_visit:function(t){return d0._visit(this,t)}}),crates:e=>({...e,type:"crates",_visit:function(t){return d0._visit(this,t)}}),go:e=>({...e,type:"go",_visit:function(t){return d0._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"postman":return t.postman(e);case"npm":return t.npm(e);case"maven":return t.maven(e);case"pypi":return t.pypi(e);case"crates":return t.crates(e);case"go":return t.go(e);default:return t._other(e)}}};var mIi={};ne(mIi,{ContainerType:()=>js,ExampleContainer:()=>Al,ExamplePrimitive:()=>Bi,ExampleSingleUnionTypeProperties:()=>dH,ExampleTypeReferenceShape:()=>mo,ExampleTypeShape:()=>Uu,Literal:()=>tv,NamedTypeDefault:()=>kqe,ObjectPropertyAccess:()=>yDe,PrimitiveTypeV1:()=>fs,PrimitiveTypeV2:()=>ti,ResolvedTypeReference:()=>X1,ShapeType:()=>yG,SingleUnionTypeProperties:()=>mS,Source:()=>kse,Type:()=>Cc,TypeReference:()=>jr,UnionDiscriminatorContext:()=>Nse});var js={list:e=>({list:e,type:"list",_visit:function(t){return js._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return js._visit(this,t)}}),nullable:e=>({nullable:e,type:"nullable",_visit:function(t){return js._visit(this,t)}}),optional:e=>({optional:e,type:"optional",_visit:function(t){return js._visit(this,t)}}),set:e=>({set:e,type:"set",_visit:function(t){return js._visit(this,t)}}),literal:e=>({literal:e,type:"literal",_visit:function(t){return js._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"list":return t.list(e.list);case"map":return t.map(e);case"nullable":return t.nullable(e.nullable);case"optional":return t.optional(e.optional);case"set":return t.set(e.set);case"literal":return t.literal(e.literal);default:return t._other(e)}}};var Al={list:e=>({...e,type:"list",_visit:function(t){return Al._visit(this,t)}}),set:e=>({...e,type:"set",_visit:function(t){return Al._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Al._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Al._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Al._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Al._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"list":return t.list(e);case"set":return t.set(e);case"optional":return t.optional(e);case"nullable":return t.nullable(e);case"map":return t.map(e);case"literal":return t.literal(e);default:return t._other(e)}}};var Bi={integer:e=>({integer:e,type:"integer",_visit:function(t){return Bi._visit(this,t)}}),long:e=>({long:e,type:"long",_visit:function(t){return Bi._visit(this,t)}}),uint:e=>({uint:e,type:"uint",_visit:function(t){return Bi._visit(this,t)}}),uint64:e=>({uint64:e,type:"uint64",_visit:function(t){return Bi._visit(this,t)}}),float:e=>({float:e,type:"float",_visit:function(t){return Bi._visit(this,t)}}),double:e=>({double:e,type:"double",_visit:function(t){return Bi._visit(this,t)}}),boolean:e=>({boolean:e,type:"boolean",_visit:function(t){return Bi._visit(this,t)}}),string:e=>({string:e,type:"string",_visit:function(t){return Bi._visit(this,t)}}),date:e=>({date:e,type:"date",_visit:function(t){return Bi._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Bi._visit(this,t)}}),datetimeRfc2822:e=>({...e,type:"datetimeRfc2822",_visit:function(t){return Bi._visit(this,t)}}),uuid:e=>({uuid:e,type:"uuid",_visit:function(t){return Bi._visit(this,t)}}),base64:e=>({base64:e,type:"base64",_visit:function(t){return Bi._visit(this,t)}}),bigInteger:e=>({bigInteger:e,type:"bigInteger",_visit:function(t){return Bi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"integer":return t.integer(e.integer);case"long":return t.long(e.long);case"uint":return t.uint(e.uint);case"uint64":return t.uint64(e.uint64);case"float":return t.float(e.float);case"double":return t.double(e.double);case"boolean":return t.boolean(e.boolean);case"string":return t.string(e.string);case"date":return t.date(e.date);case"datetime":return t.datetime(e);case"datetimeRfc2822":return t.datetimeRfc2822(e);case"uuid":return t.uuid(e.uuid);case"base64":return t.base64(e.base64);case"bigInteger":return t.bigInteger(e.bigInteger);default:return t._other(e)}}};var dH={samePropertiesAsObject:e=>({...e,type:"samePropertiesAsObject",_visit:function(t){return dH._visit(this,t)}}),singleProperty:e=>({...e,type:"singleProperty",_visit:function(t){return dH._visit(this,t)}}),noProperties:()=>({type:"noProperties",_visit:function(e){return dH._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"samePropertiesAsObject":return t.samePropertiesAsObject(e);case"singleProperty":return t.singleProperty(e);case"noProperties":return t.noProperties();default:return t._other(e)}}};var mo={primitive:e=>({primitive:e,type:"primitive",_visit:function(t){return mo._visit(this,t)}}),container:e=>({container:e,type:"container",_visit:function(t){return mo._visit(this,t)}}),unknown:e=>({unknown:e,type:"unknown",_visit:function(t){return mo._visit(this,t)}}),named:e=>({...e,type:"named",_visit:function(t){return mo._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.primitive);case"container":return t.container(e.container);case"unknown":return t.unknown(e.unknown);case"named":return t.named(e);default:return t._other(e)}}};var Uu={alias:e=>({...e,type:"alias",_visit:function(t){return Uu._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Uu._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Uu._visit(this,t)}}),union:e=>({...e,type:"union",_visit:function(t){return Uu._visit(this,t)}}),undiscriminatedUnion:e=>({...e,type:"undiscriminatedUnion",_visit:function(t){return Uu._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"alias":return t.alias(e);case"enum":return t.enum(e);case"object":return t.object(e);case"union":return t.union(e);case"undiscriminatedUnion":return t.undiscriminatedUnion(e);default:return t._other(e)}}};var tv={string:e=>({string:e,type:"string",_visit:function(t){return tv._visit(this,t)}}),boolean:e=>({boolean:e,type:"boolean",_visit:function(t){return tv._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"string":return t.string(e.string);case"boolean":return t.boolean(e.boolean);default:return t._other(e)}}};var kqe={enum:e=>({...e,type:"enum",_visit:function(t){return kqe._visit(this,t)}}),_visit:(e,t)=>e.type==="enum"?t.enum(e):t._other(e)};var xzl={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"},yDe={...xzl,_visit:(e,t)=>{switch(e){case yDe.ReadOnly:return t.readOnly();case yDe.WriteOnly:return t.writeOnly();default:return t._other()}}};var Szl={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",DateTimeRfc2822:"DATE_TIME_RFC_2822",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"},fs={...Szl,_visit:(e,t)=>{switch(e){case fs.Integer:return t.integer();case fs.Long:return t.long();case fs.Uint:return t.uint();case fs.Uint64:return t.uint64();case fs.Float:return t.float();case fs.Double:return t.double();case fs.Boolean:return t.boolean();case fs.String:return t.string();case fs.Date:return t.date();case fs.DateTime:return t.dateTime();case fs.DateTimeRfc2822:return t.dateTimeRfc2822();case fs.Uuid:return t.uuid();case fs.Base64:return t.base64();case fs.BigInteger:return t.bigInteger();default:return t._other()}}};var ti={integer:e=>({...e,type:"integer",_visit:function(t){return ti._visit(this,t)}}),long:e=>({...e,type:"long",_visit:function(t){return ti._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return ti._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return ti._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return ti._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return ti._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return ti._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return ti._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return ti._visit(this,t)}}),dateTime:e=>({...e,type:"dateTime",_visit:function(t){return ti._visit(this,t)}}),dateTimeRfc2822:e=>({...e,type:"dateTimeRfc2822",_visit:function(t){return ti._visit(this,t)}}),uuid:e=>({...e,type:"uuid",_visit:function(t){return ti._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return ti._visit(this,t)}}),bigInteger:e=>({...e,type:"bigInteger",_visit:function(t){return ti._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"integer":return t.integer(e);case"long":return t.long(e);case"uint":return t.uint(e);case"uint64":return t.uint64(e);case"float":return t.float(e);case"double":return t.double(e);case"boolean":return t.boolean(e);case"string":return t.string(e);case"date":return t.date(e);case"dateTime":return t.dateTime(e);case"dateTimeRfc2822":return t.dateTimeRfc2822(e);case"uuid":return t.uuid(e);case"base64":return t.base64(e);case"bigInteger":return t.bigInteger(e);default:return t._other(e)}}};var X1={container:e=>({container:e,type:"container",_visit:function(t){return X1._visit(this,t)}}),named:e=>({...e,type:"named",_visit:function(t){return X1._visit(this,t)}}),primitive:e=>({primitive:e,type:"primitive",_visit:function(t){return X1._visit(this,t)}}),unknown:()=>({type:"unknown",_visit:function(e){return X1._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"container":return t.container(e.container);case"named":return t.named(e);case"primitive":return t.primitive(e.primitive);case"unknown":return t.unknown();default:return t._other(e)}}};var _zl={Enum:"ENUM",Object:"OBJECT",Union:"UNION",UndiscriminatedUnion:"UNDISCRIMINATED_UNION"},yG={..._zl,_visit:(e,t)=>{switch(e){case yG.Enum:return t.enum();case yG.Object:return t.object();case yG.Union:return t.union();case yG.UndiscriminatedUnion:return t.undiscriminatedUnion();default:return t._other()}}};var mS={samePropertiesAsObject:e=>({...e,propertiesType:"samePropertiesAsObject",_visit:function(t){return mS._visit(this,t)}}),singleProperty:e=>({...e,propertiesType:"singleProperty",_visit:function(t){return mS._visit(this,t)}}),noProperties:()=>({propertiesType:"noProperties",_visit:function(e){return mS._visit(this,e)}}),_visit:(e,t)=>{switch(e.propertiesType){case"samePropertiesAsObject":return t.samePropertiesAsObject(e);case"singleProperty":return t.singleProperty(e);case"noProperties":return t.noProperties();default:return t._other(e)}}};var kse={proto:e=>({value:e,type:"proto",_visit:function(t){return kse._visit(this,t)}}),_visit:(e,t)=>e.type==="proto"?t.proto(e.value):t._other(e)};var Cc={alias:e=>({...e,type:"alias",_visit:function(t){return Cc._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Cc._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Cc._visit(this,t)}}),union:e=>({...e,type:"union",_visit:function(t){return Cc._visit(this,t)}}),undiscriminatedUnion:e=>({...e,type:"undiscriminatedUnion",_visit:function(t){return Cc._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"alias":return t.alias(e);case"enum":return t.enum(e);case"object":return t.object(e);case"union":return t.union(e);case"undiscriminatedUnion":return t.undiscriminatedUnion(e);default:return t._other(e)}}};var jr={container:e=>({container:e,type:"container",_visit:function(t){return jr._visit(this,t)}}),named:e=>({...e,type:"named",_visit:function(t){return jr._visit(this,t)}}),primitive:e=>({primitive:e,type:"primitive",_visit:function(t){return jr._visit(this,t)}}),unknown:()=>({type:"unknown",_visit:function(e){return jr._visit(this,e)}}),_visit:(e,t)=>{switch(e.type){case"container":return t.container(e.container);case"named":return t.named(e);case"primitive":return t.primitive(e.primitive);case"unknown":return t.unknown();default:return t._other(e)}}};var Bzl={Data:"data",Protocol:"protocol"},Nse={...Bzl,_visit:(e,t)=>{switch(e){case Nse.Data:return t.data();case Nse.Protocol:return t.protocol();default:return t._other()}}};var j8s={};var hIi={};ne(hIi,{AsymmetricAlgorithm:()=>Z1,AsymmetricKeySource:()=>bG,HmacAlgorithm:()=>EG,WebhookHttpMethod:()=>Wnr,WebhookPayload:()=>hS,WebhookPayloadBodySort:()=>O_t,WebhookPayloadComponent:()=>h3,WebhookSignatureEncoding:()=>bDe,WebhookSignatureVerification:()=>IG,WebhookTimestampFormat:()=>Qse});var Tzl={RsaSha256:"RSA_SHA256",RsaSha384:"RSA_SHA384",RsaSha512:"RSA_SHA512",EcdsaSha256:"ECDSA_SHA256",EcdsaSha384:"ECDSA_SHA384",EcdsaSha512:"ECDSA_SHA512",Ed25519:"ED25519"},Z1={...Tzl,_visit:(e,t)=>{switch(e){case Z1.RsaSha256:return t.rsaSha256();case Z1.RsaSha384:return t.rsaSha384();case Z1.RsaSha512:return t.rsaSha512();case Z1.EcdsaSha256:return t.ecdsaSha256();case Z1.EcdsaSha384:return t.ecdsaSha384();case Z1.EcdsaSha512:return t.ecdsaSha512();case Z1.Ed25519:return t.ed25519();default:return t._other()}}};var bG={jwks:e=>({...e,type:"jwks",_visit:function(t){return bG._visit(this,t)}}),static:e=>({...e,type:"static",_visit:function(t){return bG._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"jwks":return t.jwks(e);case"static":return t.static(e);default:return t._other(e)}}};var Ozl={Sha256:"SHA256",Sha1:"SHA1",Sha384:"SHA384",Sha512:"SHA512"},EG={...Ozl,_visit:(e,t)=>{switch(e){case EG.Sha256:return t.sha256();case EG.Sha1:return t.sha1();case EG.Sha384:return t.sha384();case EG.Sha512:return t.sha512();default:return t._other()}}};var Pzl={Get:"GET",Post:"POST"},Wnr={...Pzl,_visit:(e,t)=>{switch(e){case Wnr.Get:return t.get();case Wnr.Post:return t.post();default:return t._other()}}};var hS={inlinedPayload:e=>({...e,type:"inlinedPayload",_visit:function(t){return hS._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return hS._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"inlinedPayload":return t.inlinedPayload(e);case"reference":return t.reference(e);default:return t._other(e)}}};var Dzl={Alphabetical:"ALPHABETICAL"},O_t={...Dzl,_visit:(e,t)=>e===O_t.Alphabetical?t.alphabetical():t._other()};var Rzl={Body:"BODY",Timestamp:"TIMESTAMP",NotificationUrl:"NOTIFICATION_URL",MessageId:"MESSAGE_ID"},h3={...Rzl,_visit:(e,t)=>{switch(e){case h3.Body:return t.body();case h3.Timestamp:return t.timestamp();case h3.NotificationUrl:return t.notificationUrl();case h3.MessageId:return t.messageId();default:return t._other()}}};var Fzl={Base64:"BASE64",Hex:"HEX"},bDe={...Fzl,_visit:(e,t)=>{switch(e){case bDe.Base64:return t.base64();case bDe.Hex:return t.hex();default:return t._other()}}};var IG={hmac:e=>({...e,type:"hmac",_visit:function(t){return IG._visit(this,t)}}),asymmetric:e=>({...e,type:"asymmetric",_visit:function(t){return IG._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"hmac":return t.hmac(e);case"asymmetric":return t.asymmetric(e);default:return t._other(e)}}};var kzl={UnixSeconds:"UNIX_SECONDS",UnixMillis:"UNIX_MILLIS",Iso8601:"ISO8601"},Qse={...kzl,_visit:(e,t)=>{switch(e){case Qse.UnixSeconds:return t.unixSeconds();case Qse.UnixMillis:return t.unixMillis();case Qse.Iso8601:return t.iso8601();default:return t._other()}}};var gIi={};ne(gIi,{ExampleWebSocketMessageBody:()=>i6,WebSocketMessageBody:()=>eB,WebSocketMessageOrigin:()=>$nr});var i6={inlinedBody:e=>({...e,type:"inlinedBody",_visit:function(t){return i6._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return i6._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"inlinedBody":return t.inlinedBody(e);case"reference":return t.reference(e);default:return t._other(e)}}};var eB={inlinedBody:e=>({...e,type:"inlinedBody",_visit:function(t){return eB._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return eB._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"inlinedBody":return t.inlinedBody(e);case"reference":return t.reference(e);default:return t._other(e)}}};var Nzl={Client:"client",Server:"server"},$nr={...Nzl,_visit:(e,t)=>{switch(e){case $nr.Client:return t.client();case $nr.Server:return t.server();default:return t._other()}}};var Zi={};ne(Zi,{AliasTypeDeclaration:()=>Ncr,ApiAuth:()=>Air,ApiDefinitionSource:()=>Uar,ApiDefinitionSourceId:()=>Mar,ApiVersionScheme:()=>Var,AsymmetricAlgorithm:()=>eur,AsymmetricKeySignatureVerification:()=>our,AsymmetricKeySource:()=>nur,AudienceDefinition:()=>Xnr,AudienceReference:()=>Mqe,AuthScheme:()=>hir,AuthSchemeKey:()=>Uqe,AuthSchemesRequirement:()=>gir,AuthScope:()=>yir,AutogeneratedEndpointExample:()=>Msr,Availability:()=>gH,AvailabilityStatus:()=>nir,Base64Type:()=>pcr,BaseAuthScheme:()=>g3,BasicAuthScheme:()=>Znr,BasicAuthValues:()=>zor,BearerAuthScheme:()=>eir,BearerAuthValues:()=>Vor,BigIntegerType:()=>fcr,BooleanType:()=>dcr,BytesRequest:()=>pGe,BytesResponse:()=>fGe,CasingsConfig:()=>qar,Constants:()=>Iir,ContainerType:()=>BGe,CratesPublishTarget:()=>Jar,CsharpProtobufFileOptions:()=>Zsr,CursorPagination:()=>Lsr,CustomPagination:()=>Usr,DateTimeRfc2822Type:()=>mcr,DateTimeType:()=>hcr,DateType:()=>gcr,Declaration:()=>xC,DeclaredErrorName:()=>qhe,DeclaredServiceName:()=>zsr,DeclaredTypeName:()=>ey,DirectPublish:()=>rcr,DisplayName:()=>jhe,DoubleType:()=>ycr,DoubleValidationRules:()=>Acr,Encoding:()=>wGe,EndpointId:()=>Lse,EndpointName:()=>Vsr,EndpointReference:()=>khe,EnumTypeDeclaration:()=>xGe,EnumTypeReference:()=>Eqs,EnumValue:()=>Use,EnvironmentBaseUrlId:()=>nO,EnvironmentBaseUrlWithId:()=>Ror,EnvironmentId:()=>IH,EnvironmentUrl:()=>Vhe,EnvironmentVariable:()=>A3,Environments:()=>jor,EnvironmentsConfig:()=>Mor,ErrorDeclaration:()=>Uor,ErrorDeclarationDiscriminantValue:()=>Aqs,ErrorDiscriminationByPropertyStrategy:()=>Gar,ErrorDiscriminationStrategy:()=>War,ErrorId:()=>Mhe,EscapedString:()=>bir,ExampleAliasType:()=>kur,ExampleCodeSample:()=>Wsr,ExampleCodeSampleLanguage:()=>qsr,ExampleCodeSampleSdk:()=>Gsr,ExampleContainer:()=>Mur,ExampleDatetime:()=>Nur,ExampleDatetimeRfc2822:()=>Qur,ExampleEndpointCall:()=>lGe,ExampleEndpointErrorResponse:()=>ksr,ExampleEndpointSuccessResponse:()=>Qsr,ExampleEnumType:()=>Gur,ExampleError:()=>Lor,ExampleExtraObjectProperty:()=>Wur,ExampleHeader:()=>CDe,ExampleInlinedRequestBody:()=>uGe,ExampleInlinedRequestBodyExtraProperty:()=>Dsr,ExampleInlinedRequestBodyProperty:()=>Rsr,ExampleKeyValuePair:()=>$ur,ExampleListContainer:()=>Lur,ExampleLiteralContainer:()=>jur,ExampleMapContainer:()=>Uur,ExampleNamedType:()=>Hur,ExampleNullableContainer:()=>zur,ExampleObjectProperty:()=>FGe,ExampleObjectType:()=>kGe,ExampleObjectTypeWithTypeId:()=>Kur,ExampleOptionalContainer:()=>Vur,ExamplePathParameter:()=>Ghe,ExamplePrimitive:()=>RGe,ExampleQueryParameter:()=>cGe,ExampleQueryParameterShape:()=>Psr,ExampleRequestBody:()=>Fsr,ExampleResponse:()=>jsr,ExampleServerSideEvent:()=>Nsr,ExampleSetContainer:()=>qur,ExampleSingleUnionType:()=>Jur,ExampleSingleUnionTypeProperties:()=>Yur,ExampleStyle:()=>$ar,ExampleType:()=>j_t,ExampleTypeReference:()=>Jc,ExampleTypeReferenceShape:()=>Xur,ExampleTypeShape:()=>SGe,ExampleUndiscriminatedUnionType:()=>Zur,ExampleUnionBaseProperty:()=>tlr,ExampleUnionType:()=>elr,ExampleWebSocketMessage:()=>hur,ExampleWebSocketMessageBody:()=>mur,ExampleWebSocketSession:()=>gur,ExampleWebhookCall:()=>$cr,FeatureId:()=>F_t,FernFilepath:()=>y3,FileDownloadResponse:()=>dGe,FileProperty:()=>Ksr,FilePropertyArray:()=>$sr,FilePropertySingle:()=>Hsr,FileUploadBodyProperty:()=>Ysr,FileUploadBodyPropertyEncoding:()=>Jsr,FileUploadRequest:()=>hGe,FileUploadRequestProperty:()=>Xsr,Filesystem:()=>ncr,FloatType:()=>Ecr,FloatValidationRules:()=>bcr,GenerationMetadata:()=>Kar,GithubPublish:()=>icr,GoPublishTarget:()=>Yar,GrpcTransport:()=>rar,HeaderApiVersionScheme:()=>zar,HeaderAuthScheme:()=>rir,HeaderAuthValues:()=>qor,HmacAlgorithm:()=>sur,HmacSignatureVerification:()=>lur,HttpEndpoint:()=>kar,HttpEndpointSecurityItem:()=>nar,HttpEndpointSource:()=>sar,HttpHeader:()=>bS,HttpMethod:()=>aar,HttpPath:()=>E3,HttpPathPart:()=>car,HttpRequestBody:()=>yGe,HttpRequestBodyReference:()=>AGe,HttpResponse:()=>$he,HttpResponseBody:()=>Aar,HttpService:()=>jar,InferredAuthScheme:()=>sir,InferredAuthSchemeTokenEndpoint:()=>oir,InferredAuthenticatedRequestHeader:()=>iir,InlinedRequestBody:()=>uar,InlinedRequestBodyProperty:()=>mGe,InlinedWebSocketMessageBody:()=>yur,InlinedWebSocketMessageBodyProperty:()=>Aur,InlinedWebhookPayload:()=>Ycr,InlinedWebhookPayloadProperty:()=>Jcr,IntegerType:()=>vcr,IntegerValidationRules:()=>Icr,IntermediateRepresentation:()=>bqs,InvocationSource:()=>Har,JsonEncoding:()=>Nar,JsonResponse:()=>bGe,JsonResponseBody:()=>lar,JsonResponseBodyWithProperty:()=>par,JsonStreamChunk:()=>far,JwksKeySource:()=>tur,Literal:()=>AH,LongType:()=>wcr,LongValidationRules:()=>Ccr,MapType:()=>Fur,MavenPublishTarget:()=>Xar,MultipleBaseUrlsEnvironment:()=>For,MultipleBaseUrlsEnvironments:()=>kor,MultipleEnvironmentUrlValues:()=>Gor,Name:()=>Lqe,NameAndWireValue:()=>tir,NameAndWireValueOrString:()=>Ms,NameOrString:()=>Oo,NamedType:()=>nlr,NamedTypeDefault:()=>rlr,NonStreamHttpResponseBody:()=>har,NpmPublishTarget:()=>Zar,OAuthAccessTokenRequestProperties:()=>lir,OAuthAccessTokenResponseProperties:()=>Vqe,OAuthClientCredentials:()=>fir,OAuthConfiguration:()=>dir,OAuthRefreshEndpoint:()=>uir,OAuthRefreshTokenRequestProperties:()=>cir,OAuthScheme:()=>mir,OAuthTokenEndpoint:()=>pir,OAuthValues:()=>Wor,ObjectProperty:()=>tB,ObjectPropertyAccess:()=>Nhe,ObjectTypeDeclaration:()=>Qcr,OffsetPagination:()=>yar,Package:()=>DGe,PackageNavigationConfig:()=>xur,Pagination:()=>Iar,PathPagination:()=>bar,PathParameter:()=>CG,PathParameterLocation:()=>Car,PlatformHeaders:()=>Tur,PostmanPublishTarget:()=>ecr,PrimitiveType:()=>_Ge,PrimitiveTypeV1:()=>lcr,PrimitiveTypeV2:()=>Dcr,PropertyPathItem:()=>zqe,ProtoEncoding:()=>Qar,ProtoSource:()=>Lar,ProtoSourceInfo:()=>oar,ProtobufFile:()=>gGe,ProtobufFileOptions:()=>ear,ProtobufMethodType:()=>iar,ProtobufService:()=>tar,ProtobufType:()=>ccr,PublishTarget:()=>Hhe,PublishingConfig:()=>ocr,PypiPublishTarget:()=>tcr,QueryParameter:()=>Qhe,ReadmeConfig:()=>_ur,ReadmeCustomSection:()=>Sur,RequestProperty:()=>tO,RequestPropertyValue:()=>air,ResolvedNamedType:()=>Fcr,ResolvedTypeReference:()=>kcr,ResponseError:()=>war,ResponseErrors:()=>xar,ResponseProperty:()=>X0,RetriesConfiguration:()=>_ar,RetriesDisabledSchema:()=>Sar,SafeAndUnsafeString:()=>IDe,SdkConfig:()=>Our,SdkRequest:()=>Par,SdkRequestBodyType:()=>Bar,SdkRequestShape:()=>Oar,SdkRequestWrapper:()=>Tar,ServerVariable:()=>Jqe,ServiceId:()=>mH,ServiceTypeReferenceInfo:()=>Pur,ShapeType:()=>Rcr,SingleBaseUrlEnvironment:()=>Nor,SingleBaseUrlEnvironments:()=>Qor,SingleUnionType:()=>M_t,SingleUnionTypeProperties:()=>Ucr,SingleUnionTypeProperty:()=>Lcr,Source:()=>ucr,SourceConfig:()=>Dur,SseStreamChunk:()=>dar,StaticKeySource:()=>rur,StreamParameterResponse:()=>gar,StreamingResponse:()=>EGe,StringType:()=>Scr,StringValidationRules:()=>xcr,Subpackage:()=>Rur,SubpackageId:()=>hH,SupportedSdkLanguage:()=>Whe,TextResponse:()=>IGe,TextStreamChunk:()=>mar,Transport:()=>CGe,Type:()=>qcr,TypeDeclaration:()=>Gcr,TypeId:()=>rB,TypeReference:()=>ma,Uint64Type:()=>Bcr,Uint64ValidationRules:()=>_cr,UintType:()=>Ocr,UintValidationRules:()=>Tcr,UndiscriminatedUnionMember:()=>jcr,UndiscriminatedUnionTypeDeclaration:()=>Mcr,UnionDiscriminatorContext:()=>zcr,UnionTypeDeclaration:()=>Vcr,UriPagination:()=>Ear,UserAgent:()=>Bur,UserDefinedProtobufType:()=>scr,UserSpecifiedEndpointExample:()=>Dar,UuidType:()=>Pcr,V2AuthValues:()=>Yqe,V2EndpointLocation:()=>Hor,V2EndpointLocationHttpMethod:()=>$or,V2EnvironmentValues:()=>Xqe,V2HttpEndpointCodeSample:()=>Kor,V2HttpEndpointExample:()=>k_t,V2HttpEndpointExamples:()=>Zor,V2HttpEndpointRequest:()=>Jor,V2HttpEndpointResponse:()=>Xor,V2HttpEndpointResponseBody:()=>Yor,V2HttpRequestBodies:()=>Rar,V2HttpResponses:()=>Far,V2SchemaExample:()=>R_t,V2SchemaExamples:()=>yS,V2ValueExamples:()=>vH,V2WebSocketEndpointLocation:()=>tsr,V2WebSocketMessageExample:()=>rsr,V2WebSocketSessionExample:()=>Q_t,V2WebSocketSessionExamples:()=>nsr,V2WebhookExample:()=>N_t,V2WebhookExamples:()=>esr,VariableDeclaration:()=>Wcr,VariableId:()=>vGe,WebSocketChannel:()=>wur,WebSocketChannelId:()=>Gqe,WebSocketMessage:()=>vur,WebSocketMessageBody:()=>Eur,WebSocketMessageBodyReference:()=>bur,WebSocketMessageId:()=>PGe,WebSocketMessageOrigin:()=>Iur,WebSocketName:()=>Cur,Webhook:()=>fur,WebhookGroup:()=>dur,WebhookGroupId:()=>qqe,WebhookHttpMethod:()=>Hcr,WebhookId:()=>Eir,WebhookName:()=>Kcr,WebhookPayload:()=>Zcr,WebhookPayloadBodySort:()=>aur,WebhookPayloadComponent:()=>cur,WebhookPayloadFormat:()=>uur,WebhookPayloadReference:()=>Xcr,WebhookSignatureEncoding:()=>TGe,WebhookSignatureVerification:()=>pur,WebhookTimestampConfig:()=>OGe,WebhookTimestampFormat:()=>iur,WellKnownProtobufType:()=>acr,WithContentType:()=>b3,WithDocs:()=>co,WithDocsAndAvailability:()=>Lhe,WithJsonExample:()=>yH,WithV2Examples:()=>ZA,audience:()=>vIi,auth:()=>CIi,commons:()=>wIi,constants:()=>xIi,dynamic:()=>Z0,environment:()=>NIi,errors:()=>QIi,examples:()=>jIi,generatorExec:()=>LIi,http:()=>UIi,ir:()=>zIi,proto:()=>VIi,publish:()=>qIi,types:()=>GIi,variables:()=>WIi,webhooks:()=>$Ii,websocket:()=>HIi});var vIi={};ne(vIi,{AudienceDefinition:()=>Xnr,AudienceReference:()=>Mqe});var P={};ne(P,{JsonError:()=>Nqe,ParseError:()=>Qqe,any:()=>X8s,bigint:()=>L8s,boolean:()=>Z8s,booleanLiteral:()=>J8s,date:()=>U8s,discriminant:()=>uqs,enum_:()=>Knr,getObjectLikeUtils:()=>vG,getObjectUtils:()=>EDe,getSchemaUtils:()=>bm,isProperty:()=>Mse,lazy:()=>z8s,lazyObject:()=>H8s,list:()=>Ynr,never:()=>eqs,number:()=>tqs,object:()=>Jnr,objectWithoutOptionalProperties:()=>$8s,optional:()=>AIi,property:()=>q8s,record:()=>oqs,set:()=>sqs,string:()=>rqs,stringLiteral:()=>Y8s,transform:()=>yIi,undiscriminatedUnion:()=>cqs,union:()=>pqs,unknown:()=>nqs,withParsedProperties:()=>IIi});var zu={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function kd(e,t){return`Expected ${t}. Received ${Qzl(e)}.`}function Qzl(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function gS(e){return{...e,json:M8s(e.json),parse:M8s(e.parse)}}function M8s(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
2464
2464
|
`)),{ok:!0,value:t}):n}}function Hnr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Nqe=class extends Error{errors;constructor(t){super(t.map(Hnr).join("; ")),this.errors=t,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};var Qqe=class extends Error{errors;constructor(t){super(t.map(Hnr).join("; ")),this.errors=t,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};function bm(e){return{nullable:()=>jzl(e),optional:()=>AIi(e),optionalNullable:()=>Mzl(e),transform:t=>yIi(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new Qqe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new Nqe(n.errors)}}}function jzl(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>zu.NULLABLE};return{...t,...bm(t)}}function AIi(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>zu.OPTIONAL};return{...t,...bm(t)}}function Mzl(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>zu.OPTIONAL_NULLABLE};return{...t,...bm(t)}}function yIi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...bm(r)}}function L8s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:kd(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:kd(t,"bigint")}]}:{ok:!0,value:t},getType:()=>zu.BIGINT};return{...gS(e),...bm(e)}}var Lzl=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function U8s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:kd(t,"string")}]}:Lzl.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:kd(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:kd(t,"Date object")}]},getType:()=>zu.DATE};return{...gS(e),...bm(e)}}function AS(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...gS(r),...bm(r)}}}function Knr(e){let t=new Set(e);return AS(zu.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:kd(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:kd(n,"enum")}]}:{ok:!0,value:n})()}function z8s(e){let t=bIi(e);return{...t,...bm(t)}}function bIi(e){return{parse:(t,r)=>jqe(e).parse(t,r),json:(t,r)=>jqe(e).json(t,r),getType:()=>jqe(e).getType()}}function jqe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function EIi(e){return Object.entries(e)}function P_t(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function jse(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function D_t(e){return Object.keys(e)}function V8s(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var Uzl=Object.prototype.hasOwnProperty;function vG(e){return{withParsedProperties:t=>IIi(e,t)}}function IIi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(Uzl.call(t,a)){let c=t[a];s[a]=typeof c=="function"?c(o.value):c}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!jse(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:kd(n,"object")}]};let o=new Set(Object.keys(t)),s=P_t(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...bm(r),...vG(r)}}function q8s(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Mse(e){return e.isProperty}var zzl=Object.prototype.hasOwnProperty;function Jnr(e){let t;function r(){if(t==null){t={};for(let[d,f]of EIi(e)){let m=Mse(f)?f.rawKey:d,h=Mse(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of EIi(e)){let m=Mse(f)?f.rawKey:d,h=Mse(f)?f.valueSchema:f;Vzl(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function c(){return i==null&&a(),i}function u(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>Mse(f)?f.rawKey:d),_getParsedProperties:()=>D_t(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return G8s({value:d,requiredKeys:a(),requiredKeysSet:u(),getProperty:h=>{let A=r()[h];if(A!=null)return{transformedKey:A.parsedKey,transform:b=>{let v=[...m,h];return A.valueSchema.parse(b,{...f,breadcrumbsPrefix:v})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return G8s({value:d,requiredKeys:c(),requiredKeysSet:l(),getProperty:h=>{let A=e[h];if(A!=null)return Mse(A)?{transformedKey:A.rawKey,transform:b=>{let v=[...m,h];return A.valueSchema.json(b,{...f,breadcrumbsPrefix:v})}}:{transformedKey:h,transform:b=>{let v=[...m,h];return A.json(b,{...f,breadcrumbsPrefix:v})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>zu.OBJECT};return{...gS(p),...bm(p),...vG(p),...EDe(p)}}function G8s({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!jse(e))return{ok:!1,errors:[{path:s,message:kd(e,"object")}]};let a=t.length,c=[],u={};for(let l in e){if(!zzl.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?u[d.transformedKey]=f.value:(u[l]=p,c.push(...f.errors))}else switch(i){case"fail":c.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=p;break}}if(a>0)for(let l of t)l in e||c.push({path:s,message:`Missing required key "${l}"`});return c.length===0||o?{ok:!0,value:u}:{ok:!1,errors:c}}function EDe(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>W8s({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>W8s({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>zu.OBJECT};return{...r,...bm(r),...vG(r),...EDe(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))t.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))r.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},getType:()=>zu.OBJECT};return{...n,...bm(n),...vG(n),...EDe(n)}}}}function W8s({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!jse(t))return{ok:!1,errors:[{path:i,message:kd(t,"object")}]};let o=new Set(e),[s,a]=V8s(D_t(t),l=>o.has(l)),c=r(P_t(t,a)),u=n(P_t(t,s));return c.ok&&u.ok?{ok:!0,value:{...c.value,...u.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...u.ok?[]:u.errors]}}function Vzl(e){return!qzl(e)}function qzl(e){switch(e.getType()){case zu.ANY:case zu.UNKNOWN:case zu.OPTIONAL:case zu.OPTIONAL_NULLABLE:return!0;default:return!1}}function $8s(e){return Jnr(e)}function H8s(e){let t={...bIi(e),_getRawProperties:()=>jqe(e)._getRawProperties(),_getParsedProperties:()=>jqe(e)._getParsedProperties()};return{...t,...bm(t),...vG(t),...EDe(t)}}function Ynr(e){let t={parse:(r,n)=>K8s(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>K8s(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>zu.LIST};return{...gS(t),...bm(t)}}function K8s(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:kd(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function J8s(e){return AS(zu.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:kd(r,`${e.toString()}`)}]})()}function Y8s(e){return AS(zu.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:kd(r,`"${e}"`)}]})()}var X8s=AS(zu.ANY,e=>({ok:!0,value:e}));var Z8s=AS(zu.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kd(e,"boolean")}]});var eqs=AS(zu.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var tqs=AS(zu.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kd(e,"number")}]});var rqs=AS(zu.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kd(e,"string")}]});var nqs=AS(zu.UNKNOWN,e=>({ok:!0,value:e}));var Gzl=Object.prototype.hasOwnProperty;function oqs(e,t){let r={parse:(n,i)=>iqs({value:n,isKeyNumeric:e.getType()===zu.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>iqs({value:n,isKeyNumeric:e.getType()===zu.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>zu.RECORD};return{...gS(r),...bm(r)}}function iqs({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!jse(e))return{ok:!1,errors:[{path:i,message:kd(e,"object")}]};let o={},s=[];for(let a in e){if(!Gzl.call(e,a))continue;let c=e[a];if(c===void 0)continue;let u=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(u=d)}let l=r(u),p=n(c,u);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function sqs(e){let t=Ynr(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:kd(n,"Set")}]},getType:()=>zu.SET};return{...gS(r),...bm(r)}}function cqs(e){let t={parse:(r,n)=>aqs((i,o)=>i.parse(r,o),e,n),json:(r,n)=>aqs((i,o)=>i.json(r,o),e,n),getType:()=>zu.UNDISCRIMINATED_UNION};return{...gS(t),...bm(t)}}function aqs(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function uqs(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var Wzl=Object.prototype.hasOwnProperty;function pqs(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=Knr(D_t(t)),o={parse:(s,a)=>lqs({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.parse(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>lqs({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.json(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>zu.UNION};return{...gS(o),...bm(o),...vG(o)}}function lqs({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!jse(e))return{ok:!1,errors:[{path:a,message:kd(e,"object")}]};let c=e[t],u={};for(let f in e)Wzl.call(e,f)&&f!==t&&(u[f]=e[f]);if(c==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(c);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...u}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(u,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var Xnr=P.string();var Mqe=P.string();var CIi={};ne(CIi,{ApiAuth:()=>Air,AuthScheme:()=>hir,AuthSchemeKey:()=>Uqe,AuthSchemesRequirement:()=>gir,AuthScope:()=>yir,BaseAuthScheme:()=>g3,BasicAuthScheme:()=>Znr,BearerAuthScheme:()=>eir,EnvironmentVariable:()=>A3,HeaderAuthScheme:()=>rir,InferredAuthScheme:()=>sir,InferredAuthSchemeTokenEndpoint:()=>oir,InferredAuthenticatedRequestHeader:()=>iir,OAuthAccessTokenRequestProperties:()=>lir,OAuthAccessTokenResponseProperties:()=>Vqe,OAuthClientCredentials:()=>fir,OAuthConfiguration:()=>dir,OAuthRefreshEndpoint:()=>uir,OAuthRefreshTokenRequestProperties:()=>cir,OAuthScheme:()=>mir,OAuthTokenEndpoint:()=>pir});var co=P.objectWithoutOptionalProperties({docs:P.string().optional()});var IDe=P.objectWithoutOptionalProperties({unsafeName:P.string(),safeName:P.string()});var Lqe=P.objectWithoutOptionalProperties({originalName:P.string(),camelCase:IDe,pascalCase:IDe,snakeCase:IDe,screamingSnakeCase:IDe});var Oo=P.undiscriminatedUnion([P.string(),Lqe]);var Uqe=P.string();var g3=P.objectWithoutOptionalProperties({key:Uqe}).extend(co);var A3=P.string();var Znr=P.objectWithoutOptionalProperties({username:Oo,usernameEnvVar:A3.optional(),usernameOmit:P.boolean().optional(),usernamePlaceholder:P.string().optional(),password:Oo,passwordEnvVar:A3.optional(),passwordOmit:P.boolean().optional(),passwordPlaceholder:P.string().optional()}).extend(g3);var eir=P.objectWithoutOptionalProperties({token:Oo,tokenEnvVar:A3.optional(),tokenPlaceholder:P.string().optional()}).extend(g3);var tir=P.objectWithoutOptionalProperties({wireValue:P.string(),name:Oo});var Ms=P.undiscriminatedUnion([P.string(),tir]);var rir=P.objectWithoutOptionalProperties({name:Ms,valueType:P.lazy(()=>ma),prefix:P.string().optional(),headerEnvVar:A3.optional(),headerPlaceholder:P.string().optional()}).extend(g3);var Lse=P.string();var mH=P.string();var hH=P.string();var khe=P.objectWithoutOptionalProperties({endpointId:Lse,serviceId:mH,subpackageId:hH.optional()});var nir=P.enum_(["IN_DEVELOPMENT","PRE_RELEASE","GENERAL_AVAILABILITY","DEPRECATED"]);var gH=P.objectWithoutOptionalProperties({status:nir,message:P.string().optional()});var xC=P.objectWithoutOptionalProperties({availability:gH.optional()}).extend(co);var R_t=P.unknown();var yS=P.objectWithoutOptionalProperties({userSpecifiedExamples:P.record(P.string(),R_t),autogeneratedExamples:P.record(P.string(),R_t)});var Nhe=P.enum_(["READ_ONLY","WRITE_ONLY"]);var tB=P.objectWithoutOptionalProperties({name:Ms,valueType:P.lazy(()=>ma),propertyAccess:Nhe.optional(),v2Examples:yS.optional()}).extend(xC);var zqe=P.objectWithoutOptionalProperties({name:Oo,type:P.lazy(()=>ma)});var X0=P.objectWithoutOptionalProperties({propertyPath:P.list(zqe).optional(),property:tB});var iir=P.objectWithoutOptionalProperties({responseProperty:X0,headerName:P.string(),valuePrefix:P.string().optional()});var oir=P.objectWithoutOptionalProperties({endpoint:khe,expiryProperty:X0.optional(),authenticatedRequestHeaders:P.list(iir)});var sir=P.objectWithoutOptionalProperties({tokenEndpoint:oir}).extend(g3);var Vqe=P.objectWithoutOptionalProperties({accessToken:X0,expiresIn:X0.optional(),refreshToken:X0.optional()});var AH=P.union("type",{string:P.object({string:P.string()}),boolean:P.object({boolean:P.boolean()})}).transform({transform:e=>{switch(e.type){case"string":return tv.string(e.string);case"boolean":return tv.boolean(e.boolean);default:return e}},untransform:({_visit:e,...t})=>t});var Qhe=P.objectWithoutOptionalProperties({name:Ms,valueType:P.lazy(()=>ma),allowMultiple:P.boolean(),clientDefault:AH.optional(),v2Examples:yS.optional(),explode:P.boolean().optional()}).extend(xC);var air=P.union("type",{query:Qhe,body:tB}).transform({transform:e=>{switch(e.type){case"query":return Y1.query(e);case"body":return Y1.body(e);default:return e}},untransform:({_visit:e,...t})=>t});var tO=P.objectWithoutOptionalProperties({propertyPath:P.list(zqe).optional(),property:air});var cir=P.objectWithoutOptionalProperties({refreshToken:tO});var uir=P.objectWithoutOptionalProperties({endpointReference:khe,requestProperties:cir,responseProperties:Vqe});var lir=P.objectWithoutOptionalProperties({clientId:tO,clientSecret:tO,scopes:tO.optional(),customProperties:P.list(tO).optional()});var pir=P.objectWithoutOptionalProperties({endpointReference:khe,requestProperties:lir,responseProperties:Vqe});var fir=P.objectWithoutOptionalProperties({clientIdEnvVar:A3.optional(),clientSecretEnvVar:A3.optional(),tokenPrefix:P.string().optional(),tokenHeader:P.string().optional(),scopes:P.list(P.string()).optional(),tokenEndpoint:pir,refreshEndpoint:uir.optional()});var dir=P.union("type",{clientCredentials:fir}).transform({transform:e=>e.type==="clientCredentials"?lH.clientCredentials(e):e,untransform:({_visit:e,...t})=>t});var mir=P.objectWithoutOptionalProperties({configuration:dir}).extend(g3);var hir=P.union(P.discriminant("type","_type"),{bearer:eir,basic:Znr,header:rir,oauth:mir,inferred:sir}).transform({transform:e=>{switch(e.type){case"bearer":return Gp.bearer(e);case"basic":return Gp.basic(e);case"header":return Gp.header(e);case"oauth":return Gp.oauth(e);case"inferred":return Gp.inferred(e);default:return e}},untransform:({_visit:e,...t})=>t});var gir=P.enum_(["ALL","ANY","ENDPOINT_SECURITY"]);var Air=P.objectWithoutOptionalProperties({requirement:gir,schemes:P.list(hir)}).extend(co);var yir=P.string();var wIi={};ne(wIi,{Availability:()=>gH,AvailabilityStatus:()=>nir,Declaration:()=>xC,DisplayName:()=>jhe,EndpointId:()=>Lse,EndpointReference:()=>khe,ErrorId:()=>Mhe,EscapedString:()=>bir,FeatureId:()=>F_t,FernFilepath:()=>y3,Name:()=>Lqe,NameAndWireValue:()=>tir,NameAndWireValueOrString:()=>Ms,NameOrString:()=>Oo,SafeAndUnsafeString:()=>IDe,ServiceId:()=>mH,SubpackageId:()=>hH,TypeId:()=>rB,WebSocketChannelId:()=>Gqe,WebhookGroupId:()=>qqe,WebhookId:()=>Eir,WithContentType:()=>b3,WithDocs:()=>co,WithDocsAndAvailability:()=>Lhe,WithJsonExample:()=>yH});var jhe=P.string();var Mhe=P.string();var bir=P.objectWithoutOptionalProperties({original:P.string()});var F_t=P.string();var y3=P.objectWithoutOptionalProperties({allParts:P.list(Oo),packagePath:P.list(Oo),file:Oo.optional()});var rB=P.string();var qqe=P.string();var Eir=P.string();var Gqe=P.string();var b3=P.objectWithoutOptionalProperties({contentType:P.string().optional()});var Lhe=P.objectWithoutOptionalProperties({availability:gH.optional()}).extend(co);var yH=P.objectWithoutOptionalProperties({jsonExample:P.unknown()});var xIi={};ne(xIi,{Constants:()=>Iir});var Iir=P.objectWithoutOptionalProperties({errorInstanceIdKey:Ms});var Z0={};ne(Z0,{AliasType:()=>sor,Auth:()=>Bir,AuthValues:()=>Fir,BasicAuth:()=>vir,BasicAuthValues:()=>Tir,BearerAuth:()=>Cir,BearerAuthValues:()=>Oir,BodyRequest:()=>Qir,CratesPublishInfo:()=>oor,Declaration:()=>rO,DiscriminatedUnionType:()=>por,DynamicIntermediateRepresentation:()=>Bor,Endpoint:()=>Yir,EndpointExample:()=>zir,EndpointId:()=>kir,EndpointLocation:()=>Hqe,EndpointSnippetRequest:()=>Uir,EndpointSnippetResponse:()=>mqs,EnumType:()=>dor,EnvironmentBaseUrlId:()=>Uhe,EnvironmentBaseUrlWithId:()=>Xir,EnvironmentId:()=>EH,EnvironmentUrl:()=>zhe,EnvironmentValues:()=>Lir,Environments:()=>nor,EnvironmentsConfig:()=>ior,ErrorSeverity:()=>Tor,Error_:()=>Oor,FernFilepath:()=>Nir,FileUploadRequestBody:()=>qir,FileUploadRequestBodyProperty:()=>Vir,GeneratorConfig:()=>_or,GeneratorOutputConfig:()=>Sor,GoPublishInfo:()=>yor,HeaderAuth:()=>xir,HeaderAuthValues:()=>Pir,HttpMethod:()=>jir,InferredAuth:()=>Sir,InferredAuthValues:()=>Dir,InlinedRequest:()=>Hir,InlinedRequestBody:()=>Wir,InlinedRequestMetadata:()=>$ir,LiteralType:()=>Por,MapType:()=>hqs,MavenPublishInfo:()=>bor,MultipleBaseUrlsEnvironment:()=>Zir,MultipleBaseUrlsEnvironments:()=>eor,MultipleEnvironmentUrlValues:()=>Mir,Name:()=>Hg,NameAndWireValue:()=>Hw,NameAndWireValueOrString:()=>fqs,NameOrString:()=>dqs,NamedParameter:()=>CA,NamedType:()=>gor,NpmPublishInfo:()=>Eor,NugetPublishInfo:()=>Ior,OAuth:()=>_ir,OAuthValues:()=>Rir,ObjectPropertyAccess:()=>wir,ObjectType:()=>mor,PrimitiveTypeV1:()=>Dor,PublishInfo:()=>xor,PypiPublishInfo:()=>vor,ReferencedRequestBody:()=>Gir,ReferencedRequestBodyType:()=>$qe,Request:()=>Kir,Response:()=>Jir,RubyGemsPublishInfo:()=>Cor,SafeAndUnsafeString:()=>vDe,SingleBaseUrlEnvironment:()=>tor,SingleBaseUrlEnvironments:()=>ror,SingleDiscriminatedUnionType:()=>lor,SingleDiscriminatedUnionTypeNoProperties:()=>aor,SingleDiscriminatedUnionTypeObject:()=>cor,SingleDiscriminatedUnionTypeSingleProperty:()=>uor,SwiftPublishInfo:()=>wor,TypeId:()=>bH,TypeReference:()=>gqs,UndiscriminatedUnionType:()=>hor,Values:()=>Kqe,VariableDeclaration:()=>Aor,WithDocs:()=>Wqe,auth:()=>SIi,commons:()=>_Ii,declaration:()=>BIi,endpoints:()=>TIi,environment:()=>OIi,http:()=>PIi,ir:()=>DIi,snippets:()=>RIi,types:()=>FIi,variables:()=>kIi});var SIi={};ne(SIi,{Auth:()=>Bir,AuthValues:()=>Fir,BasicAuth:()=>vir,BasicAuthValues:()=>Tir,BearerAuth:()=>Cir,BearerAuthValues:()=>Oir,HeaderAuth:()=>xir,HeaderAuthValues:()=>Pir,InferredAuth:()=>Sir,InferredAuthValues:()=>Dir,OAuth:()=>_ir,OAuthValues:()=>Rir});var vDe=P.objectWithoutOptionalProperties({unsafeName:P.string(),safeName:P.string()});var Hg=P.objectWithoutOptionalProperties({originalName:P.string(),camelCase:vDe,pascalCase:vDe,snakeCase:vDe,screamingSnakeCase:vDe});var vir=P.objectWithoutOptionalProperties({username:Hg,usernameOmit:P.boolean().optional(),password:Hg,passwordOmit:P.boolean().optional()});var Cir=P.objectWithoutOptionalProperties({token:Hg});var Hw=P.objectWithoutOptionalProperties({wireValue:P.string(),name:Hg});var wir=P.enum_(["READ_ONLY","WRITE_ONLY"]);var CA=P.objectWithoutOptionalProperties({name:Hw,typeReference:P.lazy(()=>Z0.TypeReference),propertyAccess:wir.optional(),variable:P.string().optional()});var xir=P.objectWithoutOptionalProperties({header:CA});var Sir=P.objectWithoutOptionalProperties({parameters:P.list(CA).optional()});var _ir=P.objectWithoutOptionalProperties({clientId:Hg,clientSecret:Hg});var Bir=P.union("type",{basic:vir,bearer:Cir,header:xir,oauth:_ir,inferred:Sir}).transform({transform:e=>{switch(e.type){case"basic":return $t.Auth.basic(e);case"bearer":return $t.Auth.bearer(e);case"header":return $t.Auth.header(e);case"oauth":return $t.Auth.oauth(e);case"inferred":return $t.Auth.inferred(e);default:return e}},untransform:({_visit:e,...t})=>t});var Tir=P.objectWithoutOptionalProperties({username:P.string(),password:P.string()});var Oir=P.objectWithoutOptionalProperties({token:P.string()});var Pir=P.objectWithoutOptionalProperties({value:P.unknown()});var Dir=P.objectWithoutOptionalProperties({values:P.record(P.string(),P.unknown()).optional()});var Rir=P.objectWithoutOptionalProperties({clientId:P.string(),clientSecret:P.string()});var Fir=P.union("type",{basic:Tir,bearer:Oir,header:Pir,oauth:Rir,inferred:Dir}).transform({transform:e=>{switch(e.type){case"basic":return $t.AuthValues.basic(e);case"bearer":return $t.AuthValues.bearer(e);case"header":return $t.AuthValues.header(e);case"oauth":return $t.AuthValues.oauth(e);case"inferred":return $t.AuthValues.inferred(e);default:return e}},untransform:({_visit:e,...t})=>t});var _Ii={};ne(_Ii,{EndpointId:()=>kir,FernFilepath:()=>Nir,Name:()=>Hg,NameAndWireValue:()=>Hw,NameAndWireValueOrString:()=>fqs,NameOrString:()=>dqs,SafeAndUnsafeString:()=>vDe,TypeId:()=>bH,WithDocs:()=>Wqe});var kir=P.string();var Nir=P.objectWithoutOptionalProperties({allParts:P.list(Hg),packagePath:P.list(Hg),file:Hg.optional()});var fqs=P.undiscriminatedUnion([P.string(),Hw]);var dqs=P.undiscriminatedUnion([P.string(),Hg]);var bH=P.string();var Wqe=P.objectWithoutOptionalProperties({docs:P.string().optional()});var BIi={};ne(BIi,{Declaration:()=>rO});var rO=P.objectWithoutOptionalProperties({fernFilepath:Nir,name:Hg});var TIi={};ne(TIi,{BodyRequest:()=>Qir,Endpoint:()=>Yir,EndpointExample:()=>zir,EndpointLocation:()=>Hqe,FileUploadRequestBody:()=>qir,FileUploadRequestBodyProperty:()=>Vir,InlinedRequest:()=>Hir,InlinedRequestBody:()=>Wir,InlinedRequestMetadata:()=>$ir,ReferencedRequestBody:()=>Gir,ReferencedRequestBodyType:()=>$qe,Request:()=>Kir,Response:()=>Jir});var $qe=P.union("type",{bytes:P.object({}),typeReference:P.object({value:P.lazy(()=>Z0.TypeReference)})}).transform({transform:e=>{switch(e.type){case"bytes":return $t.ReferencedRequestBodyType.bytes();case"typeReference":return $t.ReferencedRequestBodyType.typeReference(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Qir=P.objectWithoutOptionalProperties({pathParameters:P.list(CA).optional(),body:$qe.optional()});var jir=P.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD"]);var Hqe=P.objectWithoutOptionalProperties({method:jir,path:P.string()});var EH=P.string();var Uhe=P.string();var zhe=P.string();var Mir=P.record(Uhe,zhe);var Lir=P.undiscriminatedUnion([EH,Mir]);var Kqe=P.record(P.string(),P.unknown());var Uir=P.objectWithoutOptionalProperties({endpoint:Hqe,baseUrl:P.property("baseURL",P.string().optional()),environment:Lir.optional(),auth:Fir.optional(),pathParameters:Kqe.optional(),queryParameters:Kqe.optional(),headers:Kqe.optional(),requestBody:P.unknown().optional()});var zir=P.objectWithoutOptionalProperties({id:P.string(),name:P.string().optional()}).extend(Uir);var Vir=P.union("type",{file:Hw,fileArray:Hw,bodyProperty:CA}).transform({transform:e=>{switch(e.type){case"file":return $t.FileUploadRequestBodyProperty.file(e);case"fileArray":return $t.FileUploadRequestBodyProperty.fileArray(e);case"bodyProperty":return $t.FileUploadRequestBodyProperty.bodyProperty(e);default:return e}},untransform:({_visit:e,...t})=>t});var qir=P.objectWithoutOptionalProperties({properties:P.list(Vir)});var Gir=P.objectWithoutOptionalProperties({bodyKey:Hg,bodyType:$qe});var Wir=P.union("type",{properties:P.object({value:P.list(CA)}),referenced:Gir,fileUpload:qir}).transform({transform:e=>{switch(e.type){case"properties":return $t.InlinedRequestBody.properties(e.value);case"referenced":return $t.InlinedRequestBody.referenced(e);case"fileUpload":return $t.InlinedRequestBody.fileUpload(e);default:return e}},untransform:({_visit:e,...t})=>t});var $ir=P.objectWithoutOptionalProperties({includePathParameters:P.boolean(),onlyPathParameters:P.boolean()});var Hir=P.objectWithoutOptionalProperties({declaration:rO,pathParameters:P.list(CA).optional(),queryParameters:P.list(CA).optional(),headers:P.list(CA).optional(),body:Wir.optional(),metadata:$ir.optional()});var Kir=P.union("type",{body:Qir,inlined:Hir}).transform({transform:e=>{switch(e.type){case"body":return $t.Request.body(e);case"inlined":return $t.Request.inlined(e);default:return e}},untransform:({_visit:e,...t})=>t});var Jir=P.union("type",{json:P.object({}),streaming:P.object({}),streamParameter:P.object({}),fileDownload:P.object({}),text:P.object({}),bytes:P.object({})}).transform({transform:e=>{switch(e.type){case"json":return $t.Response.json();case"streaming":return $t.Response.streaming();case"streamParameter":return $t.Response.streamParameter();case"fileDownload":return $t.Response.fileDownload();case"text":return $t.Response.text();case"bytes":return $t.Response.bytes();default:return e}},untransform:({_visit:e,...t})=>t});var Yir=P.objectWithoutOptionalProperties({auth:Bir.optional(),declaration:rO,location:Hqe,request:Kir,response:Jir,examples:P.list(zir).optional()});var OIi={};ne(OIi,{EnvironmentBaseUrlId:()=>Uhe,EnvironmentBaseUrlWithId:()=>Xir,EnvironmentId:()=>EH,EnvironmentUrl:()=>zhe,EnvironmentValues:()=>Lir,Environments:()=>nor,EnvironmentsConfig:()=>ior,MultipleBaseUrlsEnvironment:()=>Zir,MultipleBaseUrlsEnvironments:()=>eor,MultipleEnvironmentUrlValues:()=>Mir,SingleBaseUrlEnvironment:()=>tor,SingleBaseUrlEnvironments:()=>ror});var Xir=P.objectWithoutOptionalProperties({id:Uhe,name:Hg});var Zir=P.objectWithoutOptionalProperties({id:EH,name:Hg,urls:P.record(Uhe,zhe)}).extend(Wqe);var eor=P.objectWithoutOptionalProperties({baseUrls:P.list(Xir),environments:P.list(Zir)});var tor=P.objectWithoutOptionalProperties({id:EH,name:Hg,url:zhe}).extend(Wqe);var ror=P.objectWithoutOptionalProperties({environments:P.list(tor)});var nor=P.union("type",{singleBaseUrl:ror,multipleBaseUrls:eor}).transform({transform:e=>{switch(e.type){case"singleBaseUrl":return $t.Environments.singleBaseUrl(e);case"multipleBaseUrls":return $t.Environments.multipleBaseUrls(e);default:return e}},untransform:({_visit:e,...t})=>t});var ior=P.objectWithoutOptionalProperties({defaultEnvironment:EH.optional(),environments:nor});var PIi={};ne(PIi,{HttpMethod:()=>jir});var DIi={};ne(DIi,{CratesPublishInfo:()=>oor,DynamicIntermediateRepresentation:()=>Bor,GeneratorConfig:()=>_or,GeneratorOutputConfig:()=>Sor,GoPublishInfo:()=>yor,MavenPublishInfo:()=>bor,NpmPublishInfo:()=>Eor,NugetPublishInfo:()=>Ior,PublishInfo:()=>xor,PypiPublishInfo:()=>vor,RubyGemsPublishInfo:()=>Cor,SwiftPublishInfo:()=>wor});var oor=P.objectWithoutOptionalProperties({version:P.string(),packageName:P.string(),repoUrl:P.string().optional()});var sor=P.objectWithoutOptionalProperties({declaration:rO,typeReference:P.lazy(()=>Z0.TypeReference)});var aor=P.objectWithoutOptionalProperties({discriminantValue:Hw,properties:P.list(CA).optional()});var cor=P.objectWithoutOptionalProperties({typeId:bH,discriminantValue:Hw,properties:P.list(CA)});var uor=P.objectWithoutOptionalProperties({typeReference:P.lazy(()=>Z0.TypeReference),discriminantValue:Hw,properties:P.list(CA).optional()});var lor=P.union("type",{samePropertiesAsObject:cor,singleProperty:uor,noProperties:aor}).transform({transform:e=>{switch(e.type){case"samePropertiesAsObject":return $t.SingleDiscriminatedUnionType.samePropertiesAsObject(e);case"singleProperty":return $t.SingleDiscriminatedUnionType.singleProperty(e);case"noProperties":return $t.SingleDiscriminatedUnionType.noProperties(e);default:return e}},untransform:({_visit:e,...t})=>t});var por=P.objectWithoutOptionalProperties({declaration:rO,discriminant:Hw,types:P.record(P.string(),lor)});var dor=P.objectWithoutOptionalProperties({declaration:rO,values:P.list(Hw)});var mor=P.objectWithoutOptionalProperties({declaration:rO,properties:P.list(CA),extends:P.list(bH).optional(),additionalProperties:P.boolean().optional()});var hor=P.objectWithoutOptionalProperties({declaration:rO,types:P.list(P.lazy(()=>Z0.TypeReference))});var gor=P.union("type",{alias:sor,enum:dor,object:mor,discriminatedUnion:por,undiscriminatedUnion:hor}).transform({transform:e=>{switch(e.type){case"alias":return $t.NamedType.alias(e);case"enum":return $t.NamedType.enum(e);case"object":return $t.NamedType.object(e);case"discriminatedUnion":return $t.NamedType.discriminatedUnion(e);case"undiscriminatedUnion":return $t.NamedType.undiscriminatedUnion(e);default:return e}},untransform:({_visit:e,...t})=>t});var Aor=P.objectWithoutOptionalProperties({id:P.string(),name:Lqe,typeReference:P.lazy(()=>Z0.TypeReference)});var yor=P.objectWithoutOptionalProperties({version:P.string(),repoUrl:P.string()});var bor=P.objectWithoutOptionalProperties({version:P.string(),coordinate:P.string(),repoUrl:P.string().optional()});var Eor=P.objectWithoutOptionalProperties({version:P.string(),packageName:P.string(),repoUrl:P.string().optional()});var Ior=P.objectWithoutOptionalProperties({version:P.string(),packageName:P.string(),repoUrl:P.string().optional()});var vor=P.objectWithoutOptionalProperties({version:P.string(),packageName:P.string(),repoUrl:P.string().optional()});var Cor=P.objectWithoutOptionalProperties({version:P.string(),packageName:P.string(),repoUrl:P.string().optional()});var wor=P.objectWithoutOptionalProperties({version:P.string(),repoUrl:P.string()});var xor=P.union("type",{go:yor,swift:wor,maven:bor,npm:Eor,nuget:Ior,pypi:vor,rubygems:Cor,crates:oor}).transform({transform:e=>{switch(e.type){case"go":return $t.PublishInfo.go(e);case"swift":return $t.PublishInfo.swift(e);case"maven":return $t.PublishInfo.maven(e);case"npm":return $t.PublishInfo.npm(e);case"nuget":return $t.PublishInfo.nuget(e);case"pypi":return $t.PublishInfo.pypi(e);case"rubygems":return $t.PublishInfo.rubygems(e);case"crates":return $t.PublishInfo.crates(e);default:return e}},untransform:({_visit:e,...t})=>t});var Sor=P.union("type",{publish:P.object({value:xor}),local:P.object({})}).transform({transform:e=>{switch(e.type){case"publish":return $t.GeneratorOutputConfig.publish(e.value);case"local":return $t.GeneratorOutputConfig.local();default:return e}},untransform:({_visit:e,...t})=>t});var _or=P.objectWithoutOptionalProperties({apiName:P.string(),organization:P.string(),customConfig:P.unknown(),outputConfig:Sor});var Bor=P.objectWithoutOptionalProperties({version:P.stringLiteral("1.0.0"),types:P.record(bH,gor),endpoints:P.record(kir,Yir),environments:ior.optional(),headers:P.list(CA).optional(),pathParameters:P.list(CA).optional(),variables:P.list(Aor).optional(),generatorConfig:_or.optional()});var RIi={};ne(RIi,{EndpointSnippetRequest:()=>Uir,EndpointSnippetResponse:()=>mqs,ErrorSeverity:()=>Tor,Error_:()=>Oor,Values:()=>Kqe});var Tor=P.enum_(["CRITICAL","WARNING"]);var Oor=P.objectWithoutOptionalProperties({severity:Tor,message:P.string()});var mqs=P.objectWithoutOptionalProperties({snippet:P.string(),errors:P.list(Oor).optional()});var FIi={};ne(FIi,{AliasType:()=>sor,DiscriminatedUnionType:()=>por,EnumType:()=>dor,LiteralType:()=>Por,MapType:()=>hqs,NamedParameter:()=>CA,NamedType:()=>gor,ObjectPropertyAccess:()=>wir,ObjectType:()=>mor,PrimitiveTypeV1:()=>Dor,SingleDiscriminatedUnionType:()=>lor,SingleDiscriminatedUnionTypeNoProperties:()=>aor,SingleDiscriminatedUnionTypeObject:()=>cor,SingleDiscriminatedUnionTypeSingleProperty:()=>uor,TypeReference:()=>gqs,UndiscriminatedUnionType:()=>hor});var Por=P.union("type",{boolean:P.object({value:P.boolean()}),string:P.object({value:P.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return $t.LiteralType.boolean(e.value);case"string":return $t.LiteralType.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var hqs=P.objectWithoutOptionalProperties({key:P.lazy(()=>Z0.TypeReference),value:P.lazy(()=>Z0.TypeReference)});var Dor=P.enum_(["INTEGER","LONG","UINT","UINT_64","FLOAT","DOUBLE","BOOLEAN","STRING","DATE","DATE_TIME","DATE_TIME_RFC_2822","UUID","BASE_64","BIG_INTEGER"]);var gqs=P.union("type",{list:P.object({value:P.lazy(()=>Z0.TypeReference)}),literal:P.object({value:Por}),map:P.lazyObject(()=>Z0.MapType),named:P.object({value:bH}),nullable:P.object({value:P.lazy(()=>Z0.TypeReference)}),optional:P.object({value:P.lazy(()=>Z0.TypeReference)}),primitive:P.object({value:Dor}),set:P.object({value:P.lazy(()=>Z0.TypeReference)}),unknown:P.object({})}).transform({transform:e=>{switch(e.type){case"list":return $t.TypeReference.list(e.value);case"literal":return $t.TypeReference.literal(e.value);case"map":return $t.TypeReference.map(e);case"named":return $t.TypeReference.named(e.value);case"nullable":return $t.TypeReference.nullable(e.value);case"optional":return $t.TypeReference.optional(e.value);case"primitive":return $t.TypeReference.primitive(e.value);case"set":return $t.TypeReference.set(e.value);case"unknown":return $t.TypeReference.unknown();default:return e}},untransform:({_visit:e,...t})=>t});var kIi={};ne(kIi,{VariableDeclaration:()=>Aor});var NIi={};ne(NIi,{EnvironmentBaseUrlId:()=>nO,EnvironmentBaseUrlWithId:()=>Ror,EnvironmentId:()=>IH,EnvironmentUrl:()=>Vhe,Environments:()=>jor,EnvironmentsConfig:()=>Mor,MultipleBaseUrlsEnvironment:()=>For,MultipleBaseUrlsEnvironments:()=>kor,ServerVariable:()=>Jqe,SingleBaseUrlEnvironment:()=>Nor,SingleBaseUrlEnvironments:()=>Qor});var nO=P.string();var Ror=P.objectWithoutOptionalProperties({id:nO,name:Oo});var IH=P.string();var Vhe=P.string();var Jqe=P.objectWithoutOptionalProperties({id:P.string(),name:Oo,default:P.string().optional(),values:P.list(P.string()).optional()});var For=P.objectWithoutOptionalProperties({id:IH,name:Oo,urls:P.record(nO,Vhe),audiences:P.list(P.string()).optional(),defaultUrls:P.record(nO,P.string()).optional(),urlTemplates:P.record(nO,P.string()).optional(),urlVariables:P.record(nO,P.list(Jqe)).optional()}).extend(co);var kor=P.objectWithoutOptionalProperties({baseUrls:P.list(Ror),environments:P.list(For)});var Nor=P.objectWithoutOptionalProperties({id:IH,name:Oo,url:Vhe,audiences:P.list(P.string()).optional(),defaultUrl:P.string().optional(),urlTemplate:P.string().optional(),urlVariables:P.list(Jqe).optional()}).extend(co);var Qor=P.objectWithoutOptionalProperties({environments:P.list(Nor)});var jor=P.union("type",{singleBaseUrl:Qor,multipleBaseUrls:kor}).transform({transform:e=>{switch(e.type){case"singleBaseUrl":return J0.singleBaseUrl(e);case"multipleBaseUrls":return J0.multipleBaseUrls(e);default:return e}},untransform:({_visit:e,...t})=>t});var Mor=P.objectWithoutOptionalProperties({defaultEnvironment:IH.optional(),environments:jor});var QIi={};ne(QIi,{DeclaredErrorName:()=>qhe,ErrorDeclaration:()=>Uor,ErrorDeclarationDiscriminantValue:()=>Aqs,ExampleError:()=>Lor});var qhe=P.objectWithoutOptionalProperties({errorId:Mhe,fernFilepath:y3,name:Oo});var bS=P.objectWithoutOptionalProperties({name:Ms,valueType:P.lazy(()=>ma),env:P.string().optional(),clientDefault:AH.optional(),v2Examples:yS.optional()}).extend(xC);var Lor=P.objectWithoutOptionalProperties({name:Oo.optional(),shape:P.lazyObject(()=>Jc)}).extend(yH).extend(co);var Uor=P.objectWithoutOptionalProperties({name:qhe,displayName:P.string().optional(),discriminantValue:Ms,type:P.lazy(()=>ma).optional(),statusCode:P.number(),isWildcardStatusCode:P.boolean().optional(),examples:P.list(Lor),v2Examples:yS.optional(),headers:P.list(bS).optional()}).extend(co);var Aqs=P.union("type",{property:P.object({value:Ms}),statusCode:P.object({})}).transform({transform:e=>{switch(e.type){case"property":return Rhe.property(e.value);case"statusCode":return Rhe.statusCode();default:return e}},untransform:({_visit:e,...t})=>t});var jIi={};ne(jIi,{BasicAuthValues:()=>zor,BearerAuthValues:()=>Vor,HeaderAuthValues:()=>qor,MultipleEnvironmentUrlValues:()=>Gor,OAuthValues:()=>Wor,V2AuthValues:()=>Yqe,V2EndpointLocation:()=>Hor,V2EndpointLocationHttpMethod:()=>$or,V2EnvironmentValues:()=>Xqe,V2HttpEndpointCodeSample:()=>Kor,V2HttpEndpointExample:()=>k_t,V2HttpEndpointExamples:()=>Zor,V2HttpEndpointRequest:()=>Jor,V2HttpEndpointResponse:()=>Xor,V2HttpEndpointResponseBody:()=>Yor,V2SchemaExample:()=>R_t,V2SchemaExamples:()=>yS,V2ValueExamples:()=>vH,V2WebSocketEndpointLocation:()=>tsr,V2WebSocketMessageExample:()=>rsr,V2WebSocketSessionExample:()=>Q_t,V2WebSocketSessionExamples:()=>nsr,V2WebhookExample:()=>N_t,V2WebhookExamples:()=>esr,WithV2Examples:()=>ZA});var zor=P.objectWithoutOptionalProperties({username:P.string(),password:P.string()});var Vor=P.objectWithoutOptionalProperties({token:P.string()});var qor=P.objectWithoutOptionalProperties({value:P.unknown()});var Gor=P.record(nO,Vhe);var Wor=P.objectWithoutOptionalProperties({clientId:P.string(),clientSecret:P.string()});var Yqe=P.union("type",{basic:zor,bearer:Vor,header:qor,oauth:Wor}).transform({transform:e=>{switch(e.type){case"basic":return f3.basic(e);case"bearer":return f3.bearer(e);case"header":return f3.header(e);case"oauth":return f3.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var $or=P.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD"]);var Hor=P.objectWithoutOptionalProperties({method:$or,path:P.string()});var Xqe=P.undiscriminatedUnion([IH,Gor]);var Kor=P.objectWithoutOptionalProperties({name:P.string().optional(),language:P.string(),code:P.string()}).extend(co);var vH=P.record(P.string(),P.unknown());var Jor=P.objectWithoutOptionalProperties({endpoint:Hor,baseUrl:P.property("baseURL",P.string().optional()),environment:Xqe.optional(),auth:Yqe.optional(),pathParameters:vH.optional(),queryParameters:vH.optional(),headers:vH.optional(),requestBody:P.unknown().optional()}).extend(co);var Yor=P.union("type",{error:P.object({value:P.unknown()}),json:P.object({value:P.unknown()}),stream:P.object({value:P.list(P.unknown())})}).transform({transform:e=>{switch(e.type){case"error":return CC.error(e.value);case"json":return CC.json(e.value);case"stream":return CC.stream(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Xor=P.objectWithoutOptionalProperties({statusCode:P.number().optional(),body:Yor.optional()}).extend(co);var k_t=P.objectWithoutOptionalProperties({displayName:P.string().optional(),request:Jor.optional(),response:Xor.optional(),codeSamples:P.list(Kor).optional()});var Zor=P.objectWithoutOptionalProperties({userSpecifiedExamples:P.record(P.string(),k_t),autogeneratedExamples:P.record(P.string(),k_t)});var N_t=P.objectWithoutOptionalProperties({name:P.string().optional(),payload:P.unknown()});var esr=P.objectWithoutOptionalProperties({userSpecifiedExamples:P.record(P.string(),N_t),autogeneratedExamples:P.record(P.string(),N_t)});var tsr=P.objectWithoutOptionalProperties({path:P.string()});var rsr=P.objectWithoutOptionalProperties({type:P.string(),body:P.unknown()});var Q_t=P.objectWithoutOptionalProperties({channel:tsr,baseUrl:P.property("baseURL",P.string().optional()),environment:Xqe.optional(),auth:Yqe.optional(),pathParameters:vH.optional(),queryParameters:vH.optional(),headers:vH.optional(),messages:P.list(rsr).optional()});var nsr=P.objectWithoutOptionalProperties({autogeneratedExamples:P.record(P.string(),Q_t),userSpecifiedExamples:P.record(P.string(),Q_t)});var ZA=P.objectWithoutOptionalProperties({v2Examples:yS.optional()});var LIi={};ne(LIi,{BasicLicense:()=>osr,CratesGithubPublishInfo:()=>ssr,CratesRegistryConfig:()=>Zqe,CustomLicense:()=>asr,EnvironmentVariable:()=>Xb,GeneratorConfig:()=>yqs,GeneratorEnvironment:()=>usr,GeneratorOutputConfig:()=>Tsr,GeneratorPublishConfig:()=>aGe,GeneratorPublishTarget:()=>dsr,GeneratorRegistriesConfig:()=>gsr,GeneratorRegistriesConfigV2:()=>Asr,GithubOutputMode:()=>Ssr,GithubPublishInfo:()=>xsr,LicenseConfig:()=>Osr,LicenseId:()=>isr,MavenCentralSignature:()=>eGe,MavenCentralSignatureGithubInfo:()=>ysr,MavenGithubPublishInfo:()=>bsr,MavenRegistryConfig:()=>msr,MavenRegistryConfigV2:()=>tGe,NpmGithubPublishInfo:()=>Esr,NpmRegistryConfig:()=>hsr,NpmRegistryConfigV2:()=>rGe,NugetGithubPublishInfo:()=>Isr,NugetRegistryConfig:()=>nGe,OutputMetadata:()=>fsr,OutputMetadataAuthor:()=>psr,OutputMode:()=>_sr,PostmanConfig:()=>lsr,PostmanGithubPublishInfo:()=>vsr,PublishingMetadata:()=>Bsr,PypiGithubPublishInfo:()=>Csr,PypiMetadata:()=>iGe,PypiRegistryConfig:()=>oGe,RemoteGeneratorEnvironment:()=>csr,RubyGemsGithubPublishInfo:()=>wsr,RubyGemsRegistryConfig:()=>sGe,config:()=>MIi});var MIi={};ne(MIi,{BasicLicense:()=>osr,CratesGithubPublishInfo:()=>ssr,CratesRegistryConfig:()=>Zqe,CustomLicense:()=>asr,EnvironmentVariable:()=>Xb,GeneratorConfig:()=>yqs,GeneratorEnvironment:()=>usr,GeneratorOutputConfig:()=>Tsr,GeneratorPublishConfig:()=>aGe,GeneratorPublishTarget:()=>dsr,GeneratorRegistriesConfig:()=>gsr,GeneratorRegistriesConfigV2:()=>Asr,GithubOutputMode:()=>Ssr,GithubPublishInfo:()=>xsr,LicenseConfig:()=>Osr,LicenseId:()=>isr,MavenCentralSignature:()=>eGe,MavenCentralSignatureGithubInfo:()=>ysr,MavenGithubPublishInfo:()=>bsr,MavenRegistryConfig:()=>msr,MavenRegistryConfigV2:()=>tGe,NpmGithubPublishInfo:()=>Esr,NpmRegistryConfig:()=>hsr,NpmRegistryConfigV2:()=>rGe,NugetGithubPublishInfo:()=>Isr,NugetRegistryConfig:()=>nGe,OutputMetadata:()=>fsr,OutputMetadataAuthor:()=>psr,OutputMode:()=>_sr,PostmanConfig:()=>lsr,PostmanGithubPublishInfo:()=>vsr,PublishingMetadata:()=>Bsr,PypiGithubPublishInfo:()=>Csr,PypiMetadata:()=>iGe,PypiRegistryConfig:()=>oGe,RemoteGeneratorEnvironment:()=>csr,RubyGemsGithubPublishInfo:()=>wsr,RubyGemsRegistryConfig:()=>sGe});var isr=P.enum_(["MIT","Apache-2.0"]);var osr=P.objectWithoutOptionalProperties({id:isr});var Xb=P.string();var ssr=P.objectWithoutOptionalProperties({registryUrl:P.string(),packageName:P.string(),tokenEnvironmentVariable:Xb,shouldGeneratePublishWorkflow:P.boolean().optional()});var Zqe=P.objectWithoutOptionalProperties({registryUrl:P.string(),token:P.string(),packageName:P.string()});var asr=P.objectWithoutOptionalProperties({filename:P.string()});var csr=P.objectWithoutOptionalProperties({coordinatorUrl:P.string(),coordinatorUrlV2:P.string(),id:P.string()});var usr=P.union(P.discriminant("type","_type"),{local:P.object({}),remote:csr}).transform({transform:e=>{switch(e.type){case"local":return pc.GeneratorEnvironment.local();case"remote":return pc.GeneratorEnvironment.remote(e);default:return e}},untransform:({_visit:e,...t})=>t});var eGe=P.objectWithoutOptionalProperties({keyId:P.string(),password:P.string(),secretKey:P.string()});var tGe=P.objectWithoutOptionalProperties({registryUrl:P.string(),username:P.string(),password:P.string(),coordinate:P.string(),signature:eGe.optional()});var rGe=P.objectWithoutOptionalProperties({registryUrl:P.string(),token:P.string(),packageName:P.string()});var nGe=P.objectWithoutOptionalProperties({registryUrl:P.string(),apiKey:P.string(),packageName:P.string()});var lsr=P.objectWithoutOptionalProperties({apiKey:P.string(),workspaceId:P.string()});var psr=P.objectWithoutOptionalProperties({name:P.string(),email:P.string()});var fsr=P.objectWithoutOptionalProperties({description:P.string().optional(),authors:P.list(psr).optional()});var iGe=P.objectWithoutOptionalProperties({keywords:P.list(P.string()).optional(),documentationLink:P.string().optional(),homepageLink:P.string().optional()}).extend(fsr);var oGe=P.objectWithoutOptionalProperties({registryUrl:P.string(),username:P.string(),password:P.string(),packageName:P.string(),pypiMetadata:iGe.optional()});var sGe=P.objectWithoutOptionalProperties({registryUrl:P.string(),apiKey:P.string(),packageName:P.string()});var dsr=P.union("type",{maven:tGe,npm:rGe,pypi:oGe,postman:lsr,rubygems:sGe,nuget:nGe,crates:Zqe}).transform({transform:e=>{switch(e.type){case"maven":return pc.GeneratorPublishTarget.maven(e);case"npm":return pc.GeneratorPublishTarget.npm(e);case"pypi":return pc.GeneratorPublishTarget.pypi(e);case"postman":return pc.GeneratorPublishTarget.postman(e);case"rubygems":return pc.GeneratorPublishTarget.rubygems(e);case"nuget":return pc.GeneratorPublishTarget.nuget(e);case"crates":return pc.GeneratorPublishTarget.crates(e);default:return e}},untransform:({_visit:e,...t})=>t});var msr=P.objectWithoutOptionalProperties({registryUrl:P.string(),username:P.string(),password:P.string(),group:P.string(),signature:eGe.optional()});var hsr=P.objectWithoutOptionalProperties({registryUrl:P.string(),token:P.string(),scope:P.string()});var gsr=P.objectWithoutOptionalProperties({maven:msr,npm:hsr});var Asr=P.objectWithoutOptionalProperties({maven:tGe,npm:rGe,pypi:oGe,rubygems:sGe,nuget:nGe,crates:Zqe});var aGe=P.objectWithoutOptionalProperties({registries:gsr,registriesV2:Asr,publishTarget:dsr.optional(),version:P.string()});var ysr=P.objectWithoutOptionalProperties({keyIdEnvironmentVariable:Xb,passwordEnvironmentVariable:Xb,secretKeyEnvironmentVariable:Xb});var bsr=P.objectWithoutOptionalProperties({registryUrl:P.string(),coordinate:P.string(),usernameEnvironmentVariable:Xb,passwordEnvironmentVariable:Xb,signature:ysr.optional(),shouldGeneratePublishWorkflow:P.boolean().optional()});var Esr=P.objectWithoutOptionalProperties({registryUrl:P.string(),packageName:P.string(),tokenEnvironmentVariable:Xb,shouldGeneratePublishWorkflow:P.boolean().optional()});var Isr=P.objectWithoutOptionalProperties({registryUrl:P.string(),packageName:P.string(),apiKeyEnvironmentVariable:Xb,shouldGeneratePublishWorkflow:P.boolean().optional()});var vsr=P.objectWithoutOptionalProperties({apiKeyEnvironmentVariable:Xb,workspaceIdEnvironmentVariable:Xb});var Csr=P.objectWithoutOptionalProperties({registryUrl:P.string(),packageName:P.string(),usernameEnvironmentVariable:Xb,passwordEnvironmentVariable:Xb,pypiMetadata:iGe.optional(),shouldGeneratePublishWorkflow:P.boolean().optional()});var wsr=P.objectWithoutOptionalProperties({registryUrl:P.string(),packageName:P.string(),apiKeyEnvironmentVariable:Xb,shouldGeneratePublishWorkflow:P.boolean().optional()});var xsr=P.union("type",{npm:Esr,maven:bsr,postman:vsr,pypi:Csr,rubygems:wsr,nuget:Isr,crates:ssr}).transform({transform:e=>{switch(e.type){case"npm":return pc.GithubPublishInfo.npm(e);case"maven":return pc.GithubPublishInfo.maven(e);case"postman":return pc.GithubPublishInfo.postman(e);case"pypi":return pc.GithubPublishInfo.pypi(e);case"rubygems":return pc.GithubPublishInfo.rubygems(e);case"nuget":return pc.GithubPublishInfo.nuget(e);case"crates":return pc.GithubPublishInfo.crates(e);default:return e}},untransform:({_visit:e,...t})=>t});var Ssr=P.objectWithoutOptionalProperties({version:P.string(),repoUrl:P.string(),installationToken:P.string().optional(),branch:P.string().optional(),publishInfo:xsr.optional()});var _sr=P.union("type",{publish:aGe,downloadFiles:P.object({}),github:Ssr}).transform({transform:e=>{switch(e.type){case"publish":return pc.OutputMode.publish(e);case"downloadFiles":return pc.OutputMode.downloadFiles();case"github":return pc.OutputMode.github(e);default:return e}},untransform:({_visit:e,...t})=>t});var Bsr=P.objectWithoutOptionalProperties({packageDescription:P.property("package_description",P.string().optional()),publisherEmail:P.property("publisher_email",P.string().optional()),referenceUrl:P.property("reference_url",P.string().optional()),publisherName:P.property("publisher_name",P.string().optional())});var Tsr=P.objectWithoutOptionalProperties({path:P.string(),snippetFilepath:P.string().optional(),snippetTemplateFilepath:P.string().optional(),publishingMetadata:Bsr.optional(),mode:_sr});var Osr=P.union("type",{basic:osr,custom:asr}).transform({transform:e=>{switch(e.type){case"basic":return pc.LicenseConfig.basic(e);case"custom":return pc.LicenseConfig.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var yqs=P.objectWithoutOptionalProperties({dryRun:P.boolean(),irFilepath:P.string(),originalReadmeFilepath:P.string().optional(),license:Osr.optional(),output:Tsr,publish:aGe.optional(),workspaceName:P.string(),organization:P.string(),customConfig:P.unknown(),environment:usr,whitelabel:P.boolean(),writeUnitTests:P.boolean(),generatePaginatedClients:P.boolean().optional(),generateOauthClients:P.boolean()});var UIi={};ne(UIi,{AutogeneratedEndpointExample:()=>Msr,BytesRequest:()=>pGe,BytesResponse:()=>fGe,CursorPagination:()=>Lsr,CustomPagination:()=>Usr,DeclaredServiceName:()=>zsr,EndpointName:()=>Vsr,ExampleCodeSample:()=>Wsr,ExampleCodeSampleLanguage:()=>qsr,ExampleCodeSampleSdk:()=>Gsr,ExampleEndpointCall:()=>lGe,ExampleEndpointErrorResponse:()=>ksr,ExampleEndpointSuccessResponse:()=>Qsr,ExampleHeader:()=>CDe,ExampleInlinedRequestBody:()=>uGe,ExampleInlinedRequestBodyExtraProperty:()=>Dsr,ExampleInlinedRequestBodyProperty:()=>Rsr,ExamplePathParameter:()=>Ghe,ExampleQueryParameter:()=>cGe,ExampleQueryParameterShape:()=>Psr,ExampleRequestBody:()=>Fsr,ExampleResponse:()=>jsr,ExampleServerSideEvent:()=>Nsr,FileDownloadResponse:()=>dGe,FileProperty:()=>Ksr,FilePropertyArray:()=>$sr,FilePropertySingle:()=>Hsr,FileUploadBodyProperty:()=>Ysr,FileUploadBodyPropertyEncoding:()=>Jsr,FileUploadRequest:()=>hGe,FileUploadRequestProperty:()=>Xsr,GrpcTransport:()=>rar,HttpEndpoint:()=>kar,HttpEndpointSecurityItem:()=>nar,HttpEndpointSource:()=>sar,HttpHeader:()=>bS,HttpMethod:()=>aar,HttpPath:()=>E3,HttpPathPart:()=>car,HttpRequestBody:()=>yGe,HttpRequestBodyReference:()=>AGe,HttpResponse:()=>$he,HttpResponseBody:()=>Aar,HttpService:()=>jar,InlinedRequestBody:()=>uar,InlinedRequestBodyProperty:()=>mGe,JsonResponse:()=>bGe,JsonResponseBody:()=>lar,JsonResponseBodyWithProperty:()=>par,JsonStreamChunk:()=>far,NonStreamHttpResponseBody:()=>har,OffsetPagination:()=>yar,Pagination:()=>Iar,PathPagination:()=>bar,PathParameter:()=>CG,PathParameterLocation:()=>Car,PropertyPathItem:()=>zqe,ProtoSourceInfo:()=>oar,QueryParameter:()=>Qhe,RequestProperty:()=>tO,RequestPropertyValue:()=>air,ResponseError:()=>war,ResponseErrors:()=>xar,ResponseProperty:()=>X0,RetriesConfiguration:()=>_ar,RetriesDisabledSchema:()=>Sar,SdkRequest:()=>Par,SdkRequestBodyType:()=>Bar,SdkRequestShape:()=>Oar,SdkRequestWrapper:()=>Tar,SseStreamChunk:()=>dar,StreamParameterResponse:()=>gar,StreamingResponse:()=>EGe,SupportedSdkLanguage:()=>Whe,TextResponse:()=>IGe,TextStreamChunk:()=>mar,Transport:()=>CGe,UriPagination:()=>Ear,UserSpecifiedEndpointExample:()=>Dar,V2HttpRequestBodies:()=>Rar,V2HttpResponses:()=>Far});var CDe=P.objectWithoutOptionalProperties({name:Ms,value:P.lazyObject(()=>Jc)});var Ghe=P.objectWithoutOptionalProperties({name:Oo,value:P.lazyObject(()=>Jc)});var Psr=P.union("type",{single:P.object({}),exploded:P.object({}),commaSeparated:P.object({})}).transform({transform:e=>{switch(e.type){case"single":return $w.single();case"exploded":return $w.exploded();case"commaSeparated":return $w.commaSeparated();default:return e}},untransform:({_visit:e,...t})=>t});var cGe=P.objectWithoutOptionalProperties({name:Ms,value:P.lazyObject(()=>Jc),shape:Psr.optional()});var Dsr=P.objectWithoutOptionalProperties({name:Ms,value:P.lazyObject(()=>Jc)});var ey=P.objectWithoutOptionalProperties({typeId:rB,fernFilepath:y3,name:Oo,displayName:jhe.optional()});var Rsr=P.objectWithoutOptionalProperties({name:Ms,value:P.lazyObject(()=>Jc),originalTypeDeclaration:ey.optional()});var uGe=P.objectWithoutOptionalProperties({properties:P.list(Rsr),extraProperties:P.list(Dsr).optional()}).extend(yH);var Fsr=P.union("type",{inlinedRequestBody:uGe,reference:P.lazyObject(()=>Jc)}).transform({transform:e=>{switch(e.type){case"inlinedRequestBody":return ZT.inlinedRequestBody(e);case"reference":return ZT.reference(e);default:return e}},untransform:({_visit:e,...t})=>t});var ksr=P.objectWithoutOptionalProperties({error:qhe,body:P.lazyObject(()=>Jc).optional()});var Nsr=P.objectWithoutOptionalProperties({event:P.string(),data:P.lazyObject(()=>Jc)});var Qsr=P.union("type",{body:P.object({value:P.lazyObject(()=>Jc).optional()}),stream:P.object({value:P.list(P.lazyObject(()=>Jc))}),sse:P.object({value:P.list(Nsr)})}).transform({transform:e=>{switch(e.type){case"body":return vA.body(e.value);case"stream":return vA.stream(e.value);case"sse":return vA.sse(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var jsr=P.union("type",{ok:P.object({value:Qsr}),error:ksr}).transform({transform:e=>{switch(e.type){case"ok":return Ag.ok(e.value);case"error":return Ag.error(e);default:return e}},untransform:({_visit:e,...t})=>t});var lGe=P.objectWithoutOptionalProperties({id:P.string().optional(),name:Oo.optional(),url:P.string(),rootPathParameters:P.list(Ghe),servicePathParameters:P.list(Ghe),endpointPathParameters:P.list(Ghe),serviceHeaders:P.list(CDe),endpointHeaders:P.list(CDe),queryParameters:P.list(cGe),request:Fsr.optional(),response:jsr}).extend(co);var Msr=P.objectWithoutOptionalProperties({example:lGe});var pGe=P.objectWithoutOptionalProperties({isOptional:P.boolean()}).extend(co).extend(ZA).extend(b3);var fGe=P.objectWithoutOptionalProperties({}).extend(co).extend(ZA);var Lsr=P.objectWithoutOptionalProperties({page:tO,next:X0,results:X0});var Usr=P.objectWithoutOptionalProperties({results:X0});var zsr=P.objectWithoutOptionalProperties({fernFilepath:y3});var Vsr=Oo;var qsr=P.objectWithoutOptionalProperties({name:Oo.optional(),language:P.string(),code:P.string(),install:P.string().optional()}).extend(co);var Whe=P.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","php","rust","swift"]);var Gsr=P.objectWithoutOptionalProperties({name:Oo.optional(),sdk:Whe,code:P.string()}).extend(co);var Wsr=P.union("type",{language:qsr,sdk:Gsr}).transform({transform:e=>{switch(e.type){case"language":return t6.language(e);case"sdk":return t6.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var dGe=P.objectWithoutOptionalProperties({}).extend(co).extend(ZA);var $sr=P.objectWithoutOptionalProperties({key:Ms,isOptional:P.boolean(),contentType:P.string().optional()}).extend(co);var Hsr=P.objectWithoutOptionalProperties({key:Ms,isOptional:P.boolean(),contentType:P.string().optional()}).extend(co);var Ksr=P.union("type",{file:Hsr,fileArray:$sr}).transform({transform:e=>{switch(e.type){case"file":return Fk.file(e);case"fileArray":return Fk.fileArray(e);default:return e}},untransform:({_visit:e,...t})=>t});var Jsr=P.enum_(["exploded","json","form"]);var mGe=P.objectWithoutOptionalProperties({name:Ms,valueType:P.lazy(()=>ma),v2Examples:yS.optional(),propertyAccess:Nhe.optional()}).extend(Lhe);var Ysr=P.objectWithoutOptionalProperties({style:Jsr.optional()}).extend(mGe).extend(b3);var Xsr=P.union("type",{file:P.object({value:Ksr}),bodyProperty:Ysr}).transform({transform:e=>{switch(e.type){case"file":return wC.file(e.value);case"bodyProperty":return wC.bodyProperty(e);default:return e}},untransform:({_visit:e,...t})=>t});var hGe=P.objectWithoutOptionalProperties({name:Oo,properties:P.list(Xsr)}).extend(co).extend(ZA).extend(b3);var Zsr=P.objectWithoutOptionalProperties({namespace:P.string()});var ear=P.objectWithoutOptionalProperties({csharp:Zsr.optional()});var gGe=P.objectWithoutOptionalProperties({filepath:P.string(),packageName:P.string().optional(),options:ear.optional()});var tar=P.objectWithoutOptionalProperties({file:gGe,name:Oo});var rar=P.objectWithoutOptionalProperties({service:tar});var nar=P.record(Uqe,P.list(yir));var iar=P.enum_(["UNARY","CLIENT_STREAM","SERVER_STREAM","BIDIRECTIONAL_STREAM"]);var oar=P.objectWithoutOptionalProperties({methodType:iar.optional()});var sar=P.union("type",{proto:oar,openapi:P.object({}),openrpc:P.object({})}).transform({transform:e=>{switch(e.type){case"proto":return eO.proto(e);case"openapi":return eO.openapi();case"openrpc":return eO.openrpc();default:return e}},untransform:({_visit:e,...t})=>t});var aar=P.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD"]);var car=P.objectWithoutOptionalProperties({pathParameter:P.string(),tail:P.string()});var E3=P.objectWithoutOptionalProperties({head:P.string(),parts:P.list(car)});var AGe=P.objectWithoutOptionalProperties({requestBodyType:P.lazy(()=>ma)}).extend(co).extend(b3).extend(ZA);var uar=P.objectWithoutOptionalProperties({name:Oo,extends:P.list(ey),properties:P.list(mGe),extendedProperties:P.list(tB).optional(),extraProperties:P.property("extra-properties",P.boolean())}).extend(co).extend(ZA).extend(b3);var yGe=P.union("type",{inlinedRequestBody:uar,reference:AGe,fileUpload:hGe,bytes:pGe}).transform({transform:e=>{switch(e.type){case"inlinedRequestBody":return ld.inlinedRequestBody(e);case"reference":return ld.reference(e);case"fileUpload":return ld.fileUpload(e);case"bytes":return ld.bytes(e);default:return e}},untransform:({_visit:e,...t})=>t});var lar=P.objectWithoutOptionalProperties({responseBodyType:P.lazy(()=>ma)}).extend(co).extend(ZA);var par=P.objectWithoutOptionalProperties({responseBodyType:P.lazy(()=>ma),responseProperty:tB.optional()}).extend(co).extend(ZA);var bGe=P.union("type",{response:lar,nestedPropertyAsResponse:par}).transform({transform:e=>{switch(e.type){case"response":return Yb.response(e);case"nestedPropertyAsResponse":return Yb.nestedPropertyAsResponse(e);default:return e}},untransform:({_visit:e,...t})=>t});var far=P.objectWithoutOptionalProperties({payload:P.lazy(()=>ma),terminator:P.string().optional()}).extend(co).extend(ZA);var dar=P.objectWithoutOptionalProperties({payload:P.lazy(()=>ma),terminator:P.string().optional()}).extend(co).extend(ZA);var mar=P.objectWithoutOptionalProperties({}).extend(co).extend(ZA);var EGe=P.union("type",{json:far,text:mar,sse:dar}).transform({transform:e=>{switch(e.type){case"json":return tI.json(e);case"text":return tI.text(e);case"sse":return tI.sse(e);default:return e}},untransform:({_visit:e,...t})=>t});var IGe=P.objectWithoutOptionalProperties({}).extend(co).extend(ZA);var har=P.union("type",{json:P.object({value:bGe}),fileDownload:dGe,text:IGe,bytes:fGe}).transform({transform:e=>{switch(e.type){case"json":return J1.json(e.value);case"fileDownload":return J1.fileDownload(e);case"text":return J1.text(e);case"bytes":return J1.bytes(e);default:return e}},untransform:({_visit:e,...t})=>t});var gar=P.objectWithoutOptionalProperties({nonStreamResponse:har,streamResponse:EGe});var Aar=P.union("type",{json:P.object({value:bGe}),fileDownload:dGe,text:IGe,bytes:fGe,streaming:P.object({value:EGe}),streamParameter:gar}).transform({transform:e=>{switch(e.type){case"json":return Iu.json(e.value);case"fileDownload":return Iu.fileDownload(e);case"text":return Iu.text(e);case"bytes":return Iu.bytes(e);case"streaming":return Iu.streaming(e.value);case"streamParameter":return Iu.streamParameter(e);default:return e}},untransform:({_visit:e,...t})=>t});var $he=P.objectWithoutOptionalProperties({statusCode:P.property("status-code",P.number().optional()),isWildcardStatusCode:P.boolean().optional(),body:Aar.optional()}).extend(co);var yar=P.objectWithoutOptionalProperties({page:tO,results:X0,hasNextPage:X0.optional(),step:tO.optional()});var bar=P.objectWithoutOptionalProperties({nextPath:X0,results:X0});var Ear=P.objectWithoutOptionalProperties({nextUri:X0,results:X0});var Iar=P.union("type",{cursor:Lsr,offset:yar,custom:Usr,uri:Ear,path:bar}).transform({transform:e=>{switch(e.type){case"cursor":return Y0.cursor(e);case"offset":return Y0.offset(e);case"custom":return Y0.custom(e);case"uri":return Y0.uri(e);case"path":return Y0.path(e);default:return e}},untransform:({_visit:e,...t})=>t});var vGe=P.string();var Car=P.enum_(["ROOT","SERVICE","ENDPOINT"]);var CG=P.objectWithoutOptionalProperties({name:Oo,valueType:P.lazy(()=>ma),location:Car,variable:vGe.optional(),clientDefault:AH.optional(),v2Examples:yS.optional(),explode:P.boolean().optional()}).extend(co);var war=P.objectWithoutOptionalProperties({error:qhe}).extend(co);var xar=P.list(war);var Sar=P.objectWithoutOptionalProperties({disabled:P.boolean().optional()});var _ar=P.undiscriminatedUnion([Sar]);var Bar=P.union("type",{typeReference:AGe,bytes:pGe}).transform({transform:e=>{switch(e.type){case"typeReference":return gG.typeReference(e);case"bytes":return gG.bytes(e);default:return e}},untransform:({_visit:e,...t})=>t});var Tar=P.objectWithoutOptionalProperties({wrapperName:Oo,bodyKey:Oo,includePathParameters:P.boolean().optional(),onlyPathParameters:P.boolean().optional()});var Oar=P.union("type",{justRequestBody:P.object({value:Bar}),wrapper:Tar}).transform({transform:e=>{switch(e.type){case"justRequestBody":return d3.justRequestBody(e.value);case"wrapper":return d3.wrapper(e);default:return e}},untransform:({_visit:e,...t})=>t});var Par=P.objectWithoutOptionalProperties({streamParameter:tO.optional(),requestParameterName:Oo,shape:Oar});var CGe=P.union("type",{http:P.object({}),grpc:rar}).transform({transform:e=>{switch(e.type){case"http":return m3.http();case"grpc":return m3.grpc(e);default:return e}},untransform:({_visit:e,...t})=>t});var Dar=P.objectWithoutOptionalProperties({codeSamples:P.list(Wsr).optional(),example:lGe.optional()});var Rar=P.objectWithoutOptionalProperties({requestBodies:P.list(yGe).optional()});var Far=P.objectWithoutOptionalProperties({responses:P.list($he).optional()});var kar=P.objectWithoutOptionalProperties({id:Lse,name:Vsr,displayName:P.string().optional(),method:aar,headers:P.list(bS),responseHeaders:P.list(bS).optional(),baseUrl:nO.optional(),v2BaseUrls:P.list(nO).optional(),basePath:E3.optional(),path:E3,fullPath:E3,pathParameters:P.list(CG),allPathParameters:P.list(CG),queryParameters:P.list(Qhe),requestBody:yGe.optional(),v2RequestBodies:Rar.optional(),sdkRequest:Par.optional(),response:$he.optional(),v2Responses:Far.optional(),errors:xar,auth:P.boolean(),security:P.list(nar).optional(),idempotent:P.boolean(),pagination:Iar.optional(),userSpecifiedExamples:P.list(Dar),autogeneratedExamples:P.list(Msr),v2Examples:Zor.optional(),transport:CGe.optional(),source:sar.optional(),audiences:P.list(Mqe).optional(),retries:_ar.optional(),apiPlayground:P.boolean().optional()}).extend(xC);var Nar=P.objectWithoutOptionalProperties({});var Qar=P.objectWithoutOptionalProperties({});var wGe=P.objectWithoutOptionalProperties({json:Nar.optional(),proto:Qar.optional()});var jar=P.objectWithoutOptionalProperties({availability:gH.optional(),name:zsr,displayName:P.string().optional(),basePath:E3,endpoints:P.list(kar),headers:P.list(bS),pathParameters:P.list(CG),encoding:wGe.optional(),transport:CGe.optional(),audiences:P.list(Mqe).optional()});var zIi={};ne(zIi,{ApiDefinitionSource:()=>Uar,ApiDefinitionSourceId:()=>Mar,ApiVersionScheme:()=>Var,CasingsConfig:()=>qar,ErrorDiscriminationByPropertyStrategy:()=>Gar,ErrorDiscriminationStrategy:()=>War,ExampleStyle:()=>$ar,GenerationMetadata:()=>Kar,HeaderApiVersionScheme:()=>zar,IntermediateRepresentation:()=>bqs,InvocationSource:()=>Har,Package:()=>DGe,PackageNavigationConfig:()=>xur,PlatformHeaders:()=>Tur,ProtoSource:()=>Lar,ReadmeConfig:()=>_ur,ReadmeCustomSection:()=>Sur,SdkConfig:()=>Our,ServiceTypeReferenceInfo:()=>Pur,SourceConfig:()=>Dur,Subpackage:()=>Rur,UserAgent:()=>Bur});var Mar=P.string();var Lar=P.objectWithoutOptionalProperties({id:Mar,protoRootUrl:P.string()});var Uar=P.union("type",{proto:Lar,openapi:P.object({})}).transform({transform:e=>{switch(e.type){case"proto":return kk.proto(e);case"openapi":return kk.openapi();default:return e}},untransform:({_visit:e,...t})=>t});var Use=P.objectWithoutOptionalProperties({name:Ms}).extend(xC);var xGe=P.objectWithoutOptionalProperties({default:Use.optional(),values:P.list(Use),forwardCompatible:P.boolean().optional()});var zar=P.objectWithoutOptionalProperties({header:bS,value:xGe});var Var=P.union("type",{header:zar}).transform({transform:e=>e.type==="header"?Fhe.header(e):e,untransform:({_visit:e,...t})=>t});var qar=P.objectWithoutOptionalProperties({generationLanguage:Whe.optional(),keywords:P.list(P.string()).optional(),smartCasing:P.boolean()});var Gar=P.objectWithoutOptionalProperties({discriminant:Ms,contentProperty:Ms});var War=P.union("type",{statusCode:P.object({}),property:Gar}).transform({transform:e=>{switch(e.type){case"statusCode":return n6.statusCode();case"property":return n6.property(e);default:return e}},untransform:({_visit:e,...t})=>t});var $ar=P.enum_(["minimal","comprehensive"]);var Har=P.enum_(["autopilot","autorelease","ci","manual"]);var Kar=P.objectWithoutOptionalProperties({cliVersion:P.string(),generatorName:P.string(),generatorVersion:P.string(),generatorConfig:P.unknown().optional(),originGitCommit:P.string().optional(),originGitCommitIsDirty:P.boolean().optional(),invokedBy:Har.optional(),requestedVersion:P.string().optional(),ciProvider:P.string().optional()});var Jar=P.objectWithoutOptionalProperties({version:P.string().optional(),packageName:P.string().optional()});var Yar=P.objectWithoutOptionalProperties({version:P.string().optional(),modulePath:P.string().optional()});var Xar=P.objectWithoutOptionalProperties({coordinate:P.string().optional(),version:P.string().optional(),usernameEnvironmentVariable:P.string(),passwordEnvironmentVariable:P.string(),mavenUrlEnvironmentVariable:P.string()});var Zar=P.objectWithoutOptionalProperties({version:P.string().optional(),packageName:P.string().optional(),tokenEnvironmentVariable:P.string()});var ecr=P.objectWithoutOptionalProperties({apiKey:P.string(),workspaceId:P.string(),collectionId:P.string().optional()});var tcr=P.objectWithoutOptionalProperties({version:P.string().optional(),packageName:P.string().optional()});var Hhe=P.union("type",{postman:ecr,npm:Zar,maven:Xar,pypi:tcr,crates:Jar,go:Yar}).transform({transform:e=>{switch(e.type){case"postman":return d0.postman(e);case"npm":return d0.npm(e);case"maven":return d0.maven(e);case"pypi":return d0.pypi(e);case"crates":return d0.crates(e);case"go":return d0.go(e);default:return e}},untransform:({_visit:e,...t})=>t});var rcr=P.objectWithoutOptionalProperties({target:Hhe});var ncr=P.objectWithoutOptionalProperties({generateFullProject:P.boolean(),publishTarget:Hhe.optional()});var icr=P.objectWithoutOptionalProperties({owner:P.string(),repo:P.string(),uri:P.string().optional(),token:P.string().optional(),mode:P.stringLiteral("pull-request").optional(),branch:P.string().optional(),target:Hhe});var ocr=P.union("type",{github:icr,direct:rcr,filesystem:ncr}).transform({transform:e=>{switch(e.type){case"github":return fH.github(e);case"direct":return fH.direct(e);case"filesystem":return fH.filesystem(e);default:return e}},untransform:({_visit:e,...t})=>t});var j_t=P.objectWithoutOptionalProperties({name:Oo.optional(),shape:P.lazy(()=>SGe)}).extend(yH).extend(co);var scr=P.objectWithoutOptionalProperties({file:gGe,name:Oo});var acr=P.union("type",{any:P.object({}),api:P.object({}),boolValue:P.object({}),bytesValue:P.object({}),doubleValue:P.object({}),duration:P.object({}),empty:P.object({}),enum:P.object({}),enumValue:P.object({}),field:P.object({}),fieldCardinality:P.object({}),fieldKind:P.object({}),fieldMask:P.object({}),floatValue:P.object({}),int32Value:P.object({}),int64Value:P.object({}),listValue:P.object({}),method:P.object({}),mixin:P.object({}),nullValue:P.object({}),option:P.object({}),sourceContext:P.object({}),stringValue:P.object({}),struct:P.object({}),syntax:P.object({}),timestamp:P.object({}),type:P.object({}),uint32Value:P.object({}),uint64Value:P.object({}),value:P.object({})}).transform({transform:e=>{switch(e.type){case"any":return mi.any();case"api":return mi.api();case"boolValue":return mi.boolValue();case"bytesValue":return mi.bytesValue();case"doubleValue":return mi.doubleValue();case"duration":return mi.duration();case"empty":return mi.empty();case"enum":return mi.enum();case"enumValue":return mi.enumValue();case"field":return mi.field();case"fieldCardinality":return mi.fieldCardinality();case"fieldKind":return mi.fieldKind();case"fieldMask":return mi.fieldMask();case"floatValue":return mi.floatValue();case"int32Value":return mi.int32Value();case"int64Value":return mi.int64Value();case"listValue":return mi.listValue();case"method":return mi.method();case"mixin":return mi.mixin();case"nullValue":return mi.nullValue();case"option":return mi.option();case"sourceContext":return mi.sourceContext();case"stringValue":return mi.stringValue();case"struct":return mi.struct();case"syntax":return mi.syntax();case"timestamp":return mi.timestamp();case"type":return mi.type();case"uint32Value":return mi.uint32Value();case"uint64Value":return mi.uint64Value();case"value":return mi.value();default:return e}},untransform:({_visit:e,...t})=>t});var ccr=P.union("type",{wellKnown:P.object({value:acr}),userDefined:scr}).transform({transform:e=>{switch(e.type){case"wellKnown":return Bp.wellKnown(e.value);case"userDefined":return Bp.userDefined(e);default:return e}},untransform:({_visit:e,...t})=>t});var ucr=P.union("type",{proto:P.object({value:ccr})}).transform({transform:e=>e.type==="proto"?kse.proto(e.value):e,untransform:({_visit:e,...t})=>t});var lcr=P.enum_(["INTEGER","LONG","UINT","UINT_64","FLOAT","DOUBLE","BOOLEAN","STRING","DATE","DATE_TIME","DATE_TIME_RFC_2822","UUID","BASE_64","BIG_INTEGER"]);var pcr=P.objectWithoutOptionalProperties({});var fcr=P.objectWithoutOptionalProperties({default:P.string().optional()});var dcr=P.objectWithoutOptionalProperties({default:P.boolean().optional()});var mcr=P.objectWithoutOptionalProperties({});var hcr=P.objectWithoutOptionalProperties({});var gcr=P.objectWithoutOptionalProperties({});var Acr=P.objectWithoutOptionalProperties({min:P.number().optional(),max:P.number().optional(),exclusiveMin:P.boolean().optional(),exclusiveMax:P.boolean().optional(),multipleOf:P.number().optional()});var ycr=P.objectWithoutOptionalProperties({default:P.number().optional(),validation:Acr.optional()});var bcr=P.objectWithoutOptionalProperties({min:P.number().optional(),max:P.number().optional(),exclusiveMin:P.boolean().optional(),exclusiveMax:P.boolean().optional(),multipleOf:P.number().optional()});var Ecr=P.objectWithoutOptionalProperties({default:P.number().optional(),validation:bcr.optional()});var Icr=P.objectWithoutOptionalProperties({min:P.number().optional(),max:P.number().optional(),exclusiveMin:P.boolean().optional(),exclusiveMax:P.boolean().optional(),multipleOf:P.number().optional()});var vcr=P.objectWithoutOptionalProperties({default:P.number().optional(),validation:Icr.optional()});var Ccr=P.objectWithoutOptionalProperties({min:P.number().optional(),max:P.number().optional(),exclusiveMin:P.boolean().optional(),exclusiveMax:P.boolean().optional(),multipleOf:P.number().optional()});var wcr=P.objectWithoutOptionalProperties({default:P.number().optional(),validation:Ccr.optional()});var xcr=P.objectWithoutOptionalProperties({format:P.string().optional(),pattern:P.string().optional(),minLength:P.number().optional(),maxLength:P.number().optional()});var Scr=P.objectWithoutOptionalProperties({default:P.string().optional(),validation:xcr.optional()});var _cr=P.objectWithoutOptionalProperties({min:P.number().optional(),max:P.number().optional(),exclusiveMin:P.boolean().optional(),exclusiveMax:P.boolean().optional(),multipleOf:P.number().optional()});var Bcr=P.objectWithoutOptionalProperties({default:P.number().optional(),validation:_cr.optional()});var Tcr=P.objectWithoutOptionalProperties({min:P.number().optional(),max:P.number().optional(),exclusiveMin:P.boolean().optional(),exclusiveMax:P.boolean().optional(),multipleOf:P.number().optional()});var Ocr=P.objectWithoutOptionalProperties({default:P.number().optional(),validation:Tcr.optional()});var Pcr=P.objectWithoutOptionalProperties({});var Dcr=P.union("type",{integer:vcr,long:wcr,uint:Ocr,uint64:Bcr,float:Ecr,double:ycr,boolean:dcr,string:Scr,date:gcr,dateTime:hcr,dateTimeRfc2822:mcr,uuid:Pcr,base64:pcr,bigInteger:fcr}).transform({transform:e=>{switch(e.type){case"integer":return ti.integer(e);case"long":return ti.long(e);case"uint":return ti.uint(e);case"uint64":return ti.uint64(e);case"float":return ti.float(e);case"double":return ti.double(e);case"boolean":return ti.boolean(e);case"string":return ti.string(e);case"date":return ti.date(e);case"dateTime":return ti.dateTime(e);case"dateTimeRfc2822":return ti.dateTimeRfc2822(e);case"uuid":return ti.uuid(e);case"base64":return ti.base64(e);case"bigInteger":return ti.bigInteger(e);default:return e}},untransform:({_visit:e,...t})=>t});var _Ge=P.objectWithoutOptionalProperties({v1:lcr,v2:Dcr.optional()});var Rcr=P.enum_(["ENUM","OBJECT","UNION","UNDISCRIMINATED_UNION"]);var Fcr=P.objectWithoutOptionalProperties({name:ey,shape:Rcr});var kcr=P.union(P.discriminant("type","_type"),{container:P.object({container:P.lazy(()=>BGe)}),named:Fcr,primitive:P.object({primitive:_Ge}),unknown:P.object({})}).transform({transform:e=>{switch(e.type){case"container":return X1.container(e.container);case"named":return X1.named(e);case"primitive":return X1.primitive(e.primitive);case"unknown":return X1.unknown();default:return e}},untransform:({_visit:e,...t})=>t});var Ncr=P.objectWithoutOptionalProperties({aliasOf:P.lazy(()=>ma),resolvedType:kcr});var Qcr=P.objectWithoutOptionalProperties({extends:P.list(ey),properties:P.list(tB),extendedProperties:P.list(tB).optional(),extraProperties:P.property("extra-properties",P.boolean())});var jcr=P.objectWithoutOptionalProperties({type:P.lazy(()=>ma)}).extend(co);var Mcr=P.objectWithoutOptionalProperties({members:P.list(jcr),baseProperties:P.list(tB).optional()});var Lcr=P.objectWithoutOptionalProperties({name:Ms,type:P.lazy(()=>ma)});var Ucr=P.union(P.discriminant("propertiesType","_type"),{samePropertiesAsObject:ey,singleProperty:Lcr,noProperties:P.object({})}).transform({transform:e=>{switch(e.propertiesType){case"samePropertiesAsObject":return mS.samePropertiesAsObject(e);case"singleProperty":return mS.singleProperty(e);case"noProperties":return mS.noProperties();default:return e}},untransform:({_visit:e,...t})=>t});var M_t=P.objectWithoutOptionalProperties({discriminantValue:Ms,shape:Ucr,displayName:P.string().optional(),availability:gH.optional()}).extend(co);var zcr=P.enum_(["data","protocol"]);var Vcr=P.objectWithoutOptionalProperties({discriminant:Ms,extends:P.list(ey),types:P.list(M_t),baseProperties:P.list(tB),default:M_t.optional(),discriminatorContext:zcr.optional()});var qcr=P.union(P.discriminant("type","_type"),{alias:Ncr,enum:xGe,object:Qcr,union:Vcr,undiscriminatedUnion:Mcr}).transform({transform:e=>{switch(e.type){case"alias":return Cc.alias(e);case"enum":return Cc.enum(e);case"object":return Cc.object(e);case"union":return Cc.union(e);case"undiscriminatedUnion":return Cc.undiscriminatedUnion(e);default:return e}},untransform:({_visit:e,...t})=>t});var Gcr=P.objectWithoutOptionalProperties({name:ey,shape:qcr,autogeneratedExamples:P.list(j_t),userProvidedExamples:P.list(j_t),v2Examples:yS.optional(),referencedTypes:P.set(rB),encoding:wGe.optional(),source:ucr.optional(),inline:P.boolean().optional()}).extend(xC);var Wcr=P.objectWithoutOptionalProperties({id:vGe,name:Oo,type:P.lazy(()=>ma)}).extend(co);var $cr=P.objectWithoutOptionalProperties({name:Oo.optional(),payload:P.lazyObject(()=>Jc)}).extend(co);var Hcr=P.enum_(["GET","POST"]);var Kcr=Oo;var Jcr=P.objectWithoutOptionalProperties({name:Ms,valueType:P.lazy(()=>ma)}).extend(Lhe);var Ycr=P.objectWithoutOptionalProperties({name:Oo,extends:P.list(ey),properties:P.list(Jcr)});var Xcr=P.objectWithoutOptionalProperties({payloadType:P.lazy(()=>ma)}).extend(co);var Zcr=P.union("type",{inlinedPayload:Ycr,reference:Xcr}).transform({transform:e=>{switch(e.type){case"inlinedPayload":return hS.inlinedPayload(e);case"reference":return hS.reference(e);default:return e}},untransform:({_visit:e,...t})=>t});var eur=P.enum_(["RSA_SHA256","RSA_SHA384","RSA_SHA512","ECDSA_SHA256","ECDSA_SHA384","ECDSA_SHA512","ED25519"]);var tur=P.objectWithoutOptionalProperties({url:P.string(),keyIdHeader:Ms.optional()});var rur=P.objectWithoutOptionalProperties({});var nur=P.union("type",{jwks:tur,static:rur}).transform({transform:e=>{switch(e.type){case"jwks":return bG.jwks(e);case"static":return bG.static(e);default:return e}},untransform:({_visit:e,...t})=>t});var TGe=P.enum_(["BASE64","HEX"]);var iur=P.enum_(["UNIX_SECONDS","UNIX_MILLIS","ISO8601"]);var OGe=P.objectWithoutOptionalProperties({headerName:Ms,format:iur,tolerance:P.number().optional()});var our=P.objectWithoutOptionalProperties({signatureHeaderName:Ms,algorithm:eur,encoding:TGe,signaturePrefix:P.string().optional(),keySource:nur,timestamp:OGe.optional()});var sur=P.enum_(["SHA256","SHA1","SHA384","SHA512"]);var aur=P.enum_(["ALPHABETICAL"]);var cur=P.enum_(["BODY","TIMESTAMP","NOTIFICATION_URL","MESSAGE_ID"]);var uur=P.objectWithoutOptionalProperties({components:P.list(cur),delimiter:P.string(),bodySort:aur.optional()});var lur=P.objectWithoutOptionalProperties({signatureHeaderName:Ms,algorithm:sur,encoding:TGe,signaturePrefix:P.string().optional(),payloadFormat:uur,timestamp:OGe.optional()});var pur=P.union("type",{hmac:lur,asymmetric:our}).transform({transform:e=>{switch(e.type){case"hmac":return IG.hmac(e);case"asymmetric":return IG.asymmetric(e);default:return e}},untransform:({_visit:e,...t})=>t});var fur=P.objectWithoutOptionalProperties({id:Eir,name:Kcr,displayName:P.string().optional(),method:Hcr,headers:P.list(bS),payload:Zcr,signatureVerification:pur.optional(),fileUploadPayload:hGe.optional(),responses:P.list($he).optional(),examples:P.list($cr).optional(),v2Examples:esr.optional()}).extend(xC);var dur=P.list(fur);var mur=P.union("type",{inlinedBody:uGe,reference:P.lazyObject(()=>Jc)}).transform({transform:e=>{switch(e.type){case"inlinedBody":return i6.inlinedBody(e);case"reference":return i6.reference(e);default:return e}},untransform:({_visit:e,...t})=>t});var PGe=P.string();var hur=P.objectWithoutOptionalProperties({type:PGe,body:mur});var gur=P.objectWithoutOptionalProperties({name:Oo.optional(),url:P.string(),pathParameters:P.list(Ghe),headers:P.list(CDe),queryParameters:P.list(cGe),messages:P.list(hur)}).extend(co);var Aur=P.objectWithoutOptionalProperties({name:Ms,valueType:P.lazy(()=>ma)}).extend(Lhe);var yur=P.objectWithoutOptionalProperties({name:Oo,extends:P.list(ey),properties:P.list(Aur)});var bur=P.objectWithoutOptionalProperties({bodyType:P.lazy(()=>ma)}).extend(co);var Eur=P.union("type",{inlinedBody:yur,reference:bur}).transform({transform:e=>{switch(e.type){case"inlinedBody":return eB.inlinedBody(e);case"reference":return eB.reference(e);default:return e}},untransform:({_visit:e,...t})=>t});var Iur=P.enum_(["client","server"]);var vur=P.objectWithoutOptionalProperties({type:PGe,displayName:P.string().optional(),methodName:P.string().optional(),origin:Iur,body:Eur}).extend(xC);var Cur=Oo;var wur=P.objectWithoutOptionalProperties({name:Cur,displayName:P.string().optional(),connectMethodName:P.string().optional(),baseUrl:nO.optional(),path:E3,auth:P.boolean(),headers:P.list(bS),queryParameters:P.list(Qhe),pathParameters:P.list(CG),messages:P.list(vur),examples:P.list(gur),v2Examples:nsr.optional()}).extend(xC);var xur=P.objectWithoutOptionalProperties({pointsTo:hH});var DGe=P.objectWithoutOptionalProperties({fernFilepath:y3,service:mH.optional(),types:P.list(rB),errors:P.list(Mhe),webhooks:qqe.optional(),websocket:Gqe.optional(),subpackages:P.list(hH),hasEndpointsInTree:P.boolean(),navigationConfig:xur.optional()}).extend(co);var Sur=P.objectWithoutOptionalProperties({title:P.string(),language:Whe,content:P.string()});var _ur=P.objectWithoutOptionalProperties({defaultEndpoint:Lse.optional(),bannerLink:P.string().optional(),introduction:P.string().optional(),apiReferenceLink:P.string().optional(),apiName:P.string().optional(),disabledFeatures:P.list(F_t).optional(),whiteLabel:P.boolean().optional(),features:P.record(F_t,P.list(Lse)).optional(),customSections:P.list(Sur).optional(),exampleStyle:$ar.optional()});var Bur=P.objectWithoutOptionalProperties({header:P.stringLiteral("User-Agent"),value:P.string()});var Tur=P.objectWithoutOptionalProperties({language:P.string(),sdkName:P.string(),sdkVersion:P.string(),userAgent:Bur.optional()});var Our=P.objectWithoutOptionalProperties({isAuthMandatory:P.boolean(),hasStreamingEndpoints:P.boolean(),hasPaginatedEndpoints:P.boolean(),hasFileDownloadEndpoints:P.boolean(),platformHeaders:Tur});var Pur=P.objectWithoutOptionalProperties({typesReferencedOnlyByService:P.record(mH,P.list(rB)),sharedTypes:P.list(rB)});var Dur=P.objectWithoutOptionalProperties({sources:P.list(Uar)});var Rur=P.objectWithoutOptionalProperties({name:Oo,displayName:jhe.optional()}).extend(DGe);var bqs=P.objectWithoutOptionalProperties({fdrApiDefinitionId:P.string().optional(),apiVersion:Var.optional(),apiName:Oo,apiDisplayName:P.string().optional(),apiDocs:P.string().optional(),auth:Air,headers:P.list(bS),idempotencyHeaders:P.list(bS),types:P.record(rB,Gcr),services:P.record(mH,jar),webhookGroups:P.record(qqe,dur),websocketChannels:P.record(Gqe,wur).optional(),errors:P.record(Mhe,Uor),subpackages:P.record(hH,Rur),rootPackage:DGe,constants:Iir,environments:Mor.optional(),basePath:E3.optional(),pathParameters:P.list(CG),errorDiscriminationStrategy:War,sdkConfig:Our,variables:P.list(Wcr),serviceTypeReferenceInfo:Pur,readmeConfig:_ur.optional(),sourceConfig:Dur.optional(),publishConfig:ocr.optional(),dynamic:Bor.optional(),selfHosted:P.boolean().optional(),audiences:P.list(Xnr).optional(),generationMetadata:Kar.optional(),apiPlayground:P.boolean().optional(),casingsConfig:qar.optional()});var VIi={};ne(VIi,{CsharpProtobufFileOptions:()=>Zsr,ProtobufFile:()=>gGe,ProtobufFileOptions:()=>ear,ProtobufMethodType:()=>iar,ProtobufService:()=>tar,ProtobufType:()=>ccr,UserDefinedProtobufType:()=>scr,WellKnownProtobufType:()=>acr});var qIi={};ne(qIi,{CratesPublishTarget:()=>Jar,DirectPublish:()=>rcr,Filesystem:()=>ncr,GithubPublish:()=>icr,GoPublishTarget:()=>Yar,MavenPublishTarget:()=>Xar,NpmPublishTarget:()=>Zar,PostmanPublishTarget:()=>ecr,PublishTarget:()=>Hhe,PublishingConfig:()=>ocr,PypiPublishTarget:()=>tcr});var GIi={};ne(GIi,{AliasTypeDeclaration:()=>Ncr,Base64Type:()=>pcr,BigIntegerType:()=>fcr,BooleanType:()=>dcr,ContainerType:()=>BGe,DateTimeRfc2822Type:()=>mcr,DateTimeType:()=>hcr,DateType:()=>gcr,DeclaredTypeName:()=>ey,DoubleType:()=>ycr,DoubleValidationRules:()=>Acr,Encoding:()=>wGe,EnumTypeDeclaration:()=>xGe,EnumTypeReference:()=>Eqs,EnumValue:()=>Use,ExampleAliasType:()=>kur,ExampleContainer:()=>Mur,ExampleDatetime:()=>Nur,ExampleDatetimeRfc2822:()=>Qur,ExampleEnumType:()=>Gur,ExampleExtraObjectProperty:()=>Wur,ExampleKeyValuePair:()=>$ur,ExampleListContainer:()=>Lur,ExampleLiteralContainer:()=>jur,ExampleMapContainer:()=>Uur,ExampleNamedType:()=>Hur,ExampleNullableContainer:()=>zur,ExampleObjectProperty:()=>FGe,ExampleObjectType:()=>kGe,ExampleObjectTypeWithTypeId:()=>Kur,ExampleOptionalContainer:()=>Vur,ExamplePrimitive:()=>RGe,ExampleSetContainer:()=>qur,ExampleSingleUnionType:()=>Jur,ExampleSingleUnionTypeProperties:()=>Yur,ExampleType:()=>j_t,ExampleTypeReference:()=>Jc,ExampleTypeReferenceShape:()=>Xur,ExampleTypeShape:()=>SGe,ExampleUndiscriminatedUnionType:()=>Zur,ExampleUnionBaseProperty:()=>tlr,ExampleUnionType:()=>elr,FloatType:()=>Ecr,FloatValidationRules:()=>bcr,IntegerType:()=>vcr,IntegerValidationRules:()=>Icr,JsonEncoding:()=>Nar,Literal:()=>AH,LongType:()=>wcr,LongValidationRules:()=>Ccr,MapType:()=>Fur,NamedType:()=>nlr,NamedTypeDefault:()=>rlr,ObjectProperty:()=>tB,ObjectPropertyAccess:()=>Nhe,ObjectTypeDeclaration:()=>Qcr,PrimitiveType:()=>_Ge,PrimitiveTypeV1:()=>lcr,PrimitiveTypeV2:()=>Dcr,ProtoEncoding:()=>Qar,ResolvedNamedType:()=>Fcr,ResolvedTypeReference:()=>kcr,ShapeType:()=>Rcr,SingleUnionType:()=>M_t,SingleUnionTypeProperties:()=>Ucr,SingleUnionTypeProperty:()=>Lcr,Source:()=>ucr,StringType:()=>Scr,StringValidationRules:()=>xcr,Type:()=>qcr,TypeDeclaration:()=>Gcr,TypeReference:()=>ma,Uint64Type:()=>Bcr,Uint64ValidationRules:()=>_cr,UintType:()=>Ocr,UintValidationRules:()=>Tcr,UndiscriminatedUnionMember:()=>jcr,UndiscriminatedUnionTypeDeclaration:()=>Mcr,UnionDiscriminatorContext:()=>zcr,UnionTypeDeclaration:()=>Vcr,UuidType:()=>Pcr});var BGe=P.union(P.discriminant("type","_type"),{list:P.object({list:P.lazy(()=>ma)}),map:P.lazyObject(()=>Fur),nullable:P.object({nullable:P.lazy(()=>ma)}),optional:P.object({optional:P.lazy(()=>ma)}),set:P.object({set:P.lazy(()=>ma)}),literal:P.object({literal:AH})}).transform({transform:e=>{switch(e.type){case"list":return js.list(e.list);case"map":return js.map(e);case"nullable":return js.nullable(e.nullable);case"optional":return js.optional(e.optional);case"set":return js.set(e.set);case"literal":return js.literal(e.literal);default:return e}},untransform:({_visit:e,...t})=>t});var Eqs=P.objectWithoutOptionalProperties({default:Use.optional(),name:ey});var kur=P.objectWithoutOptionalProperties({value:P.lazyObject(()=>Jc)});var Nur=P.objectWithoutOptionalProperties({datetime:P.date(),raw:P.string().optional()});var Qur=P.objectWithoutOptionalProperties({datetime:P.date(),raw:P.string().optional()});var RGe=P.union("type",{integer:P.object({integer:P.number()}),long:P.object({long:P.number()}),uint:P.object({uint:P.number()}),uint64:P.object({uint64:P.number()}),float:P.object({float:P.number()}),double:P.object({double:P.number()}),boolean:P.object({boolean:P.boolean()}),string:P.object({string:bir}),date:P.object({date:P.string()}),datetime:Nur,datetimeRfc2822:Qur,uuid:P.object({uuid:P.string()}),base64:P.object({base64:P.string()}),bigInteger:P.object({bigInteger:P.string()})}).transform({transform:e=>{switch(e.type){case"integer":return Bi.integer(e.integer);case"long":return Bi.long(e.long);case"uint":return Bi.uint(e.uint);case"uint64":return Bi.uint64(e.uint64);case"float":return Bi.float(e.float);case"double":return Bi.double(e.double);case"boolean":return Bi.boolean(e.boolean);case"string":return Bi.string(e.string);case"date":return Bi.date(e.date);case"datetime":return Bi.datetime(e);case"datetimeRfc2822":return Bi.datetimeRfc2822(e);case"uuid":return Bi.uuid(e.uuid);case"base64":return Bi.base64(e.base64);case"bigInteger":return Bi.bigInteger(e.bigInteger);default:return e}},untransform:({_visit:e,...t})=>t});var jur=P.objectWithoutOptionalProperties({literal:RGe});var Mur=P.union("type",{list:P.lazyObject(()=>Lur),set:P.lazyObject(()=>qur),optional:P.lazyObject(()=>Vur),nullable:P.lazyObject(()=>zur),map:P.lazyObject(()=>Uur),literal:jur}).transform({transform:e=>{switch(e.type){case"list":return Al.list(e);case"set":return Al.set(e);case"optional":return Al.optional(e);case"nullable":return Al.nullable(e);case"map":return Al.map(e);case"literal":return Al.literal(e);default:return e}},untransform:({_visit:e,...t})=>t});var Gur=P.objectWithoutOptionalProperties({value:Ms});var Wur=P.objectWithoutOptionalProperties({name:Ms,value:P.lazyObject(()=>Jc)});var $ur=P.objectWithoutOptionalProperties({key:P.lazyObject(()=>Jc),value:P.lazyObject(()=>Jc)});var Lur=P.objectWithoutOptionalProperties({list:P.list(P.lazyObject(()=>Jc)),itemType:P.lazy(()=>ma)});var Uur=P.objectWithoutOptionalProperties({map:P.list(P.lazyObject(()=>$ur)),keyType:P.lazy(()=>ma),valueType:P.lazy(()=>ma)});var Hur=P.objectWithoutOptionalProperties({typeName:ey,shape:P.lazy(()=>SGe)});var zur=P.objectWithoutOptionalProperties({nullable:P.lazyObject(()=>Jc).optional(),valueType:P.lazy(()=>ma)});var FGe=P.objectWithoutOptionalProperties({name:Ms,value:P.lazyObject(()=>Jc),propertyAccess:Nhe.optional(),originalTypeDeclaration:ey});var kGe=P.objectWithoutOptionalProperties({properties:P.list(P.lazyObject(()=>FGe)),extraProperties:P.list(P.lazyObject(()=>Wur)).optional()});var Kur=P.objectWithoutOptionalProperties({typeId:rB,object:P.lazyObject(()=>kGe)});var Vur=P.objectWithoutOptionalProperties({optional:P.lazyObject(()=>Jc).optional(),valueType:P.lazy(()=>ma)});var qur=P.objectWithoutOptionalProperties({set:P.list(P.lazyObject(()=>Jc)),itemType:P.lazy(()=>ma)});var Jur=P.objectWithoutOptionalProperties({wireDiscriminantValue:Ms,shape:P.lazy(()=>Yur)});var Yur=P.union("type",{samePropertiesAsObject:P.lazyObject(()=>Kur),singleProperty:P.lazyObject(()=>Jc),noProperties:P.object({})}).transform({transform:e=>{switch(e.type){case"samePropertiesAsObject":return dH.samePropertiesAsObject(e);case"singleProperty":return dH.singleProperty(e);case"noProperties":return dH.noProperties();default:return e}},untransform:({_visit:e,...t})=>t});var Jc=P.objectWithoutOptionalProperties({shape:P.lazy(()=>Xur)}).extend(yH);var Xur=P.union("type",{primitive:P.object({primitive:RGe}),container:P.object({container:P.lazy(()=>Mur)}),unknown:P.object({unknown:P.unknown()}),named:P.lazyObject(()=>Hur)}).transform({transform:e=>{switch(e.type){case"primitive":return mo.primitive(e.primitive);case"container":return mo.container(e.container);case"unknown":return mo.unknown(e.unknown);case"named":return mo.named(e);default:return e}},untransform:({_visit:e,...t})=>t});var SGe=P.union("type",{alias:P.lazyObject(()=>kur),enum:Gur,object:P.lazyObject(()=>kGe),union:P.lazyObject(()=>elr),undiscriminatedUnion:P.lazyObject(()=>Zur)}).transform({transform:e=>{switch(e.type){case"alias":return Uu.alias(e);case"enum":return Uu.enum(e);case"object":return Uu.object(e);case"union":return Uu.union(e);case"undiscriminatedUnion":return Uu.undiscriminatedUnion(e);default:return e}},untransform:({_visit:e,...t})=>t});var Zur=P.objectWithoutOptionalProperties({index:P.number(),singleUnionType:P.lazyObject(()=>Jc)});var tlr=P.objectWithoutOptionalProperties({name:Ms,value:P.lazyObject(()=>Jc)});var elr=P.objectWithoutOptionalProperties({discriminant:Ms,singleUnionType:P.lazyObject(()=>Jur),extendProperties:P.list(P.lazyObject(()=>FGe)).optional(),baseProperties:P.list(P.lazyObject(()=>tlr)).optional()});var Fur=P.objectWithoutOptionalProperties({keyType:P.lazy(()=>ma),valueType:P.lazy(()=>ma)});var rlr=P.union("type",{enum:Use}).transform({transform:e=>e.type==="enum"?kqe.enum(e):e,untransform:({_visit:e,...t})=>t});var nlr=P.objectWithoutOptionalProperties({typeId:rB,fernFilepath:y3,name:Oo,displayName:jhe.optional(),default:rlr.optional(),inline:P.boolean().optional()});var ma=P.union(P.discriminant("type","_type"),{container:P.object({container:P.lazy(()=>BGe)}),named:nlr,primitive:P.object({primitive:_Ge}),unknown:P.object({})}).transform({transform:e=>{switch(e.type){case"container":return jr.container(e.container);case"named":return jr.named(e);case"primitive":return jr.primitive(e.primitive);case"unknown":return jr.unknown();default:return e}},untransform:({_visit:e,...t})=>t});var WIi={};ne(WIi,{VariableDeclaration:()=>Wcr,VariableId:()=>vGe});var $Ii={};ne($Ii,{AsymmetricAlgorithm:()=>eur,AsymmetricKeySignatureVerification:()=>our,AsymmetricKeySource:()=>nur,ExampleWebhookCall:()=>$cr,HmacAlgorithm:()=>sur,HmacSignatureVerification:()=>lur,InlinedWebhookPayload:()=>Ycr,InlinedWebhookPayloadProperty:()=>Jcr,JwksKeySource:()=>tur,StaticKeySource:()=>rur,Webhook:()=>fur,WebhookGroup:()=>dur,WebhookHttpMethod:()=>Hcr,WebhookName:()=>Kcr,WebhookPayload:()=>Zcr,WebhookPayloadBodySort:()=>aur,WebhookPayloadComponent:()=>cur,WebhookPayloadFormat:()=>uur,WebhookPayloadReference:()=>Xcr,WebhookSignatureEncoding:()=>TGe,WebhookSignatureVerification:()=>pur,WebhookTimestampConfig:()=>OGe,WebhookTimestampFormat:()=>iur});var HIi={};ne(HIi,{ExampleWebSocketMessage:()=>hur,ExampleWebSocketMessageBody:()=>mur,ExampleWebSocketSession:()=>gur,InlinedWebSocketMessageBody:()=>yur,InlinedWebSocketMessageBodyProperty:()=>Aur,WebSocketChannel:()=>wur,WebSocketMessage:()=>vur,WebSocketMessageBody:()=>Eur,WebSocketMessageBodyReference:()=>bur,WebSocketMessageId:()=>PGe,WebSocketMessageOrigin:()=>Iur,WebSocketName:()=>Cur});var iO={integer:"integer",long:"long",uint:"uint",uint64:"uint64",float:"float",double:"double",boolean:"boolean",string:"string",datetime:"datetime",datetimeRfc2822:"datetime-rfc-2822",base64:"base64",uuid:"uuid",date:"date",bigint:"bigint",unknown:"unknown"};var Nk={MAP:/^map<\s*([^,]*)\s*,\s*(.*)\s*>$/,LIST:/^list<\s*(.*)\s*>$/,SET:/^set<\s*(.*)\s*>$/,OPTIONAL:/^optional<\s*(.*)\s*>$/,NULLABLE:/^nullable<\s*(.*)\s*>$/,LITERAL:/^literal<\s*(?:"(.*)"|(true|false))\s*>$/};function wDe({type:e,_default:t,validation:r,visitor:n}){switch(e){case iO.integer:{let l=r??void 0;return n.primitive({v1:fs.Integer,v2:ti.integer({default:t??void 0,validation:l!=null?{min:l.min,max:l.max,exclusiveMin:l.exclusiveMin,exclusiveMax:l.exclusiveMax,multipleOf:l.multipleOf}:void 0})})}case iO.double:{let l=r??void 0;return n.primitive({v1:fs.Double,v2:ti.double({default:t??void 0,validation:l!=null?{min:l.min,max:l.max,exclusiveMin:l.exclusiveMin,exclusiveMax:l.exclusiveMax,multipleOf:l.multipleOf}:void 0})})}case iO.string:{let l=r??void 0;return n.primitive({v1:fs.String,v2:ti.string({default:t??void 0,validation:l!=null?{format:l.format,pattern:l.pattern,minLength:l.minLength,maxLength:l.maxLength}:void 0})})}case iO.float:return n.primitive({v1:fs.Float,v2:void 0});case iO.long:{let l=r??void 0;return n.primitive({v1:fs.Long,v2:ti.long({default:t??void 0,validation:l!=null?{min:l.min,max:l.max,exclusiveMin:l.exclusiveMin,exclusiveMax:l.exclusiveMax,multipleOf:l.multipleOf}:void 0})})}case iO.boolean:return n.primitive({v1:fs.Boolean,v2:ti.boolean({default:t??void 0})});case iO.datetime:return n.primitive({v1:fs.DateTime,v2:void 0});case iO.datetimeRfc2822:return n.primitive({v1:fs.DateTimeRfc2822,v2:ti.dateTimeRfc2822({})});case iO.date:return n.primitive({v1:fs.Date,v2:void 0});case iO.uuid:return n.primitive({v1:fs.Uuid,v2:void 0});case iO.base64:return n.primitive({v1:fs.Base64,v2:void 0});case iO.bigint:return n.primitive({v1:fs.BigInteger,v2:ti.bigInteger({default:t??void 0})});case iO.uint:return n.primitive({v1:fs.Uint,v2:void 0});case iO.uint64:return n.primitive({v1:fs.Uint64,v2:void 0});case iO.unknown:return n.unknown()}let i=e.match(Nk.MAP);if(i?.[1]!=null&&i[2]!=null)return n.map({keyType:i[1],valueType:i[2]});let o=e.match(Nk.LIST);if(o?.[1]!=null)return n.list(o[1]);let s=e.match(Nk.SET);if(s?.[1]!=null)return n.set(s[1]);let a=e.match(Nk.OPTIONAL);if(a?.[1]!=null)return n.optional(a[1]);let c=e.match(Nk.NULLABLE);if(c?.[1]!=null)return n.nullable(c[1]);let u=e.match(Nk.LITERAL);if(u?.[1]!=null)return n.literal(tv.string(u[1]));if(u?.[2]!=null){let l=u[2];switch(l){case"false":return n.literal(tv.boolean(!1));case"true":return n.literal(tv.boolean(!0));default:throw new Error(`Unsupported literal value: ${l}`)}}return n.named(e)}var Iqs="bytes";function I3(e){if(e===Iqs)return{isOptional:!1};if(e.match(Nk.OPTIONAL)?.[1]===Iqs)return{isOptional:!0}}function L_t(e){let t=typeof e=="string"?e:typeof e.body=="string"?e.body:void 0;if(t!=null)return I3(t)}jt();function JIi({input:e,typeName:t}){for(let r of e.arguments)if(typeof r=="string"){if(r===t)return!0}else if(JIi({input:r,typeName:t}))return!0;return!1}function vqs(e){return JIi({input:e,typeName:"file"})}function Cqs(e){let t=0,r=0;function n(){for(;t<e.length&&/\s/.test(e[t]);)t++;if(t>=e.length)return;let o="";for(;t<e.length&&e[t]!=="<"&&e[t]!==","&&e[t]!==">";)o+=e[t++];if(o.trim()){for(;t<e.length&&/\s/.test(e[t]);)t++;if(t<e.length&&e[t]==="<"){if(t++,r++,r>128)throw new Error("Internal error; Exceeded maximum recursion depth while parsing generics.");let s={name:o.trim(),arguments:[]};for(;t<e.length&&e[t]!==">";){for(;t<e.length&&/[\s,]/.test(e[t]);)t++;if(t<e.length&&e[t]!==">"){let a=n();a&&s.arguments.push(a)}}if(t<e.length&&e[t]===">")t++,r--;else throw new Error("Malformed input: missing closing '>' for generic arguments.");return s}else return o.trim()}}let i=n();if(typeof i=="object")return i}var YIi="file";function wqs(e){return e.match(Nk.LIST)?.[1]===YIi}function Qk(e){if(e===YIi)return{isOptional:!1,isArray:!1};let t=e.match(Nk.OPTIONAL);if(t?.[1]!==void 0){if(t[1]===YIi)return{isOptional:!0,isArray:!1};if(wqs(t[1]))return{isOptional:!0,isArray:!0}}if(wqs(e))return{isOptional:!1,isArray:!0}}function $zl(e){return typeof e=="string"?!1:Vf.parse(e["content-type"])?.isMultiPartFormData()??!1?!0:e.body==null?!1:!!(gg(e.body)&&Object.values(e.body.properties??[]).some(Kzl))}function xDe(e){if(!(!$zl(e)||e.body==null)&&e.name!=null&&e.body!=null&&gg(e.body))return Hzl(e.name,e.body)}function Hzl(e,t){let r=Object.entries(t.properties??[]).reduce((n,[i,o])=>{let s=typeof o!="string"?o.docs:void 0,a=typeof o!="string"?o["content-type"]:void 0,c=typeof o!="string"?o.style:void 0,u=Qk(typeof o=="string"?o:o.type);return u!=null?n.push({isFile:!0,key:i,docs:s,isOptional:u.isOptional,isArray:u.isArray,contentType:a,style:c}):n.push({isFile:!1,key:i,propertyType:o,docs:s,contentType:a,style:c}),n},[]);return t["extra-properties"],{name:e,extends:t.extends,properties:r}}function Kzl(e){let t=typeof e=="string"?e:e.type;if(t==="file")return!0;if(!t.includes("file"))return!1;let r=Cqs(t);return r==null?!1:vqs(r)}var xqs="text";function SDe(e){if(e===xqs)return{isOptional:!1};if(e.match(Nk.OPTIONAL)?.[1]===xqs)return{isOptional:!0}}function rv({type:e,_default:t,validation:r,visitor:n}){return wDe({type:e,_default:t,validation:r,visitor:{primitive:n.primitive,map:({keyType:i,valueType:o})=>n.map({keyType:rv({type:i,_default:void 0,validation:void 0,visitor:n}),valueType:rv({type:o,_default:void 0,validation:void 0,visitor:n})}),list:i=>n.list(rv({type:i,_default:void 0,validation:void 0,visitor:n})),set:i=>n.set(rv({type:i,_default:void 0,validation:void 0,visitor:n})),optional:i=>n.optional(rv({type:i,_default:t,validation:r,visitor:n})),nullable:i=>n.nullable(rv({type:i,_default:t,validation:r,visitor:n})),literal:n.literal,named:n.named,unknown:n.unknown}})}jt();function XIi(e,t){if(Jzl(e))return t.sdk(e);if(Yzl(e))return t.language(e);Ce(e)}function Jzl(e){return e.sdk!=null}function Yzl(e){return e.language!=null}function Sqs(e){return e["response-stream"]!=null&&(typeof e["response-stream"]=="string"||e["response-stream"].format==null||e["response-stream"].format==="json")}function _qs(e){return e["response-stream"]!=null&&typeof e["response-stream"]!="string"&&e["response-stream"].format==="sse"}function _De(e,t,r){return Xzl(e,t)?r.stream(t):Zzl(e,t)?r.events(t):r.body(t)}function Xzl(e,t){return t.stream!==void 0&&Sqs(e)}function Zzl(e,t){return t.stream!==void 0&&_qs(e)}jt();function BDe(e,t){if(Bqs(e))return t.single(e);if(Tqs(e))return t.any(e);if(eVl(e))return t.endpointSecurity(e);Ce(e)}function Bqs(e){return typeof e=="string"||e.scheme!=null}function Tqs(e){let[t,...r]=Object.keys(e);return t==="any"&&r.length===0}function eVl(e){let[t,...r]=Object.keys(e);return t==="endpoint-security"&&r.length===0}jt();function TDe(e,t){if(Oqs(e))return t.header(e);switch(e.scheme){case"basic":return t.basic(e);case"bearer":return"get-token"in e?t.inferredBearer(e):t.tokenBearer(e);case"oauth":return t.oauth(e);default:Ce(e)}}function Oqs(e){return e.header!=null}jt();function CH(e,t){if(Pqs(e))return t.singleBaseUrl(e);if(oO(e))return t.multipleBaseUrls(e);Ce(e)}function Pqs(e){return typeof e=="string"||"url"in e}function oO(e){return typeof e!="string"&&"urls"in e}function NGe(e){return typeof e=="string"?e.startsWith("$"):"variable"in e}jt();function nv(e,t){if(Khe(e))return t.alias(e);if(v3(e))return t.discriminatedUnion(e);if(sf(e))return t.object(e);if(QGe(e))return t.undiscriminatedUnion(e);if(wG(e))return t.enum(e);Ce(e)}function Khe(e){return typeof e=="string"||e.type!=null}function sf(e){return e.extends!=null||e.properties!=null}function v3(e){return e.union!=null&&e.discriminated==null}function QGe(e){let t=e;return t.union!=null&&t.discriminated!=null}function wG(e){return e.enum!=null}function yg(e,t){return r=>{r!=null&&e.docs?.(r,[...t,"docs"])}}jt();function tVl(e){if(!e.startsWith("$"))return!1;let t=e.split(".");if(t.length<2||t.length>3)return!1;let r=t[0]?.slice("$".length);if(!r||!Dqs(r))return!1;if(t.length===3){let n=t[1];if(!n||!Dqs(n))return!1}return!0}function Dqs(e){if(e.length===0)return!1;let t=e.charAt(0);return t>="a"&&t<="z"||t>="A"&&t<="Z"}function C3({example:e,visitor:t,nodePath:r}){if(typeof e=="string")tVl(e)&&t.exampleTypeReference?.(e,r);else if(Lo(e))for(let n of Object.values(e))C3({example:n,visitor:t,nodePath:r});else if(Array.isArray(e))for(let n of e)C3({example:n,visitor:t,nodePath:r})}function xG(e){return(t,r,{_default:n,validation:i,location:o}={})=>{e.typeReference?.({typeReference:t,_default:n,validation:i,location:o,nodePath:r},r)}}function Rqs({service:e,visitor:t,nodePath:r}){t.httpService?.(e,r),_p(e,{url:n=>{t.serviceBaseUrl?.(n,[...r,"url"])},"base-path":bt,"display-name":bt,availability:bt,headers:n=>{Fqs({headers:n,visitor:t,nodePath:[...r,"headers"]})},audiences:bt,auth:bt,"path-parameters":n=>{U_t({pathParameters:n,visitor:t,nodePath:[...r,"path-parameters"]})},endpoints:n=>{for(let[i,o]of Object.entries(n)){let s=[...r,"endpoints",i];rVl({endpointId:i,endpoint:o,service:e,visitor:t,nodePathForEndpoint:s})}},idempotent:bt,transport:bt,source:bt})}function rVl({endpointId:e,endpoint:t,service:r,visitor:n,nodePathForEndpoint:i}){let o=xG(n);n.httpEndpoint?.({endpointId:e,endpoint:t,service:r},i),_p(t,{docs:yg(n,i),"display-name":bt,availability:bt,"base-path":bt,path:bt,idempotent:bt,url:s=>{n.endpointBaseUrl?.({baseUrl:s,service:r},[...i,"url"])},"path-parameters":s=>{U_t({pathParameters:s,visitor:n,nodePath:[...i,"path-parameters"]})},request:s=>{if(s==null)return;let a=[...i,"request"];if(typeof s=="string"){o(s,a,{location:"requestReference"});return}_p(s,{name:bt,docs:yg(n,a),"path-parameters":c=>{U_t({pathParameters:c,visitor:n,nodePath:[...a,"path-parameters"]})},"query-parameters":c=>{if(c!=null)for(let[u,l]of Object.entries(c)){let p=[...a,"query-parameters",u];n.queryParameter?.({queryParameterKey:u,queryParameter:l},p),typeof l=="string"?o(l,p):_p(l,{name:bt,docs:yg(n,p),availability:bt,type:d=>{o(d,[...p,"type"],{_default:l.default,validation:l.validation})},"allow-multiple":bt,explode:bt,audiences:bt,encoding:bt,default:bt,"client-default":bt,validation:bt})}},"content-type":bt,headers:c=>{Fqs({headers:c,visitor:n,nodePath:[...a,"headers"]})},body:c=>{if(c==null)return;let u=[...a,"body"];typeof c=="string"?o(c,u,{location:"requestReference"}):gg(c)?(n.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:c},u),_p(c,{extends:l=>{if(l==null)return;let p=typeof l=="string"?[l]:l;for(let d of p){let f=[...u,"extends",d];n.extension?.(d,f),o(d,f)}},properties:l=>{if(l!=null)for(let[p,d]of Object.entries(l)){let f=[...u,"properties",p];typeof d=="string"?o(d,f,{location:uS.InlinedRequestProperty}):_p(d,{name:bt,docs:yg(n,f),availability:bt,type:m=>{o(m,[...f,"type"],{location:uS.InlinedRequestProperty,_default:d.default,validation:d.validation})},style:bt,"content-type":bt,audiences:bt,encoding:bt,default:bt,"client-default":bt,validation:bt})}},"extra-properties":bt})):(yg(n,u)(c.docs),o(c.type,u))}})},audiences:bt,method:bt,auth:bt,"stream-condition":s=>{n.streamCondition?.({streamCondition:s,endpoint:t},[...i,"stream-condition"])},"response-stream":s=>{s!=null&&(typeof s=="string"?o(s,[...i,"response-stream"],{location:uS.StreamingResponse}):o(s.type,[...i,"response-stream"],{location:uS.StreamingResponse}))},response:s=>{if(s==null)return;let a=[...i,"response"];typeof s=="string"?o(s,a,{location:uS.Response}):_p(s,{docs:yg(n,a),type:c=>{c!=null&&o(c,[...a,"type"],{location:uS.Response})},property:bt,"status-code":bt})},errors:s=>{if(s!=null)for(let a of s){let c=[...i,"errors",typeof a=="string"?a:a.error];typeof a=="string"?n.errorReference?.(a,c):_p(a,{docs:yg(n,c),error:u=>{n.errorReference?.(u,[...c,"error"])}})}},examples:s=>{if(s!=null)for(let[a,c]of s.entries())nVl({nodePathForExample:[...i,{key:"examples",arrayIndex:a}],visitor:n,service:r,endpoint:t,example:c})},pagination:bt,source:bt,transport:bt,retries:bt})}function nVl({nodePathForExample:e,visitor:t,service:r,endpoint:n,example:i}){if(i.headers==null&&i["path-parameters"]==null&&i["query-parameters"]==null&&i.request==null&&i.response==null&&i["code-samples"]!=null)return;t.exampleHttpEndpointCall?.({service:r,endpoint:n,example:i},e);let o=[...e,"headers"];if(t.exampleHeaders?.({service:r,endpoint:n,examples:i.headers},o),i.headers!=null)for(let l of Object.values(i.headers))C3({example:l,visitor:t,nodePath:o});let s=[...e,"path-parameters"];if(t.examplePathParameters?.({service:r,endpoint:n,examples:i["path-parameters"]},s),i["path-parameters"]!=null)for(let l of Object.values(i["path-parameters"]))C3({example:l,visitor:t,nodePath:s});let a=[...e,"query-parameters"];if(t.exampleQueryParameters?.({service:r,endpoint:n,examples:i["query-parameters"]},a),i["query-parameters"]!=null)for(let l of Object.values(i["query-parameters"]))C3({example:l,visitor:t,nodePath:a});let c=[...e,"request"];t.exampleRequest?.({service:r,endpoint:n,example:i.request},c),i.request!=null&&C3({example:i.request,visitor:t,nodePath:c});let u=[...e,"response"];if(t.exampleResponse?.({service:r,endpoint:n,example:i.response},u),i.response!=null&&_De(n,i.response,{body:l=>{l.body!=null&&C3({example:l.body,visitor:t,nodePath:u}),l.error!=null&&t.errorReference?.(l.error,[...u,"error"])},stream:l=>{for(let p of l.stream)C3({example:p,visitor:t,nodePath:u})},events:l=>{for(let{data:p}of l.stream)C3({example:p,visitor:t,nodePath:u})}}),i["code-samples"]!=null)for(let[l,p]of i["code-samples"].entries())t.exampleCodeSample?.({service:r,endpoint:n,example:i,sample:p},[...e,{key:"code-samples",arrayIndex:l}])}function U_t({pathParameters:e,visitor:t,nodePath:r}){if(e==null)return;let n=xG(t);for(let[i,o]of Object.entries(e)){let s=[...r,i];t.pathParameter?.({pathParameterKey:i,pathParameter:o},s),NGe(o)?typeof o=="string"?t.variableReference?.(o,s):_p(o,{docs:yg(t,s),variable:a=>t.variableReference?.(a,[...s,"variable"]),availability:bt}):typeof o=="string"?n(o,s):_p(o,{docs:yg(t,s),type:a=>{n(a,[...s,"type"],{_default:o.default,validation:o.validation})},availability:bt,encoding:bt,default:bt,"client-default":bt,validation:bt,name:bt,audiences:bt})}}function Fqs({headers:e,visitor:t,nodePath:r}){if(e==null)return;let n=xG(t);for(let[i,o]of Object.entries(e)){let s=[...r,i];t.header?.({headerKey:i,header:o},s),typeof o=="string"?n(o,s):_p(o,{name:bt,availability:bt,type:a=>{n(a,s,{_default:o.default,validation:o.validation})},docs:yg(t,s),audiences:bt,encoding:bt,env:bt,default:bt,"client-default":bt,validation:bt})}}jt();jt();function kqs({typeDeclarations:e,visitor:t,nodePath:r}){if(e!=null)for(let[n,i]of Object.entries(e)){let o=[...r,n];t.typeName?.(n,o),ZIi({typeName:n,declaration:i,visitor:t,nodePathForType:o})}}function ZIi({typeName:e,declaration:t,visitor:r,nodePathForType:n}){let i=xG(r);r.typeDeclaration?.({typeName:{isInlined:!1,name:e},declaration:t,nodePath:n},n);let o=s=>{if(s!=null)for(let[a,c]of s.entries()){let u=[...n,{key:"examples",arrayIndex:a}];r.exampleType?.({typeName:e,typeDeclaration:t,example:c},u),C3({example:c.value,nodePath:u,visitor:r})}};nv(t,{alias:s=>{typeof s=="string"?i(s,n):_p(s,{type:a=>{i(a,[...n,"type"])},docs:yg(r,n),availability:bt,audiences:bt,examples:o,validation:bt,encoding:bt,source:bt,inline:bt})},object:s=>{_p(s,{docs:yg(r,n),extends:a=>{if(a==null)return;let c=typeof a=="string"?[a]:a;for(let u of c){let l=[...n,"extends",u];r.extension?.(u,l),i(u,l)}},properties:a=>{if(a!=null)for(let[c,u]of Object.entries(a)){let l=[...n,"properties",c];typeof u=="string"?i(u,l):_p(u,{name:bt,docs:yg(r,l),availability:bt,type:p=>{i(p,[...l,"type"],{_default:u.default,validation:u.validation})},audiences:bt,encoding:bt,default:bt,"client-default":bt,validation:bt,access:bt})}},"extra-properties":bt,availability:bt,audiences:bt,encoding:bt,source:bt,examples:o,inline:bt})},discriminatedUnion:s=>{_p(s,{docs:yg(r,n),discriminant:bt,extends:a=>{if(a==null)return;let c=typeof a=="string"?[a]:a;for(let u of c){let l=[...n,"extends",u];r.extension?.(u,l),i(u,l)}},union:a=>{for(let[c,u]of Object.entries(a)){let l=[...n,"union",c];typeof u=="string"?i(u,l):_p(u,{docs:yg(r,l),name:bt,key:bt,type:p=>{typeof p=="string"&&i(p,[...n,"type"])},"display-name":bt,availability:bt,validation:bt})}},"base-properties":bt,"default-variant":bt,availability:bt,audiences:bt,encoding:bt,source:bt,examples:o,inline:bt})},undiscriminatedUnion:s=>{_p(s,{docs:yg(r,n),discriminated:bt,"base-properties":bt,union:a=>{for(let[c,u]of a.entries()){let l=[...n,`union[${c}]`];typeof u!="string"&&_p(u,{docs:yg(r,l),type:p=>{i(p,[...n,"type"])},"display-name":bt,validation:bt})}},availability:bt,audiences:bt,encoding:bt,source:bt,examples:o,inline:bt})},enum:s=>{_p(s,{docs:yg(r,n),enum:a=>{for(let c of a){let u=[...n,typeof c=="string"?c:c.name??c.value];typeof c!="string"&&_p(c,{docs:yg(r,u),name:bt,value:bt,casing:bt})}},availability:bt,audiences:bt,default:bt,encoding:bt,source:bt,examples:o,inline:bt,"forward-compatible":bt})}})}function Nqs({errorDeclarations:e,visitor:t,nodePath:r}){if(e!=null)for(let[n,i]of Object.entries(e)){let o=[...r,n];t.errorDeclaration?.({errorName:n,declaration:i},o),iVl({errorName:n,declaration:i,visitor:t,nodePathForError:o})}}function iVl({errorName:e,declaration:t,visitor:r,nodePathForError:n}){let i=xG(r);typeof t=="string"?i(t,n):_p(t,{docs:yg(r,n),"status-code":bt,type:o=>{if(o==null)return;let s=[...n,"type"];typeof o=="string"?i(o,s):ZIi({typeName:e,declaration:o,visitor:r,nodePathForType:s})},examples:o=>{if(o!=null)for(let s of o){let a=[...n,"type"];r.exampleError?.({errorName:e,declaration:t,example:s},a)}}})}function Qqs({imports:e,visitor:t,nodePath:r}){if(e!=null)for(let[n,i]of Object.entries(e))t.import?.({importPath:i,importedAs:n},[...r,n])}jt();function jqs({webhook:e,visitor:t,nodePathForWebhook:r}){let n=xG(t);_p(e,{"display-name":bt,method:bt,examples:bt,headers:i=>{oVl({headers:i,visitor:t,nodePath:[...r,"headers"]})},payload:i=>{let o=[...r,"payload"];if(typeof i=="string"){n(i,o,{location:"requestReference"});return}if(sVl(i)){n(i.type,[...o,"type"],{location:"requestReference"});return}let s=[...o];t.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:i},s),_p(i,{name:bt,extends:a=>{if(a==null)return;let c=typeof a=="string"?[a]:a;for(let u of c){let l=[...s,"extends",u];t.extension?.(u,l),n(u,l)}},properties:a=>{if(a!=null)for(let[c,u]of Object.entries(a)){let l=[...s,"properties",c];typeof u=="string"?n(u,l,{location:uS.InlinedRequestProperty}):_p(u,{name:bt,docs:yg(t,l),availability:bt,type:p=>{n(p,[...l,"type"],{_default:u.default,validation:u.validation,location:uS.InlinedRequestProperty})},audiences:bt,encoding:bt,default:bt,"client-default":bt,validation:bt,access:bt})}}})},signature:i=>{i!=null&&t.webhookSignature?.(i,[...r,"signature"])},response:bt,"response-stream":bt,audiences:bt,availability:bt,docs:yg(t,r)})}function oVl({headers:e,visitor:t,nodePath:r}){if(e==null)return;let n=xG(t);for(let[i,o]of Object.entries(e)){let s=[...r,i];t.header?.({headerKey:i,header:o},s),typeof o=="string"?n(o,s):_p(o,{name:bt,availability:bt,type:a=>{n(a,s,{_default:o.default,validation:o.validation})},docs:yg(t,s),audiences:bt,encoding:bt,env:bt,default:bt,"client-default":bt,validation:bt})}}function sVl(e){return e.type!=null}function nB(e,t){_p(e,{docs:yg(t,[]),imports:r=>{Qqs({imports:r,visitor:t,nodePath:["imports"]})},types:r=>{kqs({typeDeclarations:r,visitor:t,nodePath:["types"]})},service:r=>{r!=null&&Rqs({service:r,visitor:t,nodePath:["service"]})},webhooks:r=>{for(let[n,i]of Object.entries(r??{}))jqs({webhook:i,visitor:t,nodePathForWebhook:["webhooks",n]})},"webhook-signature":r=>{r!=null&&t.webhookSignature?.(r,["webhook-signature"])},channel:bt,errors:r=>{Nqs({errorDeclarations:r,visitor:t,nodePath:["errors"]})}})}jt();function evi(e,t){_p(e,{docs:bt,imports:bt,types:bt,service:bt,webhooks:bt,"webhook-signature":bt,errors:bt,channel:bt,export:r=>{t.export?.(typeof r=="string"?r:r?.dependency,["export"])},navigation:r=>{t.navigation?.(r,["navigation"])}})}jt();function tvi(e,t){t.file?.(e,[]),_p(e,{version:bt,product:bt,name:bt,"default-url":bt,"display-name":bt,imports:bt,auth:bt,"idempotency-headers":bt,"auth-schemes":r=>Object.entries(r??{}).map(([n,i])=>{KEi(i)&&t.oauth?.({name:n,oauth:i},["auth-scheme",n])}),pagination:bt,"default-environment":r=>{t.defaultEnvironment?.(r,["default-environment"])},docs:bt,headers:bt,environments:r=>{if(r!=null)for(let[n,i]of Object.entries(r))t.environment?.({environmentId:n,environment:i},["environments",n])},"error-discrimination":r=>{t.errorDiscrimination?.(r,["error-discrimination"])},audiences:bt,errors:r=>{if(r!=null)for(let n of r)t.errorReference?.(n,["errors",n])},"base-path":bt,"path-parameters":r=>{U_t({pathParameters:r,visitor:t,nodePath:["path-parameters"]})},variables:r=>{if(r!=null)for(let[n,i]of Object.entries(r))t.variableDeclaration?.({variableId:n,variable:i},["variables",n])}})}var ilr=new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$");var SG=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:n,absoluteFilePath:i,changelog:o}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=n,this.absoluteFilePath=i,this.changelog=o}};jt();function jGe(e){if(typeof e.raw?.output=="object"&&e.raw?.output!==null){let t=e.raw.output["package-name"];if(t!=null)return t;let r=e.raw.output.coordinate;if(r!=null)return r}if(typeof e.raw?.config=="object"&&e.raw?.config!==null){let t=e.raw.config.package_name;if(t!=null)return t;let r=e.raw.config.module?.path;if(r!=null)return r}}var ODe=5e3;async function olr({version:e,packageName:t,generatorInvocation:r,context:n}){if(e==null||r.outputMode.type==="downloadFiles")return;let i=r.outputMode.type==="publishV2"||r.outputMode.type==="publish",o=t??jGe(r);if(r.language==null||o==null)return;let s=r.language,a;try{a=await aVl({packageName:o,version:e,language:s})}catch(c){n.logger.debug(`Could not verify version availability on ${rvi(s)}: ${Jn(c)}`);return}a&&(i?n.failAndThrow(`Version ${e} of ${o} already exists on the ${rvi(s)} registry. Please use a different version number. If you want to automatically increment the version, omit the --version flag.`,void 0,{code:N.Code.VersionError}):n.logger.warn(`Version ${e} of ${o} already exists on the ${rvi(s)} registry. If your CI pipeline publishes this version, it may fail.`))}async function aVl({packageName:e,version:t,language:r}){switch(r){case"typescript":return await cVl(e,t);case"python":return await uVl(e,t);case"java":return await lVl(e,t);case"csharp":return await pVl(e,t);case"ruby":return await fVl(e,t);case"go":return await dVl(e,t);case"rust":return await mVl(e,t);default:return!1}}async function cVl(e,t){let r=encodeURIComponent(e).replace(/^%40/,"@"),n={accept:"application/json"},i=process.env.NPM_TOKEN;i!=null&&(n.authorization=`Bearer ${i}`);let o=await fetch(`https://registry.npmjs.org/${r}/${t}`,{headers:n,signal:AbortSignal.timeout(ODe)});return o.ok?(await o.json()).version===t:!1}async function uVl(e,t){return(await fetch(`https://pypi.org/pypi/${e}/${t}/json`,{signal:AbortSignal.timeout(ODe)})).ok}async function lVl(e,t){let r=e.split(":");if(r.length<2||!r[0]||!r[1])return!1;let n=r[0],i=r[1],o=await fetch(`https://search.maven.org/solrsearch/select?q=g:${encodeURIComponent(n)}+AND+a:${encodeURIComponent(i)}+AND+v:${encodeURIComponent(t)}&rows=1&wt=json`,{signal:AbortSignal.timeout(ODe)});return o.ok?((await o.json()).response?.numFound??0)>0:!1}async function pVl(e,t){let r=await fetch(`https://api.nuget.org/v3-flatcontainer/${e.toLowerCase()}/index.json`,{signal:AbortSignal.timeout(ODe)});return r.ok?((await r.json()).versions??[]).some(o=>o.toLowerCase()===t.toLowerCase()):!1}async function fVl(e,t){return(await fetch(`https://rubygems.org/api/v2/rubygems/${e}/versions/${t}.json`,{signal:AbortSignal.timeout(ODe)})).ok}async function dVl(e,t){let r=e.replace(/[A-Z]/g,s=>"!"+s.toLowerCase()),n=t.startsWith("v")?t:`v${t}`,i=await fetch(`https://proxy.golang.org/${r}/@v/${n}.info`,{signal:AbortSignal.timeout(ODe)});return i.ok?(await i.json()).Version!=null:!1}async function mVl(e,t){let r=await fetch(`https://crates.io/api/v1/crates/${e}/${t}`,{headers:{"user-agent":"fern-cli (https://buildwithfern.com)"},signal:AbortSignal.timeout(ODe)});return r.ok?(await r.json()).version?.num===t:!1}function rvi(e){switch(e){case"typescript":return"npm";case"python":return"PyPI";case"java":return"Maven Central";case"csharp":return"NuGet";case"ruby":return"RubyGems";case"go":return"Go Module Proxy";case"rust":return"crates.io";default:return e}}jt();SH();var UDe=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",o=t.statusText??"",s=`${i} ${o}`.trim(),a=s?`status code ${s}`:"an unknown error";super(`Request failed with ${a}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var ZGe=class extends Error{name="NonError";value;constructor(t){let r="Non-error value was thrown";try{typeof t=="string"?r=t:t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"&&(r=t.message)}catch{}super(r),this.value=t}};var e7e=class extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(t){let r=t?.cause?t.cause instanceof Error?t.cause:new ZGe(t.cause):void 0;super(t?.code?`Forced retry: ${t.code}`:"Forced retry",r?{cause:r}:void 0),this.customDelay=t?.delay,this.code=t?.code,this.customRequest=t?.request}};var PCi=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),j$s=typeof globalThis.AbortController=="function",tpr=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",M$s=typeof globalThis.ReadableStream=="function",L$s=typeof globalThis.FormData=="function",rpr=["get","post","put","patch","head","delete"],p9l=()=>{};p9l();var U$s={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},npr=2147483647,z$s=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,ipr=Symbol("stop"),u1t=class{options;constructor(t){this.options=t}},V$s=e=>new u1t(e),q$s={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},G$s={next:!0},W$s={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var f9l=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=z$s,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},$$s=(e,t,r)=>{let n,i=0;return e.pipeThrough(new TransformStream({transform(o,s){if(s.enqueue(o),n){i+=n.byteLength;let a=t===0?0:i/t;a>=1&&(a=1-Number.EPSILON),r?.({percent:a,totalBytes:Math.max(t,i),transferredBytes:i},n)}n=o},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},n))}}))},H$s=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Math.max(0,Number(e.headers.get("content-length"))||0);return new Response($$s(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},K$s=(e,t,r)=>{if(!e.body)return e;let n=f9l(r??e.body);return new Request(e,{duplex:"half",body:$$s(e.body,n,t)})};var tge=e=>e!==null&&typeof e=="object";var l1t=(...e)=>{for(let t of e)if((!tge(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return FCi({},...e)},DCi=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[o,s]of i.entries())n&&s==="undefined"||s===void 0?r.delete(o):r.set(o,s);return r};function opr(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:FCi(e[r]??[],t[r]??[])}var RCi=(e={},t={})=>({beforeRequest:opr(e,t,"beforeRequest"),beforeRetry:opr(e,t,"beforeRetry"),afterResponse:opr(e,t,"afterResponse"),beforeError:opr(e,t,"beforeError")}),d9l=(e,t)=>{let r=new URLSearchParams;for(let n of[e,t])if(n!==void 0)if(n instanceof URLSearchParams)for(let[i,o]of n.entries())r.append(i,o);else if(Array.isArray(n))for(let i of n){if(!Array.isArray(i)||i.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");r.append(String(i[0]),String(i[1]))}else if(tge(n))for(let[i,o]of Object.entries(n))o!==void 0&&r.append(i,String(o));else{let i=new URLSearchParams(n);for(let[o,s]of i.entries())r.append(o,s)}return r},FCi=(...e)=>{let t={},r={},n={},i,o=[];for(let s of e)if(Array.isArray(s))Array.isArray(t)||(t=[]),t=[...t,...s];else if(tge(s)){for(let[a,c]of Object.entries(s)){if(a==="signal"&&c instanceof globalThis.AbortSignal){o.push(c);continue}if(a==="context"){if(c!=null&&(!tge(c)||Array.isArray(c)))throw new TypeError("The `context` option must be an object");t={...t,context:c==null?{}:{...t.context,...c}};continue}if(a==="searchParams"){c==null?i=void 0:i=i===void 0?c:d9l(i,c);continue}tge(c)&&a in t&&(c=FCi(t[a],c)),t={...t,[a]:c}}tge(s.hooks)&&(n=RCi(n,s.hooks),t.hooks=n),tge(s.headers)&&(r=DCi(r,s.headers),t.headers=r)}return i!==void 0&&(t.searchParams=i),o.length>0&&(o.length===1?t.signal=o[0]:tpr?t.signal=AbortSignal.any(o):t.signal=o.at(-1)),t};var Y$s=e=>rpr.includes(e)?e.toUpperCase():e,m9l=["get","put","head","delete","options","trace"],h9l=[408,413,429,500,502,503,504],g9l=[413,429,503],J$s={limit:2,methods:m9l,statusCodes:h9l,afterStatusCodes:g9l,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},X$s=(e={})=>{if(typeof e=="number")return{...J$s,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.methods&&=e.methods.map(r=>r.toLowerCase()),e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");let t=Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0));return{...J$s,...t}};var zDe=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};async function kCi(e,t,r,n){return new Promise((i,o)=>{let s=setTimeout(()=>{r&&r.abort(),o(new zDe(e))},n.timeout);n.fetch(e,t).then(i).catch(o).then(()=>{clearTimeout(s)})})}async function NCi(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(o),n(t.reason)}let o=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var Z$s=(e,t)=>{let r={};for(let n in t)Object.hasOwn(t,n)&&!(n in W$s)&&!(n in q$s)&&(!(n in e)||n in G$s)&&(r[n]=t[n]);return r},eHs=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;function tHs(e){return e instanceof UDe||e?.name===UDe.name}function rHs(e){return e instanceof zDe||e?.name===zDe.name}var p1t=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n.#i.timeout=="number"&&n.#i.timeout>npr)throw new RangeError(`The \`timeout\` option cannot be greater than ${npr}`);await Promise.resolve();let s=await n.#m();for(let a of n.#i.hooks.afterResponse){let c=n.#d(s.clone()),u;try{u=await a(n.request,n.#h(),c,{retryCount:n.#r})}catch(p){throw n.#f(c),n.#f(s),p}if(u instanceof u1t)throw n.#f(c),n.#f(s),new e7e(u.options);let l=u instanceof globalThis.Response?u:s;c!==l&&n.#f(c),s!==l&&n.#f(s),s=l}if(n.#d(s),!s.ok&&(typeof n.#i.throwHttpErrors=="function"?n.#i.throwHttpErrors(s.status):n.#i.throwHttpErrors)){let a=new UDe(s,n.request,n.#h());for(let c of n.#i.hooks.beforeError)a=await c(a,{retryCount:n.#r});throw a}if(n.#i.onDownloadProgress){if(typeof n.#i.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!M$s)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");let a=s.clone();return n.#f(s),H$s(a,n.#i.onDownloadProgress)}return s},o=n.#l(i).finally(()=>{let s=n.#o;n.#p(s?.body??void 0),n.#p(n.request.body??void 0)});for(let[s,a]of Object.entries(U$s))s==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[s]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||a);let c=await o;if(s==="json"){if(c.status===204)return"";let u=await c.text();return u===""?"":r.parseJson?r.parseJson(u):JSON.parse(u)}return c[s]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;#t;#r=0;#n;#i;#o;#s;#a;constructor(t,r={}){if(this.#n=t,this.#i={...r,headers:DCi(this.#n.headers,r.headers),hooks:RCi({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Y$s(r.method??this.#n.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:X$s(r.retry),throwHttpErrors:r.throwHttpErrors??!0,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis),context:r.context??{}},typeof this.#n!="string"&&!(this.#n instanceof URL||this.#n instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#i.prefixUrl&&typeof this.#n=="string"){if(this.#n.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#i.prefixUrl.endsWith("/")||(this.#i.prefixUrl+="/"),this.#n=this.#i.prefixUrl+this.#n}j$s&&tpr&&(this.#s=this.#i.signal??this.#n.signal,this.#t=new globalThis.AbortController,this.#i.signal=this.#s?AbortSignal.any([this.#s,this.#t.signal]):this.#t.signal),PCi&&(this.#i.duplex="half"),this.#i.json!==void 0&&(this.#i.body=this.#i.stringifyJson?.(this.#i.json)??JSON.stringify(this.#i.json),this.#i.headers.set("content-type",this.#i.headers.get("content-type")??"application/json"));let n=r.headers&&new globalThis.Headers(r.headers).has("content-type");if(this.#n instanceof globalThis.Request&&(L$s&&this.#i.body instanceof globalThis.FormData||this.#i.body instanceof URLSearchParams)&&!n&&this.#i.headers.delete("content-type"),this.request=new globalThis.Request(this.#n,this.#i),eHs(this.#i.searchParams)){let o="?"+(typeof this.#i.searchParams=="string"?this.#i.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this.#i.searchParams)).toString()),s=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,o);this.request=new globalThis.Request(s,this.#i)}if(this.#i.onUploadProgress){if(typeof this.#i.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!PCi)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#E(this.request,this.#i.body??void 0)}}#c(){let t=this.#i.retry.delay(this.#r),r=t;this.#i.retry.jitter===!0?r=Math.random()*t:typeof this.#i.retry.jitter=="function"&&(r=this.#i.retry.jitter(t),(!Number.isFinite(r)||r<0)&&(r=t));let n=this.#i.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(n,r)}async#u(t){if(this.#r++,this.#r>this.#i.retry.limit)throw t;let r=t instanceof Error?t:new ZGe(t);if(r instanceof e7e)return r.customDelay??this.#c();if(!this.#i.retry.methods.includes(this.request.method.toLowerCase()))throw t;if(this.#i.retry.shouldRetry!==void 0){let n=await this.#i.retry.shouldRetry({error:r,retryCount:this.#r});if(n===!1)throw t;if(n===!0)return this.#c()}if(rHs(t)&&!this.#i.retry.retryOnTimeout)throw t;if(tHs(t)){if(!this.#i.retry.statusCodes.includes(t.response.status))throw t;let n=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Retry-After")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(n&&this.#i.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let o=this.#i.retry.maxRetryAfter??i;return i<o?i:o}if(t.response.status===413)throw t}return this.#c()}#d(t){return this.#i.parseJson&&(t.json=async()=>this.#i.parseJson(await t.text())),t}#p(t){t&&t.cancel().catch(()=>{})}#f(t){this.#p(t.body??void 0)}async#l(t){try{return await t()}catch(r){let n=Math.min(await this.#u(r),npr);if(this.#r<1)throw r;if(await NCi(n,this.#s?{signal:this.#s}:{}),r instanceof e7e&&r.customRequest){let i=this.#i.signal?new globalThis.Request(r.customRequest,{signal:this.#i.signal}):new globalThis.Request(r.customRequest);this.#g(i)}for(let i of this.#i.hooks.beforeRetry){let o=await i({request:this.request,options:this.#h(),error:r,retryCount:this.#r});if(o instanceof globalThis.Request){this.#g(o);break}if(o instanceof globalThis.Response)return o;if(o===ipr)return}return this.#l(t)}}async#m(){this.#t?.signal.aborted&&(this.#t=new globalThis.AbortController,this.#i.signal=this.#s?AbortSignal.any([this.#s,this.#t.signal]):this.#t.signal,this.request=new globalThis.Request(this.request,{signal:this.#i.signal}));for(let r of this.#i.hooks.beforeRequest){let n=await r(this.request,this.#h(),{retryCount:this.#r});if(n instanceof Response)return n;if(n instanceof globalThis.Request){this.#g(n);break}}let t=Z$s(this.request,this.#i);return this.#o=this.request,this.request=this.#o.clone(),this.#i.timeout===!1?this.#i.fetch(this.#o,t):kCi(this.#o,t,this.#t,this.#i)}#h(){if(!this.#a){let{hooks:t,...r}=this.#i;this.#a=Object.freeze(r)}return this.#a}#g(t){this.#a=void 0,this.request=this.#E(t)}#E(t,r){return!this.#i.onUploadProgress||!t.body?t:K$s(t,this.#i.onUploadProgress,r??this.#i.body??void 0)}};var QCi=e=>{let t=(r,n)=>p1t.create(r,l1t(e,n));for(let r of rpr)t[r]=(n,i)=>p1t.create(n,l1t(e,i,{method:r}));return t.create=r=>QCi(l1t(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),QCi(l1t(e,r))),t.stop=ipr,t.retry=V$s,t},A9l=QCi(),nHs=A9l;var SHs=we(xHs(),1);function zCi(e){let t=(0,SHs.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var IKs=we(EKs(),1),vKs=we(nS(),1),ewi=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},twi=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function rwi(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],o=t.registryUrl??zCi(i),s=new URL(encodeURIComponent(e).replace(/^%40/,"@"),o),a=(0,IKs.default)(o.toString(),{recursive:!0}),c={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete c.accept,a&&(c.authorization=`${a.type} ${a.token}`);let u;try{u=await nHs(s,{headers:c,keepalive:!0}).json()}catch(p){throw p?.response?.status===404?new ewi(e):p}if(t.allVersions)return u;let l=new twi(e,r);if(u["dist-tags"][r]){let{time:p}=u;u=u.versions[u["dist-tags"][r]],u.time=p}else if(r){let p=!!u.versions[r];if(n&&!p)for(let[f,m]of Object.entries(u.versions))m.deprecated&&delete u.versions[f];if(!p){let f=Object.keys(u.versions);if(r=vKs.default.maxSatisfying(f,r),!r)throw l}let{time:d}=u;if(u=u.versions[r],u.time=d,!u)throw l}return u}async function A1t(e,t){let{version:r}=await rwi(e.toLowerCase(),t);return r}var owi=we(nS(),1),Apr;(function(e){e.Empty={registryUrl:void 0,token:void 0,username:void 0}})(Apr||(Apr={}));var CWl="https://registry.npmjs.org",CKs="https://pypi.org/pypi",nwi="https://search.maven.org/solrsearch/select",wKs="https://api.nuget.org/v3-flatcontainer",xKs="https://rubygems.org/api/v1/gems",wWl="https://proxy.golang.org",SKs="https://crates.io/api/v1/crates";async function y1t({packageName:e,generatorInvocation:t}){if(t.language==null||e==null)return;let r=xWl(t.outputMode),n=await BWl({packageName:e,language:t.language,githubRepository:GWl(t),registryInfo:r});return n==null?void 0:owi.default.inc(n,"patch")??void 0}function xWl(e){let t=e.type;switch(t){case"publish":return _Wl(e);case"publishV2":return SWl(e.publishV2);case"downloadFiles":return Apr.Empty;case"github":return _Ks(e.publishInfo);case"githubV2":return _Ks(e.githubV2.publishInfo);default:Ce(t)}}function _Ks(e){if(e==null)return{registryUrl:void 0,token:void 0,username:void 0};let t=e.type;switch(t){case"npm":return{registryUrl:e.registryUrl,token:e.token,username:void 0};case"maven":return{registryUrl:e.registryUrl,token:e.credentials?.password,username:e.credentials?.username};case"pypi":return{registryUrl:e.registryUrl,token:e.credentials?.password,username:void 0};case"nuget":return{registryUrl:e.registryUrl,token:e.apiKey,username:void 0};case"rubygems":return{registryUrl:e.registryUrl,token:e.apiKey,username:void 0};case"crates":return{registryUrl:e.registryUrl,token:e.token,username:void 0};case"postman":return{registryUrl:void 0,token:void 0,username:void 0};default:Ce(t)}}function SWl(e){let t=e.type;switch(t){case"npmOverride":return{registryUrl:e.npmOverride?.registryUrl,token:e.npmOverride?.token,username:void 0};case"mavenOverride":return{registryUrl:e.mavenOverride?.registryUrl,token:e.mavenOverride?.password,username:e.mavenOverride?.username};case"pypiOverride":return{registryUrl:e.pypiOverride?.registryUrl,token:e.pypiOverride?.password,username:void 0};case"nugetOverride":return{registryUrl:e.nugetOverride?.registryUrl,token:e.nugetOverride?.apiKey,username:void 0};case"rubyGemsOverride":return{registryUrl:e.rubyGemsOverride?.registryUrl,token:e.rubyGemsOverride?.apiKey,username:void 0};case"cratesOverride":return{registryUrl:e.cratesOverride?.registryUrl,token:e.cratesOverride?.token,username:void 0};case"postman":return{registryUrl:void 0,token:void 0,username:void 0};default:Ce(t)}}function _Wl(e){let t=e.registryOverrides;return t.npm!=null?{registryUrl:t.npm.registryUrl,token:t.npm.token,username:void 0}:t.maven!=null?{registryUrl:t.maven.registryUrl,token:t.maven.password,username:t.maven.username}:Apr.Empty}async function BWl({packageName:e,language:t,githubRepository:r,registryInfo:n}){let i;switch(t){case"typescript":i=await PWl(e,n);break;case"python":i=await RWl(e,n);break;case"java":i=await kWl(e,n);break;case"csharp":i=await QWl(e,n);break;case"ruby":i=await MWl(e,n);break;case"go":i=await LWl(e,n);break;case"rust":i=await zWl(e,n);break;case"php":case"swift":break}return i!=null||(r!=null&&(i=await VWl(r)),i!=null)||r!=null&&(i=await qWl(r)),i}function TWl(e){return e.registryUrl!=null&&e.registryUrl!==""?e.registryUrl:CWl}function OWl(e){return e.token!=null&&e.token!==""?e.token:process.env.NPM_TOKEN}async function PWl(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=TWl(t),n=OWl(t);if(n!=null){let i=encodeURIComponent(e).replace(/^%40/,"@"),o=await fetch(`${r}/${i}`,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",authorization:`Bearer ${n}`}});if(o.ok){let a=(await o.json())["dist-tags"]?.latest;if(a!=null)return a}}return await A1t(e)}catch{return}}function DWl(e){let t=e.registryUrl;return t==null||t===""||t.includes("upload.pypi.org")||t.includes("pypi.org/legacy")?CKs:`${t.replace(/\/+$/,"").replace(/\/legacy$/,"").replace(/\/simple$/,"")}/pypi`}async function RWl(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=DWl(t),n={},i=t.token??void 0;i!=null&&i!==""&&(n.authorization=`Bearer ${i}`);let s=Object.keys(n).length>0?await fetch(`${r}/${e}/json`,{headers:n}):await fetch(`${r}/${e}/json`);return s.ok?(await s.json()).info.version:void 0}catch{return}}function FWl(e){let t=e.registryUrl;return t==null||t===""||t.includes("oss.sonatype.org")||t.includes("s01.oss.sonatype.org")||t.includes("central.sonatype.com")||t.includes("search.maven.org"),nwi}async function kWl(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=e.split(":");if(r.length<2||!r[0]||!r[1])return;let n=r[0],i=r[1],o=FWl(t),s={},a=t.token??void 0;if(a!=null&&a!==""){let p=t.username??"";s.authorization=`Basic ${Buffer.from(`${p}:${a}`).toString("base64")}`}let c=`${o}?q=g:${encodeURIComponent(n)}+AND+a:${encodeURIComponent(i)}&rows=1&wt=json`,l=Object.keys(s).length>0?await fetch(c,{headers:s}):await fetch(c);if(l.ok){let d=(await l.json()).response?.docs?.[0]?.latestVersion;if(d!=null)return d}return}catch{return}}function NWl(e){let t=e.registryUrl;return t==null||t===""||t.includes("nuget.org")?wKs:`${t.replace(/\/+$/,"")}/v3-flatcontainer`}async function QWl(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=NWl(t),n={},i=t.token??void 0;i!=null&&i!==""&&(n.authorization=`Basic ${Buffer.from(`:${i}`).toString("base64")}`);let o=`${r}/${e.toLowerCase()}/index.json`,a=Object.keys(n).length>0?await fetch(o,{headers:n}):await fetch(o);if(a.ok){let u=(await a.json()).versions??[];for(let l=u.length-1;l>=0;l--){let p=u[l];if(p!=null&&!p.includes("-"))return p}}return}catch{return}}function jWl(e){let t=e.registryUrl;return t==null||t===""||t.includes("rubygems.org")?xKs:`${t.replace(/\/+$/,"")}/api/v1/gems`}async function MWl(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=jWl(t),n={},i=t.token??void 0;i!=null&&i!==""&&(n.authorization=i);let s=Object.keys(n).length>0?await fetch(`${r}/${e}.json`,{headers:n}):await fetch(`${r}/${e}.json`);if(s.ok){let a=await s.json();if(a.version!=null)return a.version}return}catch{return}}async function LWl(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{if(/\/v\d+$/.test(e))return await iwi(e);let r=10,n=[];n.push(iwi(e).then(s=>({version:s,major:0})));for(let s=2;s<=r;s++)n.push(iwi(`${e}/v${s}`).then(a=>({version:a,major:s})));let i=await Promise.all(n),o;for(let s of i)s.version!=null&&(o==null||owi.default.gt(s.version,o))&&(o=s.version);return o}catch{return}}async function iwi(e){try{let t=e.replace(/[A-Z]/g,n=>"!"+n.toLowerCase()),r=await fetch(`${wWl}/${t}/@latest`);if(r.ok){let n=await r.json();if(n.Version!=null)return n.Version.replace(/^v/,"")}return}catch{return}}function UWl(e){let t=e.registryUrl;return t==null||t===""||t.includes("crates.io")?SKs:t.replace(/\/+$/,"")}async function zWl(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=UWl(t),n={"user-agent":"fern-cli (https://buildwithfern.com)"},i=t.token??void 0;i!=null&&i!==""&&(n.authorization=`Bearer ${i}`);let o=await fetch(`${r}/${e}`,{headers:n});if(o.ok){let a=(await o.json()).crate?.max_stable_version;if(a!=null)return a}return}catch{return}}async function VWl(e){try{return await epr(e)}catch{return}}async function qWl(e){try{let t=await Zlr(e,".fern/metadata.json");if(t!=null){let r=JSON.parse(t);if(r.sdkVersion!=null)return r.sdkVersion}return}catch{return}}function GWl(e){if(e.outputMode.type==="githubV2")return`${e.outputMode.githubV2.owner}/${e.outputMode.githubV2.repo}`}function _H(){let e=WWl(process.env.FERN_INVOKER);return e??(BKs()?"ci":"manual")}function BH(){if(process.env.GITHUB_ACTIONS==="true")return"github";if(process.env.GITLAB_CI==="true")return"gitlab";if(process.env.BITBUCKET_BUILD_NUMBER!=null)return"bitbucket";if(process.env.CIRCLECI==="true")return"circleci";if(process.env.TRAVIS==="true")return"travis";if(process.env.JENKINS_URL!=null||process.env.JENKINS_HOME!=null)return"jenkins";if(process.env.TF_BUILD!=null)return"azure-pipelines";if(process.env.BUILDKITE==="true")return"buildkite";if(process.env.CODEBUILD_BUILD_ID!=null)return"codebuild";if(process.env.TEAMCITY_VERSION!=null)return"teamcity";if(process.env.DRONE==="true")return"drone";if(process.env.SEMAPHORE==="true")return"semaphore";if(process.env.APPVEYOR==="true"||process.env.APPVEYOR==="True")return"appveyor";if(BKs())return"unknown"}function WWl(e){if(e==null)return;let t=e.trim().toLowerCase();switch(t){case"autopilot":case"autorelease":case"ci":case"manual":return t;default:return}}function BKs(){return!!(process.env.CI||process.env.CONTINUOUS_INTEGRATION||process.env.GITHUB_ACTIONS||process.env.GITLAB_CI||process.env.CIRCLECI||process.env.TRAVIS||process.env.JENKINS_URL||process.env.JENKINS_HOME||process.env.TF_BUILD||process.env.BUILDKITE||process.env.CODEBUILD_BUILD_ID||process.env.TEAMCITY_VERSION||process.env.BITBUCKET_BUILD_NUMBER||process.env.DRONE||process.env.SEMAPHORE||process.env.APPVEYOR||process.env.BUDDY_WORKSPACE_ID||process.env.WERCKER_RUN_ID)}var Uk=class extends SG{definition;sources;type="fern";constructor({definition:t,sources:r,...n}){super(n),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace({context:t},r,n,i){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var swi=require("child_process");function TH(){if(process.env.IGNORE_GIT_IN_METADATA==="true")return"DUMMY";try{let e=(0,swi.execSync)("git rev-parse HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return/^[0-9a-f]{40}$/.test(e)?e:void 0}catch{return}}function OH(){if(process.env.IGNORE_GIT_IN_METADATA!=="true")try{return(0,swi.execSync)("git status --porcelain",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim().length>0}catch{return}}var wA="fern",xA="definition",b1t="openapi",TKs="changelog",awi="asyncapi",nI="api.yml",YDe="__package__",Rf=`${YDe}.yml`,ypr="dependencies.yml",Wp="generators.yml",a7e="generators.yaml",OKs="dependencies.yml",fh="docs.yml",eE="fern.config.json",cwi="api",uO=".fernignore",bpr="snippet.json",PKs="snippet-templates.json";var nge="default-group",DKs="spec-origin",RKs="async-api",FKs="openapi",kKs="openapi-overrides",NKs="api-settings";var _R="apis",E1t="local";var ue={};ne(ue,{$brand:()=>Epr,$input:()=>BSi,$output:()=>_Si,NEVER:()=>uwi,TimePrecision:()=>DSi,ZodAny:()=>I1i,ZodArray:()=>x1i,ZodBase64:()=>$fr,ZodBase64URL:()=>Hfr,ZodBigInt:()=>Q7e,ZodBigIntFormat:()=>Yfr,ZodBoolean:()=>N7e,ZodCIDRv4:()=>Gfr,ZodCIDRv6:()=>Wfr,ZodCUID:()=>jfr,ZodCUID2:()=>Mfr,ZodCatch:()=>$1i,ZodCodec:()=>odr,ZodCustom:()=>X1t,ZodCustomStringFormat:()=>F7e,ZodDate:()=>$1t,ZodDefault:()=>U1i,ZodDiscriminatedUnion:()=>_1i,ZodE164:()=>Kfr,ZodEmail:()=>kfr,ZodEmoji:()=>Nfr,ZodEnum:()=>D7e,ZodError:()=>EKl,ZodExactOptional:()=>j1i,ZodFile:()=>N1i,ZodFirstPartyTypeKind:()=>oBi,ZodFunction:()=>rBi,ZodGUID:()=>z1t,ZodIPv4:()=>Vfr,ZodIPv6:()=>qfr,ZodISODate:()=>Tfr,ZodISODateTime:()=>Bfr,ZodISODuration:()=>Pfr,ZodISOTime:()=>Ofr,ZodIntersection:()=>B1i,ZodIssueCode:()=>vKl,ZodJWT:()=>Jfr,ZodKSUID:()=>zfr,ZodLazy:()=>Z1i,ZodLiteral:()=>k1i,ZodMAC:()=>m1i,ZodMap:()=>R1i,ZodNaN:()=>K1i,ZodNanoID:()=>Qfr,ZodNever:()=>C1i,ZodNonOptional:()=>ndr,ZodNull:()=>b1i,ZodNullable:()=>L1i,ZodNumber:()=>k7e,ZodNumberFormat:()=>oRe,ZodObject:()=>K1t,ZodOptional:()=>rdr,ZodPipe:()=>idr,ZodPrefault:()=>V1i,ZodPromise:()=>tBi,ZodReadonly:()=>J1i,ZodRealError:()=>qk,ZodRecord:()=>Y1t,ZodSet:()=>F1i,ZodString:()=>R7e,ZodStringFormat:()=>Jg,ZodSuccess:()=>W1i,ZodSymbol:()=>A1i,ZodTemplateLiteral:()=>X1i,ZodTransform:()=>Q1i,ZodTuple:()=>O1i,ZodType:()=>rp,ZodULID:()=>Lfr,ZodURL:()=>W1t,ZodUUID:()=>FH,ZodUndefined:()=>y1i,ZodUnion:()=>J1t,ZodUnknown:()=>v1i,ZodVoid:()=>w1i,ZodXID:()=>Ufr,ZodXor:()=>S1i,_ZodString:()=>Ffr,_default:()=>z1i,_function:()=>hXs,any:()=>$Ys,array:()=>H1t,base64:()=>OYs,base64url:()=>PYs,bigint:()=>zYs,boolean:()=>g1i,catch:()=>H1i,check:()=>gXs,cidrv4:()=>BYs,cidrv6:()=>TYs,clone:()=>BR,codec:()=>fXs,coerce:()=>sBi,config:()=>iI,core:()=>Kse,cuid:()=>EYs,cuid2:()=>IYs,custom:()=>AXs,date:()=>KYs,decode:()=>a1i,decodeAsync:()=>u1i,describe:()=>yXs,discriminatedUnion:()=>tXs,e164:()=>DYs,email:()=>lYs,emoji:()=>yYs,encode:()=>s1i,encodeAsync:()=>c1i,endsWith:()=>v7e,enum:()=>edr,exactOptional:()=>M1i,file:()=>cXs,flattenError:()=>T1t,float32:()=>jYs,float64:()=>MYs,formatError:()=>O1t,fromJSONSchema:()=>xXs,function:()=>hXs,getErrorMap:()=>wKl,globalRegistry:()=>sB,gt:()=>DH,gte:()=>TR,guid:()=>pYs,hash:()=>QYs,hex:()=>NYs,hostname:()=>kYs,httpUrl:()=>AYs,includes:()=>E7e,instanceof:()=>EXs,int:()=>Rfr,int32:()=>LYs,int64:()=>VYs,intersection:()=>T1i,ipv4:()=>xYs,ipv6:()=>_Ys,iso:()=>P7e,json:()=>vXs,jwt:()=>RYs,keyof:()=>JYs,ksuid:()=>wYs,lazy:()=>eBi,length:()=>nRe,literal:()=>aXs,locales:()=>j1t,looseObject:()=>ZYs,looseRecord:()=>nXs,lowercase:()=>y7e,lt:()=>PH,lte:()=>c6,mac:()=>SYs,map:()=>iXs,maxLength:()=>rRe,maxSize:()=>lge,meta:()=>bXs,mime:()=>C7e,minLength:()=>Hse,minSize:()=>RH,multipleOf:()=>uge,nan:()=>pXs,nanoid:()=>bYs,nativeEnum:()=>sXs,negative:()=>yfr,never:()=>Xfr,nonnegative:()=>Efr,nonoptional:()=>G1i,nonpositive:()=>bfr,normalize:()=>w7e,null:()=>E1i,nullable:()=>q1t,nullish:()=>uXs,number:()=>h1i,object:()=>YYs,optional:()=>V1t,overwrite:()=>PG,parse:()=>r1i,parseAsync:()=>n1i,partialRecord:()=>rXs,pipe:()=>G1t,positive:()=>Afr,prefault:()=>q1i,preprocess:()=>CXs,prettifyError:()=>Iwi,promise:()=>mXs,property:()=>Ifr,readonly:()=>Y1i,record:()=>D1i,refine:()=>nBi,regex:()=>A7e,regexes:()=>_3,registry:()=>Jpr,safeDecode:()=>p1i,safeDecodeAsync:()=>d1i,safeEncode:()=>l1i,safeEncodeAsync:()=>f1i,safeParse:()=>i1i,safeParseAsync:()=>o1i,set:()=>oXs,setErrorMap:()=>CKl,size:()=>tRe,slugify:()=>B7e,startsWith:()=>I7e,strictObject:()=>XYs,string:()=>Dfr,stringFormat:()=>FYs,stringbool:()=>IXs,success:()=>lXs,superRefine:()=>iBi,symbol:()=>GYs,templateLiteral:()=>dXs,toJSONSchema:()=>xfr,toLowerCase:()=>S7e,toUpperCase:()=>_7e,transform:()=>tdr,treeifyError:()=>Ewi,trim:()=>x7e,tuple:()=>P1i,uint32:()=>UYs,uint64:()=>qYs,ulid:()=>vYs,undefined:()=>WYs,union:()=>Zfr,unknown:()=>iRe,uppercase:()=>b7e,url:()=>gYs,util:()=>Ei,uuid:()=>fYs,uuidv4:()=>dYs,uuidv6:()=>mYs,uuidv7:()=>hYs,void:()=>HYs,xid:()=>CYs,xor:()=>eXs});var Kse={};ne(Kse,{$ZodAny:()=>Kxi,$ZodArray:()=>eSi,$ZodAsyncError:()=>OG,$ZodBase64:()=>Mxi,$ZodBase64URL:()=>Lxi,$ZodBigInt:()=>Vpr,$ZodBigIntFormat:()=>Gxi,$ZodBoolean:()=>F1t,$ZodCIDRv4:()=>Nxi,$ZodCIDRv6:()=>Qxi,$ZodCUID:()=>wxi,$ZodCUID2:()=>xxi,$ZodCatch:()=>ySi,$ZodCheck:()=>SA,$ZodCheckBigIntFormat:()=>exi,$ZodCheckEndsWith:()=>fxi,$ZodCheckGreaterThan:()=>Npr,$ZodCheckIncludes:()=>lxi,$ZodCheckLengthEquals:()=>sxi,$ZodCheckLessThan:()=>kpr,$ZodCheckLowerCase:()=>cxi,$ZodCheckMaxLength:()=>ixi,$ZodCheckMaxSize:()=>txi,$ZodCheckMimeType:()=>mxi,$ZodCheckMinLength:()=>oxi,$ZodCheckMinSize:()=>rxi,$ZodCheckMultipleOf:()=>Xwi,$ZodCheckNumberFormat:()=>Zwi,$ZodCheckOverwrite:()=>hxi,$ZodCheckProperty:()=>dxi,$ZodCheckRegex:()=>axi,$ZodCheckSizeEquals:()=>nxi,$ZodCheckStartsWith:()=>pxi,$ZodCheckStringFormat:()=>h7e,$ZodCheckUpperCase:()=>uxi,$ZodCodec:()=>N1t,$ZodCustom:()=>SSi,$ZodCustomStringFormat:()=>Vxi,$ZodDate:()=>Zxi,$ZodDefault:()=>mSi,$ZodDiscriminatedUnion:()=>nSi,$ZodE164:()=>Uxi,$ZodEmail:()=>Exi,$ZodEmoji:()=>vxi,$ZodEncodeError:()=>ige,$ZodEnum:()=>cSi,$ZodError:()=>B1t,$ZodExactOptional:()=>fSi,$ZodFile:()=>lSi,$ZodFunction:()=>CSi,$ZodGUID:()=>yxi,$ZodIPv4:()=>Rxi,$ZodIPv6:()=>Fxi,$ZodISODate:()=>Oxi,$ZodISODateTime:()=>Txi,$ZodISODuration:()=>Dxi,$ZodISOTime:()=>Pxi,$ZodIntersection:()=>iSi,$ZodJWT:()=>zxi,$ZodKSUID:()=>Bxi,$ZodLazy:()=>xSi,$ZodLiteral:()=>uSi,$ZodMAC:()=>kxi,$ZodMap:()=>sSi,$ZodNaN:()=>bSi,$ZodNanoID:()=>Cxi,$ZodNever:()=>Yxi,$ZodNonOptional:()=>gSi,$ZodNull:()=>Hxi,$ZodNullable:()=>dSi,$ZodNumber:()=>zpr,$ZodNumberFormat:()=>qxi,$ZodObject:()=>uJs,$ZodObjectJIT:()=>tSi,$ZodOptional:()=>Gpr,$ZodPipe:()=>ESi,$ZodPrefault:()=>hSi,$ZodPromise:()=>wSi,$ZodReadonly:()=>ISi,$ZodRealError:()=>Vk,$ZodRecord:()=>oSi,$ZodRegistry:()=>Kpr,$ZodSet:()=>aSi,$ZodString:()=>eRe,$ZodStringFormat:()=>Kg,$ZodSuccess:()=>ASi,$ZodSymbol:()=>Wxi,$ZodTemplateLiteral:()=>vSi,$ZodTransform:()=>pSi,$ZodTuple:()=>qpr,$ZodType:()=>Vu,$ZodULID:()=>Sxi,$ZodURL:()=>Ixi,$ZodUUID:()=>bxi,$ZodUndefined:()=>$xi,$ZodUnion:()=>k1t,$ZodUnknown:()=>Jxi,$ZodVoid:()=>Xxi,$ZodXID:()=>_xi,$ZodXor:()=>rSi,$brand:()=>Epr,$constructor:()=>Ar,$input:()=>BSi,$output:()=>_Si,Doc:()=>R1t,JSONSchema:()=>cYs,JSONSchemaGenerator:()=>Sfr,NEVER:()=>uwi,TimePrecision:()=>DSi,_any:()=>ZSi,_array:()=>s_i,_base64:()=>dfr,_base64url:()=>mfr,_bigint:()=>WSi,_boolean:()=>qSi,_catch:()=>fKl,_check:()=>aYs,_cidrv4:()=>pfr,_cidrv6:()=>ffr,_coercedBigint:()=>$Si,_coercedBoolean:()=>GSi,_coercedDate:()=>i_i,_coercedNumber:()=>jSi,_coercedString:()=>OSi,_cuid:()=>ifr,_cuid2:()=>ofr,_custom:()=>c_i,_date:()=>n_i,_decode:()=>Spr,_decodeAsync:()=>Bpr,_default:()=>uKl,_discriminatedUnion:()=>YHl,_e164:()=>hfr,_email:()=>Ypr,_emoji:()=>rfr,_encode:()=>xpr,_encodeAsync:()=>_pr,_endsWith:()=>v7e,_enum:()=>nKl,_file:()=>a_i,_float32:()=>LSi,_float64:()=>USi,_gt:()=>DH,_gte:()=>TR,_guid:()=>M1t,_includes:()=>E7e,_int:()=>MSi,_int32:()=>zSi,_int64:()=>HSi,_intersection:()=>XHl,_ipv4:()=>ufr,_ipv6:()=>lfr,_isoDate:()=>FSi,_isoDateTime:()=>RSi,_isoDuration:()=>NSi,_isoTime:()=>kSi,_jwt:()=>gfr,_ksuid:()=>cfr,_lazy:()=>gKl,_length:()=>nRe,_literal:()=>oKl,_lowercase:()=>y7e,_lt:()=>PH,_lte:()=>c6,_mac:()=>PSi,_map:()=>tKl,_max:()=>c6,_maxLength:()=>rRe,_maxSize:()=>lge,_mime:()=>C7e,_min:()=>TR,_minLength:()=>Hse,_minSize:()=>RH,_multipleOf:()=>uge,_nan:()=>o_i,_nanoid:()=>nfr,_nativeEnum:()=>iKl,_negative:()=>yfr,_never:()=>t_i,_nonnegative:()=>Efr,_nonoptional:()=>lKl,_nonpositive:()=>bfr,_normalize:()=>w7e,_null:()=>XSi,_nullable:()=>cKl,_number:()=>QSi,_optional:()=>aKl,_overwrite:()=>PG,_parse:()=>p7e,_parseAsync:()=>f7e,_pipe:()=>dKl,_positive:()=>Afr,_promise:()=>AKl,_property:()=>Ifr,_readonly:()=>mKl,_record:()=>eKl,_refine:()=>u_i,_regex:()=>A7e,_safeDecode:()=>Opr,_safeDecodeAsync:()=>Dpr,_safeEncode:()=>Tpr,_safeEncodeAsync:()=>Ppr,_safeParse:()=>d7e,_safeParseAsync:()=>m7e,_set:()=>rKl,_size:()=>tRe,_slugify:()=>B7e,_startsWith:()=>I7e,_string:()=>TSi,_stringFormat:()=>T7e,_stringbool:()=>d_i,_success:()=>pKl,_superRefine:()=>l_i,_symbol:()=>JSi,_templateLiteral:()=>hKl,_toLowerCase:()=>S7e,_toUpperCase:()=>_7e,_transform:()=>sKl,_trim:()=>x7e,_tuple:()=>ZHl,_uint32:()=>VSi,_uint64:()=>KSi,_ulid:()=>sfr,_undefined:()=>YSi,_union:()=>KHl,_unknown:()=>e_i,_uppercase:()=>b7e,_url:()=>L1t,_uuid:()=>Xpr,_uuidv4:()=>Zpr,_uuidv6:()=>efr,_uuidv7:()=>tfr,_void:()=>r_i,_xid:()=>afr,_xor:()=>JHl,clone:()=>BR,config:()=>iI,createStandardJSONSchemaMethod:()=>O7e,createToJSONSchemaMethod:()=>m_i,decode:()=>E$l,decodeAsync:()=>v$l,describe:()=>p_i,encode:()=>b$l,encodeAsync:()=>I$l,extractDefs:()=>fge,finalize:()=>dge,flattenError:()=>T1t,formatError:()=>O1t,globalConfig:()=>I1t,globalRegistry:()=>sB,initializeContext:()=>pge,isValidBase64:()=>jxi,isValidBase64URL:()=>oJs,isValidJWT:()=>sJs,locales:()=>j1t,meta:()=>f_i,parse:()=>Cpr,parseAsync:()=>wpr,prettifyError:()=>Iwi,process:()=>Oh,regexes:()=>_3,registry:()=>Jpr,safeDecode:()=>w$l,safeDecodeAsync:()=>S$l,safeEncode:()=>C$l,safeEncodeAsync:()=>x$l,safeParse:()=>vwi,safeParseAsync:()=>Cwi,toDotPath:()=>UKs,toJSONSchema:()=>xfr,treeifyError:()=>Ewi,util:()=>Ei,version:()=>gxi});var uwi=Object.freeze({status:"aborted"});function Ar(e,t,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=s.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let d=l[p];d in a||(a[d]=u[d].bind(a))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function s(a){var c;let u=r?.Parent?new o:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var Epr=Symbol("zod_brand"),OG=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ige=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},I1t={};function iI(e){return e&&Object.assign(I1t,e),I1t}var Ei={};ne(Ei,{BIGINT_FORMAT_RANGES:()=>bwi,Class:()=>pwi,NUMBER_FORMAT_RANGES:()=>ywi,aborted:()=>cge,allowsEval:()=>mwi,assert:()=>YWl,assertEqual:()=>$Wl,assertIs:()=>KWl,assertNever:()=>JWl,assertNotEqual:()=>HWl,assignProp:()=>sge,base64ToUint8Array:()=>jKs,base64urlToUint8Array:()=>m$l,cached:()=>u7e,captureStackTrace:()=>vpr,cleanEnum:()=>d$l,cleanRegex:()=>w1t,clone:()=>BR,cloneDef:()=>ZWl,createTransparentProxy:()=>o$l,defineLazy:()=>Tp,esc:()=>Ipr,escapeRegex:()=>S3,extend:()=>c$l,finalizeIssue:()=>zk,floatSafeRemainder:()=>fwi,getElementAtPath:()=>e$l,getEnumValues:()=>C1t,getLengthableOrigin:()=>_1t,getParsedType:()=>i$l,getSizableOrigin:()=>S1t,hexToUint8Array:()=>g$l,isObject:()=>XDe,isPlainObject:()=>age,issue:()=>l7e,joinValues:()=>$r,jsonStringifyReplacer:()=>c7e,merge:()=>l$l,mergeDefs:()=>$se,normalizeParams:()=>Di,nullish:()=>oge,numKeys:()=>n$l,objectClone:()=>XWl,omit:()=>a$l,optionalKeys:()=>Awi,parsedType:()=>hi,partial:()=>p$l,pick:()=>s$l,prefixIssues:()=>a6,primitiveTypes:()=>gwi,promiseAllObject:()=>t$l,propertyKeyTypes:()=>x1t,randomString:()=>r$l,required:()=>f$l,safeExtend:()=>u$l,shallowClone:()=>hwi,slugify:()=>dwi,stringifyPrimitive:()=>oi,uint8ArrayToBase64:()=>MKs,uint8ArrayToBase64url:()=>h$l,uint8ArrayToHex:()=>A$l,unwrapMessage:()=>v1t});function $Wl(e){return e}function HWl(e){return e}function KWl(e){}function JWl(e){throw new Error("Unexpected value in exhaustive check")}function YWl(e){}function C1t(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function $r(e,t="|"){return e.map(r=>oi(r)).join(t)}function c7e(e,t){return typeof t=="bigint"?t.toString():t}function u7e(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function oge(e){return e==null}function w1t(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function fwi(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(i=Number.parseInt(c[1]))}let o=r>i?r:i,s=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return s%a/10**o}var QKs=Symbol("evaluating");function Tp(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==QKs)return n===void 0&&(n=QKs,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function XWl(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function sge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function $se(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function ZWl(e){return $se(e._zod.def)}function e$l(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function t$l(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=n[o];return i})}function r$l(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Ipr(e){return JSON.stringify(e)}function dwi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var vpr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function XDe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var mwi=u7e(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function age(e){if(XDe(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(XDe(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function hwi(e){return age(e)?{...e}:Array.isArray(e)?[...e]:e}function n$l(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var i$l=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},x1t=new Set(["string","number","symbol"]),gwi=new Set(["string","number","bigint","boolean","symbol","undefined"]);function S3(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function BR(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Di(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function o$l(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,o){return t??(t=e()),Reflect.set(t,n,i,o)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function oi(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Awi(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ywi={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},bwi={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function s$l(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=$se(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=r.shape[a])}return sge(this,"shape",s),s},checks:[]});return BR(e,o)}function a$l(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=$se(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return sge(this,"shape",s),s},checks:[]});return BR(e,o)}function c$l(e,t){if(!age(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=$se(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return sge(this,"shape",o),o}});return BR(e,i)}function u$l(e,t){if(!age(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=$se(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return sge(this,"shape",n),n}});return BR(e,r)}function l$l(e,t){let r=$se(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return sge(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return BR(e,r)}function p$l(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=$se(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return sge(this,"shape",c),c},checks:[]});return BR(t,s)}function f$l(e,t,r){let n=$se(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new e({type:"nonoptional",innerType:i[s]}))}else for(let s in i)o[s]=new e({type:"nonoptional",innerType:i[s]});return sge(this,"shape",o),o}});return BR(t,n)}function cge(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function a6(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function v1t(e){return typeof e=="string"?e:e?.message}function zk(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=v1t(e.inst?._zod.def?.error?.(e))??v1t(t?.error?.(e))??v1t(r.customError?.(e))??v1t(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function S1t(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function _1t(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function hi(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function l7e(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function d$l(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function jKs(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function MKs(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function m$l(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return jKs(t+r)}function h$l(e){return MKs(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function g$l(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function A$l(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var pwi=class{constructor(...t){}};var LKs=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,c7e,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},B1t=Ar("$ZodError",LKs),Vk=Ar("$ZodError",LKs,{Parent:Error});function T1t(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function O1t(e,t=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let s=r,a=0;for(;a<o.path.length;){let c=o.path[a];a===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return n(e),r}function Ewi(e,t=r=>r.message){let r={errors:[]},n=(i,o=[])=>{var s,a;for(let c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>n({issues:u},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{let u=[...o,...c.path];if(u.length===0){r.errors.push(t(c));continue}let l=r,p=0;for(;p<u.length;){let d=u[p],f=p===u.length-1;typeof d=="string"?(l.properties??(l.properties={}),(s=l.properties)[d]??(s[d]={errors:[]}),l=l.properties[d]):(l.items??(l.items=[]),(a=l.items)[d]??(a[d]={errors:[]}),l=l.items[d]),f&&l.errors.push(t(c)),p++}}};return n(e),r}function UKs(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function Iwi(e){let t=[],r=[...e.issues].sort((n,i)=>(n.path??[]).length-(i.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${UKs(n.path)}`);return t.join(`
|
|
2465
2465
|
`)}var p7e=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new OG;if(s.issues.length){let a=new(i?.Err??e)(s.issues.map(c=>zk(c,o,iI())));throw vpr(a,i?.callee),a}return s.value},Cpr=p7e(Vk),f7e=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(i?.Err??e)(s.issues.map(c=>zk(c,o,iI())));throw vpr(a,i?.callee),a}return s.value},wpr=f7e(Vk),d7e=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new OG;return o.issues.length?{success:!1,error:new(e??B1t)(o.issues.map(s=>zk(s,i,iI())))}:{success:!0,data:o.value}},vwi=d7e(Vk),m7e=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>zk(s,i,iI())))}:{success:!0,data:o.value}},Cwi=m7e(Vk),xpr=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return p7e(e)(t,r,i)},b$l=xpr(Vk),Spr=e=>(t,r,n)=>p7e(e)(t,r,n),E$l=Spr(Vk),_pr=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return f7e(e)(t,r,i)},I$l=_pr(Vk),Bpr=e=>async(t,r,n)=>f7e(e)(t,r,n),v$l=Bpr(Vk),Tpr=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return d7e(e)(t,r,i)},C$l=Tpr(Vk),Opr=e=>(t,r,n)=>d7e(e)(t,r,n),w$l=Opr(Vk),Ppr=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return m7e(e)(t,r,i)},x$l=Ppr(Vk),Dpr=e=>async(t,r,n)=>m7e(e)(t,r,n),S$l=Dpr(Vk);var _3={};ne(_3,{base64:()=>Mwi,base64url:()=>Rpr,bigint:()=>Gwi,boolean:()=>$wi,browserEmail:()=>F$l,cidrv4:()=>Qwi,cidrv6:()=>jwi,cuid:()=>wwi,cuid2:()=>xwi,date:()=>Uwi,datetime:()=>Vwi,domain:()=>Q$l,duration:()=>Owi,e164:()=>Lwi,email:()=>Dwi,emoji:()=>Rwi,extendedDuration:()=>_$l,guid:()=>Pwi,hex:()=>j$l,hostname:()=>N$l,html5Email:()=>P$l,idnEmail:()=>R$l,integer:()=>Wwi,ipv4:()=>Fwi,ipv6:()=>kwi,ksuid:()=>Bwi,lowercase:()=>Jwi,mac:()=>Nwi,md5_base64:()=>L$l,md5_base64url:()=>U$l,md5_hex:()=>M$l,nanoid:()=>Twi,null:()=>Hwi,number:()=>Fpr,rfc5322Email:()=>D$l,sha1_base64:()=>V$l,sha1_base64url:()=>q$l,sha1_hex:()=>z$l,sha256_base64:()=>W$l,sha256_base64url:()=>$$l,sha256_hex:()=>G$l,sha384_base64:()=>K$l,sha384_base64url:()=>J$l,sha384_hex:()=>H$l,sha512_base64:()=>X$l,sha512_base64url:()=>Z$l,sha512_hex:()=>Y$l,string:()=>qwi,time:()=>zwi,ulid:()=>Swi,undefined:()=>Kwi,unicodeEmail:()=>zKs,uppercase:()=>Ywi,uuid:()=>ZDe,uuid4:()=>B$l,uuid6:()=>T$l,uuid7:()=>O$l,xid:()=>_wi});var wwi=/^[cC][^\s-]{8,}$/,xwi=/^[0-9a-z]+$/,Swi=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_wi=/^[0-9a-vA-V]{20}$/,Bwi=/^[A-Za-z0-9]{27}$/,Twi=/^[a-zA-Z0-9_-]{21}$/,Owi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_$l=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Pwi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ZDe=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,B$l=ZDe(4),T$l=ZDe(6),O$l=ZDe(7),Dwi=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,P$l=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,D$l=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,zKs=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,R$l=zKs,F$l=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,k$l="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Rwi(){return new RegExp(k$l,"u")}var Fwi=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,kwi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Nwi=e=>{let t=S3(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Qwi=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,jwi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mwi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rpr=/^[A-Za-z0-9_-]*$/,N$l=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Q$l=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Lwi=/^\+[1-9]\d{6,14}$/,VKs="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Uwi=new RegExp(`^${VKs}$`);function qKs(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function zwi(e){return new RegExp(`^${qKs(e)}$`)}function Vwi(e){let t=qKs({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${VKs}T(?:${n})$`)}var qwi=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Gwi=/^-?\d+n?$/,Wwi=/^-?\d+$/,Fpr=/^-?\d+(?:\.\d+)?$/,$wi=/^(?:true|false)$/i,Hwi=/^null$/i;var Kwi=/^undefined$/i;var Jwi=/^[^A-Z]*$/,Ywi=/^[^a-z]*$/,j$l=/^[0-9a-fA-F]*$/;function P1t(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function D1t(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var M$l=/^[0-9a-fA-F]{32}$/,L$l=P1t(22,"=="),U$l=D1t(22),z$l=/^[0-9a-fA-F]{40}$/,V$l=P1t(27,"="),q$l=D1t(27),G$l=/^[0-9a-fA-F]{64}$/,W$l=P1t(43,"="),$$l=D1t(43),H$l=/^[0-9a-fA-F]{96}$/,K$l=P1t(64,""),J$l=D1t(64),Y$l=/^[0-9a-fA-F]{128}$/,X$l=P1t(86,"=="),Z$l=D1t(86);var SA=Ar("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),WKs={number:"number",bigint:"bigint",object:"date"},kpr=Ar("$ZodCheckLessThan",(e,t)=>{SA.init(e,t);let r=WKs[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Npr=Ar("$ZodCheckGreaterThan",(e,t)=>{SA.init(e,t);let r=WKs[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xwi=Ar("$ZodCheckMultipleOf",(e,t)=>{SA.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):fwi(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Zwi=Ar("$ZodCheckNumberFormat",(e,t)=>{SA.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=ywi[t.format];e._zod.onattach.push(s=>{let a=s._zod.bag;a.format=t.format,a.minimum=i,a.maximum=o,r&&(a.pattern=Wwi)}),e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),exi=Ar("$ZodCheckBigIntFormat",(e,t)=>{SA.init(e,t);let[r,n]=bwi[t.format];e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,o.minimum=r,o.maximum=n}),e._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),txi=Ar("$ZodCheckMaxSize",(e,t)=>{var r;SA.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oge(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:S1t(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),rxi=Ar("$ZodCheckMinSize",(e,t)=>{var r;SA.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oge(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:S1t(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),nxi=Ar("$ZodCheckSizeEquals",(e,t)=>{var r;SA.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oge(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,o=i.size;if(o===t.size)return;let s=o>t.size;n.issues.push({origin:S1t(i),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ixi=Ar("$ZodCheckMaxLength",(e,t)=>{var r;SA.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oge(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let s=_1t(i);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),oxi=Ar("$ZodCheckMinLength",(e,t)=>{var r;SA.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oge(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let s=_1t(i);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),sxi=Ar("$ZodCheckLengthEquals",(e,t)=>{var r;SA.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oge(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,o=i.length;if(o===t.length)return;let s=_1t(i),a=o>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),h7e=Ar("$ZodCheckStringFormat",(e,t)=>{var r,n;SA.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),axi=Ar("$ZodCheckRegex",(e,t)=>{h7e.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),cxi=Ar("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Jwi),h7e.init(e,t)}),uxi=Ar("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ywi),h7e.init(e,t)}),lxi=Ar("$ZodCheckIncludes",(e,t)=>{SA.init(e,t);let r=S3(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),pxi=Ar("$ZodCheckStartsWith",(e,t)=>{SA.init(e,t);let r=new RegExp(`^${S3(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),fxi=Ar("$ZodCheckEndsWith",(e,t)=>{SA.init(e,t);let r=new RegExp(`.*${S3(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function GKs(e,t,r){e.issues.length&&t.issues.push(...a6(r,e.issues))}var dxi=Ar("$ZodCheckProperty",(e,t)=>{SA.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>GKs(i,r,t.property));GKs(n,r,t.property)}}),mxi=Ar("$ZodCheckMimeType",(e,t)=>{SA.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),hxi=Ar("$ZodCheckOverwrite",(e,t)=>{SA.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var R1t=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
@@ -2537,13 +2537,13 @@ Hint: Values starting with "@" (such as scoped npm packages) must be wrapped in
|
|
|
2537
2537
|
`)}];let f=typeof d=="string"?d:d.type;if(typeof f!="string")return o$a(p);let m=n.resolveType({type:f,file:o});if(m==null)return[];let h=typeof t.extends>"u"?[]:typeof t.extends=="string"?[t.extends]:t.extends;if(t["base-properties"]!=null||h.length>0){let C={properties:t["base-properties"],extends:h},x=OU({typeName:void 0,objectDeclaration:C,typeResolver:n,definitionFile:o.definitionFile,workspace:s,filepathOfDeclaration:o.relativeFilepath,smartCasing:!1}),B=new Set(x.map(T=>T.wireKey)),F=PNe({typeName:e,typeNameForBreadcrumb:e,rawObject:C,file:o,example:p,typeResolver:n,exampleResolver:i,workspace:s,breadcrumbs:a,depth:c+1}).filter(T=>{let L=T.message.toLowerCase();if(L.includes("unexpected property")){let K=L.match(/unexpected property "([^"]+)"/);if(K&&K[1]&&!B.has(K[1]))return!1}return!0});if(F.length>0)return F}if(m._type==="named"&&sf(m.declaration)){let C=Object.fromEntries(Object.entries(p).filter(([O])=>!(t["base-properties"]?.[O]!=null||h.some(F=>{let T=n.resolveNamedType({referenceToNamedType:F,file:o});return T?._type==="named"&&sf(T.declaration)?T.declaration.properties?.[O]!=null:!1})))),B=m.declaration.properties?.[u]!=null||(typeof m.declaration.extends>"u"?[]:typeof m.declaration.extends=="string"?[m.declaration.extends]:m.declaration.extends).some(F=>{let T=n.resolveNamedType({referenceToNamedType:F,file:m.file});return T?._type==="named"&&sf(T.declaration)?T.declaration.properties?.[u]!=null:!1})?{[u]:l,...C}:C;return PNe({typeName:e,typeNameForBreadcrumb:e,rawObject:m.declaration,file:m.file,example:B,typeResolver:n,exampleResolver:i,workspace:s,breadcrumbs:a,depth:c+1})}let A=typeof d!="string"&&typeof d.key=="string"?d.key:void 0;if(A==null)return[];let{[A]:b,...v}=p,w=[];return typeof b>"u"?w.push({message:`Missing property "${A}"`}):w.push(...t_({rawTypeReference:f,example:b,typeResolver:n,exampleResolver:i,file:o,workspace:s,breadcrumbs:a,depth:c+1})),w.push(...o$a(v)),w}function o$a(e){return Object.keys(e).map(t=>({severity:"fatal",message:`Unexpected property "${t}"`}))}function aDr({typeName:e,typeDeclaration:t,file:r,typeResolver:n,exampleResolver:i,example:o,workspace:s,breadcrumbs:a,depth:c}){return nv(t,{alias:u=>r$a({rawAlias:u,file:r,typeResolver:n,exampleResolver:i,example:o,workspace:s,breadcrumbs:a,depth:c}),enum:u=>n$a({rawEnum:u,example:o,breadcrumbs:a}),object:u=>PNe({typeName:e,typeNameForBreadcrumb:e,rawObject:u,example:o,file:r,typeResolver:n,exampleResolver:i,workspace:s,breadcrumbs:a,depth:c}),discriminatedUnion:u=>s$a({typeName:e,rawUnion:u,example:o,file:r,typeResolver:n,exampleResolver:i,workspace:s,breadcrumbs:a,depth:c}),undiscriminatedUnion:u=>i$a({rawUnion:u,example:o,file:r,typeResolver:n,exampleResolver:i,workspace:s,breadcrumbs:a,depth:c})})}var xYi=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,nOf=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,iOf=/^\d{4}-\d{2}-\d{2}$/,oOf=/^(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s+)?\d{1,2}\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{2,4}\s+\d{2}:\d{2}(?::\d{2})?\s+(?:[+-]\d{4}|[A-Z]{2,3})$/i,sOf=128;function t_({rawTypeReference:e,example:t,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:s,depth:a}){if(a>sOf)return[{message:"Example is too deeply nested. This may indicate a circular reference. Example generation was truncated.",severity:"warning"}];if(typeof t=="string"&&t.startsWith("$")){let c=r.resolveType({type:e,file:i});if(c==null)return[];let u=n.parseExampleReference(t);if(u==null)return[];let l=r.resolveNamedType({referenceToNamedType:u.rawTypeReference,file:i});return l==null?[]:KYe({expected:c,actual:l})?[]:[{message:`Expected example to be: ${e}. Example is ${t}.`}]}return wDe({type:e,_default:void 0,validation:void 0,visitor:{primitive:c=>aOf({primitiveType:c,example:t}),named:c=>{let u=r.getDeclarationOfNamedType({referenceToNamedType:c,file:i});return u==null?[]:aDr({typeName:u.typeName,typeDeclaration:u.declaration,file:u.file,example:t,typeResolver:r,exampleResolver:n,workspace:o,breadcrumbs:s,depth:a+1})},map:({keyType:c,valueType:u})=>Lo(t)?Object.entries(t).flatMap(([l,p])=>[...t_({rawTypeReference:c,example:l,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:[...s,l],depth:a+1}),...t_({rawTypeReference:u,example:p,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:[...s,l],depth:a+1})]):TU(t,"a map"),list:c=>Array.isArray(t)?t.flatMap((u,l)=>t_({rawTypeReference:c,example:u,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:[...s,`${l}`],depth:a+1})):TU(t,"a list"),set:c=>{if(!Array.isArray(t))return TU(t,"a list");let u=dZt(t);return u.length>0?[{severity:"fatal",message:`Set has duplicate elements:
|
|
2538
2538
|
`+u.map(l=>` - ${JSON.stringify(l)}`).join(`
|
|
2539
2539
|
`)}]:t.flatMap((l,p)=>t_({rawTypeReference:c,example:l,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:[...s,`${p}`],depth:a+1}))},optional:c=>t==null?[]:t_({rawTypeReference:c,example:t,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:s,depth:a+1}),nullable:c=>t===null?[]:t_({rawTypeReference:c,example:t,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:s,depth:a+1}),unknown:()=>[],literal:c=>{switch(c.type){case"boolean":return BN(u=>u===c.boolean,c.boolean.toString())(t);case"string":return BN(u=>u===c.string||fOf(c.string,u),`"${c.string}"`)(t);default:Ce(c)}}}})}function aOf({primitiveType:e,example:t}){return e.v2!=null?ti._visit(e.v2,{integer:r=>cOf({example:t,rules:r.validation}),long:()=>l$a(t),uint:()=>a$a(t),uint64:()=>c$a(t),double:r=>uOf({example:t,rules:r.validation}),float:()=>u$a(t),boolean:()=>p$a(t),string:r=>lOf({example:t,rules:r.validation}),uuid:()=>f$a(t),date:()=>m$a(t),dateTime:()=>d$a(t),dateTimeRfc2822:()=>h$a(t),base64:()=>HYe(t),bigInteger:()=>HYe(t),_other:()=>{throw new N({message:"Unknown primitive type v2: "+e.v2,code:N.Code.InternalError})}}):fs._visit(e.v1,{integer:()=>g$a(t),long:()=>l$a(t),uint:()=>a$a(t),uint64:()=>c$a(t),double:()=>A$a(t),float:()=>u$a(t),boolean:()=>p$a(t),string:()=>HYe(t),uuid:()=>f$a(t),dateTime:()=>d$a(t),dateTimeRfc2822:()=>h$a(t),date:()=>m$a(t),base64:()=>HYe(t),bigInteger:()=>HYe(t),_other:()=>{throw new N({message:"Unknown primitive type: "+e.v1,code:N.Code.InternalError})}})}function cOf({example:e,rules:t}){let r=g$a(e);if(r.length>0||t==null)return r;let n=e;return t.min!=null&&(t.exclusiveMin&&n<=t.min||!t.exclusiveMin&&n<t.min)?[{message:`Expected integer to be greater than or equal to ${t.min}. Example is ${e}.`}]:t.max!=null&&(t.exclusiveMax&&n>=t.max||!t.exclusiveMax&&n>t.max)?[{message:`Expected integer to be less than or equal to ${t.max}. Example is ${e}.`}]:t.multipleOf!=null&&n%t.multipleOf!==0?[{message:`Expected integer to be a multiple of ${t.multipleOf}. Example is ${e}.`}]:[]}function uOf({example:e,rules:t}){let r=A$a(e);if(r.length>0||t==null)return r;let n=e;return t.min!=null&&(t.exclusiveMin&&n<=t.min||!t.exclusiveMin&&n<t.min)?[{message:`Expected double to be greater than or equal to ${t.min}. Example is ${e}.`}]:t.max!=null&&(t.exclusiveMax&&n>=t.max||!t.exclusiveMax&&n>t.max)?[{message:`Expected double to be less than or equal to ${t.max}. Example is ${e}.`}]:t.multipleOf!=null&&n%t.multipleOf!==0?[{message:`Expected double to be a multiple of ${t.multipleOf}. Example is ${e}.`}]:[]}function lOf({example:e,rules:t}){let r=HYe(e);if(r.length>0||t==null)return r;let n=e;return t.minLength!=null&&n.length<t.minLength?[{message:`Expected string length to be greater than or equal to ${t.minLength}. Example is ${e}, which is of length ${n.length}.`}]:t.maxLength!=null&&n.length>t.maxLength?[{message:`Expected string length to be less than or equal to ${t.maxLength}. Example is ${e}, which is of length ${n.length}.`}]:t.pattern!=null&&!new RegExp(t.pattern).test(n)?[{message:`Expected string to match pattern ${t.pattern}. Example is ${e}.`}]:[]}var HYe=BN(e=>typeof e=="string","a string"),g$a=BN(e=>Number.isInteger(e),"an integer"),a$a=BN(e=>Number.isInteger(e)&&typeof e=="number"&&e>=0,"a uint"),c$a=BN(e=>Number.isInteger(e)&&typeof e=="number"&&e>=0,"a uint64"),u$a=BN(e=>typeof e=="number","a float"),A$a=BN(e=>typeof e=="number","a double"),l$a=BN(e=>Number.isInteger(e),"an integer"),p$a=BN(e=>typeof e=="boolean","a boolean"),f$a=BN(e=>typeof e=="string"&&nOf.test(e),"a UUID"),d$a=BN(e=>typeof e=="string"&&xYi.test(e),"an ISO 8601 timestamp"),m$a=BN(e=>typeof e=="string"&&iOf.test(e)&&xYi.test(e),"a date"),h$a=BN(e=>typeof e=="string"&&(oOf.test(e)||xYi.test(e)),"an RFC 2822 or ISO 8601 timestamp");function BN(e,t){return r=>e(r)?[]:TU(r,t)}function KYe({expected:e,actual:t}){if(e._type==="unknown")return!0;if(e._type==="primitive")return t._type==="primitive"&&e.primitive.v1===t.primitive.v1;if(e._type==="container")switch(e.container._type){case"list":case"set":return t._type==="container"&&t.container._type===e.container._type&&KYe({expected:e.container.itemType,actual:t.container.itemType});case"optional":return KYe({expected:e.container.itemType,actual:t._type==="container"&&t.container._type==="optional"?t.container.itemType:t});case"nullable":return KYe({expected:e.container.itemType,actual:t._type==="container"&&t.container._type==="nullable"?t.container.itemType:t});case"map":return t._type==="container"&&t.container._type===e.container._type&&KYe({expected:e.container.keyType,actual:t.container.keyType})&&KYe({expected:e.container.valueType,actual:t.container.valueType});case"literal":return t._type!=="container"||t.container._type!==e.container._type?!1:pOf({expected:e.container.literal,actual:t.container.literal});default:Ce(e.container)}if(e._type==="named")return t._type==="named"&&t.filepath===e.filepath&&t.rawName===e.rawName;Ce(e)}function pOf({expected:e,actual:t}){switch(e.type){case"boolean":return t.type==="boolean"?e.boolean===t.boolean:!1;case"string":return t.type==="string"?e.string===t.string:!1;default:Ce(e)}}function fOf(e,t){if(typeof t!="string")return!1;let r=Vf.parse(e),n=Vf.parse(t);return r==null||n==null?!1:!!(r.isJSON()&&n.isJSON())}function cDr({_enum:e,file:t}){let r=e.enum.map(i=>({...e_(i),name:t.casingsGenerator.generateNameAndWireValue({wireValue:typeof i=="string"?i:i.value,name:JYe(i).name,opts:{casingOverrides:typeof i!="string"?i.casing:void 0}})})),n;if(e.default!=null&&(n=r.find(i=>er(i.name)===e.default),n==null))throw new N({message:`Default value ${e.default} not found in enum values`,code:N.Code.ValidationError});return{default:n,values:r,forwardCompatible:e["forward-compatible"]||void 0}}function y$a(e,t){let r=t.enum.find(n=>typeof n=="string"?!1:n.value===e);return{name:typeof r=="string"?e:r?.name??e,wasExplicitlySet:!1}}function JYe(e){return typeof e=="string"?{name:e,wasExplicitlySet:!1}:e.name==null?{name:e.value,wasExplicitlySet:!1}:{name:e.name,wasExplicitlySet:!0}}var dOf=128;function SYi({typeName:e,typeDeclaration:t,example:r,typeResolver:n,exampleResolver:i,fileContainingType:o,fileContainingExample:s,workspace:a,recursionContext:c}){return nv(t,{alias:u=>Uu.alias({value:vf({example:r,rawTypeBeingExemplified:typeof u=="string"?u:u.type,fileContainingRawTypeReference:o,fileContainingExample:s,typeResolver:n,exampleResolver:i,workspace:a,recursionContext:c})}),object:u=>b$a({typeName:e,rawObject:u,example:r,fileContainingType:o,fileContainingExample:s,typeResolver:n,exampleResolver:i,workspace:a,recursionContext:c}),discriminatedUnion:u=>{let l=Aue(u);if(!Lo(r))throw new N({message:"Example is not an object",code:N.Code.ValidationError});let p=r[l];if(p==null)throw new N({message:"Example is missing discriminant: "+l,code:N.Code.ValidationError});if(typeof p!="string")throw new N({message:"Discriminant value is not a string",code:N.Code.ValidationError});let d=u.union[p];if(d==null)throw new N({message:`${p} is not one of the specified discriminant values.`,code:N.Code.ValidationError});let f=typeof d=="string"?d:typeof d.type=="string"?d.type:void 0,m=Object.entries(u["base-properties"]??{}).map(([A,b])=>{let v=r[A];if(v!=null)return{name:s.casingsGenerator.generateNameAndWireValue({name:A,wireValue:A}),value:vf({example:v,rawTypeBeingExemplified:typeof b=="string"?b:b.type,fileContainingRawTypeReference:o,fileContainingExample:s,typeResolver:n,exampleResolver:i,workspace:a,recursionContext:c})}}).filter(A=>A!=null),h=(typeof u.extends>"u"?[]:typeof u.extends=="string"?[u.extends]:u.extends).flatMap(A=>{let b=n.resolveNamedTypeOrThrow({file:o,referenceToNamedType:A});if(b._type!=="named"||!sf(b.declaration))throw new N({message:"Extended type is not a named object",code:N.Code.InternalError});let v=b.declaration;return Object.entries(v.properties??{}).map(([C,x])=>{let B=r[C];if(B!=null)return{name:s.casingsGenerator.generateNameAndWireValue({name:typeof x=="string"?C:x.name??C,wireValue:C}),value:vf({example:B,rawTypeBeingExemplified:typeof x=="string"?x:x.type,fileContainingRawTypeReference:o,fileContainingExample:s,typeResolver:n,exampleResolver:i,workspace:a,recursionContext:c}),propertyAccess:H0e({property:x}),originalTypeDeclaration:e}}).filter(C=>C!=null)});return Uu.union({discriminant:s.casingsGenerator.generateNameAndWireValue({name:WYe(u).name,wireValue:l}),singleUnionType:hOf({rawValueType:f,rawSingleUnionType:d,fileContainingType:o,fileContainingExample:s,typeResolver:n,exampleResolver:i,example:r,discriminantValueForExample:p,workspace:a,recursionContext:c}),baseProperties:m,extendProperties:h})},enum:u=>{if(typeof r!="string"){let l=u.enum.map(p=>typeof p=="string"?p:p.value).join(", ");throw new N({message:`Expected one of ${l}. Received ${r}`,code:N.Code.ValidationError})}return Uu.enum({value:s.casingsGenerator.generateNameAndWireValue({name:y$a(r,u).name,wireValue:r})})},undiscriminatedUnion:u=>{for(let[d,f]of u.union.entries())if(t_({rawTypeReference:typeof f=="string"?f:f.type,example:r,typeResolver:n,exampleResolver:i,file:o,workspace:a,breadcrumbs:[],depth:0}).length===0)return Uu.undiscriminatedUnion({index:d,singleUnionType:vf({example:r,rawTypeBeingExemplified:typeof f=="string"?f:f.type,fileContainingRawTypeReference:o,fileContainingExample:s,typeResolver:n,exampleResolver:i,workspace:a,recursionContext:c})});let p=u.union.map(d=>typeof d=="string"?d:d.type).join(", ");throw new N({message:`Expected one of ${p}. Received ${r}`,code:N.Code.ValidationError})}})}function vf({example:e,fileContainingExample:t,rawTypeBeingExemplified:r,fileContainingRawTypeReference:n,typeResolver:i,exampleResolver:o,workspace:s,recursionContext:a}){let c=a??{depth:0,seenTypeIds:new Set},{resolvedExample:u,file:l}=o.resolveExampleOrThrow({example:e,file:t}),p=o.resolveAllReferencesInExampleOrThrow({example:e,file:t}).resolvedExample;return{shape:wDe({type:r,_default:void 0,validation:void 0,visitor:{primitive:f=>mOf({example:u,typeBeingExemplified:f.v1}),map:({keyType:f,valueType:m})=>{if(!Lo(u))throw new N({message:"Example is not an object",code:N.Code.ValidationError});let h={depth:c.depth+1,seenTypeIds:c.seenTypeIds};return mo.container(Al.map({map:Object.entries(u).map(([A,b])=>({key:vf({example:A,fileContainingExample:l,rawTypeBeingExemplified:f,fileContainingRawTypeReference:n,typeResolver:i,exampleResolver:o,workspace:s,recursionContext:h}),value:vf({example:b,fileContainingExample:l,rawTypeBeingExemplified:m,fileContainingRawTypeReference:n,typeResolver:i,exampleResolver:o,workspace:s,recursionContext:h})})),keyType:n.parseTypeReference(f),valueType:n.parseTypeReference(m)}))},list:f=>{if(!Array.isArray(u))throw new N({message:"Example is not a list",code:N.Code.ValidationError});let m={depth:c.depth+1,seenTypeIds:c.seenTypeIds};return mo.container(Al.list({list:u.map(h=>vf({example:h,fileContainingExample:l,rawTypeBeingExemplified:f,fileContainingRawTypeReference:n,typeResolver:i,exampleResolver:o,workspace:s,recursionContext:m})),itemType:n.parseTypeReference(f)}))},set:f=>{if(!Array.isArray(u))throw new N({message:"Example is not a list",code:N.Code.ValidationError});let m={depth:c.depth+1,seenTypeIds:c.seenTypeIds};return mo.container(Al.set({set:u.map(h=>vf({example:h,fileContainingExample:l,rawTypeBeingExemplified:f,fileContainingRawTypeReference:n,typeResolver:i,exampleResolver:o,workspace:s,recursionContext:m})),itemType:n.parseTypeReference(f)}))},optional:f=>{let m={depth:c.depth+1,seenTypeIds:c.seenTypeIds};return mo.container(Al.optional({optional:u!=null?vf({example:u,fileContainingExample:l,rawTypeBeingExemplified:f,fileContainingRawTypeReference:n,typeResolver:i,exampleResolver:o,workspace:s,recursionContext:m}):void 0,valueType:n.parseTypeReference(f)}))},nullable:f=>{let m={depth:c.depth+1,seenTypeIds:c.seenTypeIds};return mo.container(Al.nullable({nullable:u!=null?vf({example:u,fileContainingExample:l,rawTypeBeingExemplified:f,fileContainingRawTypeReference:n,typeResolver:i,exampleResolver:o,workspace:s,recursionContext:m}):void 0,valueType:n.parseTypeReference(f)}))},literal:f=>{switch(f.type){case"boolean":return mo.container(Al.literal({literal:Bi.boolean(f.boolean)}));case"string":return mo.container(Al.literal({literal:Bi.string({original:f.string})}));default:Ce(f)}},named:f=>{let m=i.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:r,file:n}),h=n.parseTypeReference(f);if(h.type!=="named")throw new N({message:"Type reference is not to a named type.",code:N.Code.InternalError});let A={typeId:h.typeId,fernFilepath:h.fernFilepath,name:h.name,displayName:h.displayName};if(c.depth>dOf||c.seenTypeIds.has(h.typeId))return mo.unknown(p);let b={depth:c.depth+1,seenTypeIds:new Set(c.seenTypeIds).add(h.typeId)};return mo.named({typeName:A,shape:SYi({typeName:A,typeDeclaration:m.declaration,fileContainingType:m.file,fileContainingExample:l,example:u,typeResolver:i,exampleResolver:o,workspace:s,recursionContext:b})})},unknown:()=>mo.unknown(p)}}),jsonExample:p}}function _Yi({example:e}){return mo.unknown(e)}function mOf({example:e,typeBeingExemplified:t}){return fs._visit(t,{string:()=>{if(typeof e!="string")return mo.primitive(Bi.string({original:ji.STRING}));let r=e.startsWith(`\\${"$"}`)?e.slice(1):e;return mo.primitive(Bi.string({original:r}))},dateTime:()=>typeof e!="string"?mo.primitive(Bi.string({original:ji.DATE_TIME})):mo.primitive(Bi.datetime({datetime:new Date(e),raw:e})),date:()=>typeof e!="string"?mo.primitive(Bi.string({original:ji.DATE})):mo.primitive(Bi.date(e)),base64:()=>typeof e!="string"?mo.primitive(Bi.string({original:ji.BASE64})):mo.primitive(Bi.string({original:e})),uint:()=>typeof e!="number"?mo.primitive(Bi.uint(ji.UINT)):mo.primitive(Bi.uint(e)),uint64:()=>typeof e!="number"?mo.primitive(Bi.uint64(ji.UINT64)):mo.primitive(Bi.uint64(e)),integer:()=>typeof e!="number"?mo.primitive(Bi.integer(ji.INT)):mo.primitive(Bi.integer(e)),float:()=>typeof e!="number"?mo.primitive(Bi.float(ji.FLOAT)):mo.primitive(Bi.float(e)),double:()=>typeof e!="number"?mo.primitive(Bi.double(ji.DOUBLE)):mo.primitive(Bi.double(e)),long:()=>typeof e!="number"?mo.primitive(Bi.long(ji.UINT)):mo.primitive(Bi.long(e)),boolean:()=>typeof e!="boolean"?mo.primitive(Bi.boolean(ji.BOOLEAN)):mo.primitive(Bi.boolean(e)),uuid:()=>typeof e!="string"?mo.primitive(Bi.string({original:ji.UUID})):mo.primitive(Bi.uuid(e)),bigInteger:()=>typeof e!="string"?mo.primitive(Bi.string({original:ji.BIG_INTEGER})):mo.primitive(Bi.string({original:e})),dateTimeRfc2822:()=>typeof e!="string"?mo.primitive(Bi.datetime({datetime:new Date(ji.DATE_TIME),raw:ji.DATE_TIME})):mo.primitive(Bi.datetime({datetime:new Date(e),raw:e})),_other:()=>{throw new N({message:"Unknown primitive type: "+t,code:N.Code.InternalError})}})}function b$a({typeName:e,rawObject:t,example:r,fileContainingType:n,fileContainingExample:i,typeResolver:o,exampleResolver:s,workspace:a,recursionContext:c}){if(!Lo(r))throw new N({message:`Example is not an object. Got: ${JSON.stringify(r)}`,code:N.Code.ValidationError});let u=Object.entries(r).map(([d,f])=>{let m=E$a({typeName:e,wirePropertyKey:d,rawObject:t,typeResolver:o,file:n});return[d,f,m]}),l=u.filter(([,,d])=>d!=null),p=u.filter(([,,d])=>d==null);return Uu.object({properties:t.properties!=null||t.extends!=null?l.map(([d,f,m])=>{let h=vf({example:f,fileContainingExample:i,rawTypeBeingExemplified:typeof m.rawPropertyType=="string"?m.rawPropertyType:m.rawPropertyType.type,fileContainingRawTypeReference:m.file,typeResolver:o,exampleResolver:s,workspace:a,recursionContext:c});return{name:i.casingsGenerator.generateNameAndWireValue({name:qC({propertyKey:d,property:m.rawPropertyType}).name,wireValue:d}),value:h,originalTypeDeclaration:m.typeName,propertyAccess:H0e({property:m.rawPropertyType})}}):[],extraProperties:t["extra-properties"]!==!0||p.length===0?void 0:p.map(([d,f])=>({name:i.casingsGenerator.generateNameAndWireValue({name:d,wireValue:d}),value:{shape:_Yi({example:f}),jsonExample:f}}))})}function E$a({typeName:e,wirePropertyKey:t,rawObject:r,typeResolver:n,file:i}){let o=r.properties?.[t];return o!=null?{typeName:e,rawPropertyType:o,file:i}:mkt({wirePropertyKey:t,extends_:r.extends,typeResolver:n,file:i})}function mkt({wirePropertyKey:e,extends_:t,typeResolver:r,file:n}){if(t!=null){let i=typeof t=="string"?[t]:t;for(let o of i){let s=r.resolveNamedTypeOrThrow({referenceToNamedType:o,file:n});if(s._type!=="named"||!sf(s.declaration))throw new N({message:"Extension is not of a named object",code:N.Code.InternalError});let a=E$a({wirePropertyKey:e,rawObject:s.declaration,typeResolver:r,typeName:s.name,file:s.file});if(a!=null)return a}}}function hOf({rawValueType:e,rawSingleUnionType:t,fileContainingType:r,fileContainingExample:n,typeResolver:i,exampleResolver:o,example:s,discriminantValueForExample:a,workspace:c,recursionContext:u}){let l=n.casingsGenerator.generateNameAndWireValue({name:$Ye({unionKey:a,rawSingleUnionType:t}).name,wireValue:a});if(e==null)return{wireDiscriminantValue:l,shape:Zt.ExampleSingleUnionTypeProperties.noProperties()};let p=wYi({rawSingleUnionType:t,rawValueType:e,parsedValueType:r.parseTypeReference(e),file:r,typeResolver:i});switch(p.propertiesType){case"singleProperty":{if(!Lo(s))throw new N({message:"Example is not an object",code:N.Code.ValidationError});return{wireDiscriminantValue:l,shape:Zt.ExampleSingleUnionTypeProperties.singleProperty(vf({example:s[er(p.name)],rawTypeBeingExemplified:e,typeResolver:i,exampleResolver:o,fileContainingRawTypeReference:r,fileContainingExample:n,workspace:c,recursionContext:u}))}}case"samePropertiesAsObject":{if(!Lo(s))throw new N({message:"Example is not an object",code:N.Code.ValidationError});let d=i.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:e,file:r});for(;Khe(d.declaration);)d=i.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:typeof d.declaration=="string"?d.declaration:d.declaration.type,file:r});if(!sf(d.declaration))throw new N({message:`${e} is not an object`,code:N.Code.ValidationError});let f={typeId:p.typeId,fernFilepath:p.fernFilepath,name:p.name,displayName:p.displayName};return{wireDiscriminantValue:l,shape:Zt.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeId:Jl.generateTypeId(f),object:b$a({rawObject:d.declaration,example:s,fileContainingType:d.file,fileContainingExample:n,typeResolver:i,exampleResolver:o,typeName:f,workspace:c,recursionContext:u})})}}default:Ce(p)}}function uDr({file:e,queryParameterKey:t,queryParameter:r}){let{name:n}=bue({queryParameterKey:t,queryParameter:r}),i=e.parseTypeReference(r),o=typeof r!="string"?r["client-default"]:void 0;return{...e_(r),name:e.casingsGenerator.generateNameAndWireValue({wireValue:t,name:n}),valueType:i,allowMultiple:typeof r!="string"&&r["allow-multiple"]!=null?r["allow-multiple"]:!1,clientDefault:lkt(o),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}},explode:typeof r!="string"&&r.explode!=null?r.explode:void 0}}function bue({queryParameterKey:e,queryParameter:t}){return typeof t!="string"&&t.name!=null?{name:t.name,wasExplicitlySet:!0}:{name:e,wasExplicitlySet:!1}}function v$a({service:e,endpoint:t,example:r,typeResolver:n,errorResolver:i,exampleResolver:o,variableResolver:s,file:a,workspace:c}){let u=AOf({service:e,endpoint:t,example:r,typeResolver:n,exampleResolver:o,variableResolver:s,file:a,workspace:c});return{id:r.name??q0e(r),name:r.name!=null?a.casingsGenerator.generateName(r.name):void 0,docs:r.docs,url:vOf({file:a,service:e,endpoint:t,example:r,pathParams:u}),...u,...yOf({service:e,endpoint:t,example:r,typeResolver:n,exampleResolver:o,file:a,workspace:c}),queryParameters:r["query-parameters"]!=null?Object.entries(r["query-parameters"]).map(([l,p])=>{let d=typeof t.request!="string"?t.request?.["query-parameters"]?.[l]:void 0;if(d==null)throw new N({message:`Query parameter ${l} does not exist`,code:N.Code.ReferenceError});let f=typeof d!="string"&&d["allow-multiple"]===!0,m=typeof d=="string"?d:d.type,h;if(f&&Array.isArray(p)){let A=p.map(b=>vf({example:b,rawTypeBeingExemplified:m,typeResolver:n,exampleResolver:o,fileContainingRawTypeReference:a,fileContainingExample:a,workspace:c}));h={jsonExample:p,shape:mo.container(Al.list({list:A,itemType:a.parseTypeReference(m)}))}}else h=vf({example:p,rawTypeBeingExemplified:m,typeResolver:n,exampleResolver:o,fileContainingRawTypeReference:a,fileContainingExample:a,workspace:c});return{name:a.casingsGenerator.generateNameAndWireValue({name:bue({queryParameterKey:l,queryParameter:d}).name,wireValue:l}),value:h,shape:gOf({queryParameter:d})}}):[],request:bOf({endpoint:t,example:r,typeResolver:n,exampleResolver:o,file:a,workspace:c}),response:EOf({endpoint:t,example:r,typeResolver:n,errorResolver:i,exampleResolver:o,file:a,workspace:c})}}function gOf({queryParameter:e}){return(typeof e!="string"&&e["allow-multiple"]!=null?e["allow-multiple"]:!1)?$w.exploded():$w.single()}function AOf({service:e,endpoint:t,example:r,typeResolver:n,exampleResolver:i,variableResolver:o,file:s,workspace:a}){let c=[],u=[],l=[],p=({name:d,pathParameterDeclaration:f,examplePathParameter:m})=>{let h=hkt({parameter:f,variableResolver:o,file:s});return{name:d,value:vf({example:m,rawTypeBeingExemplified:h.rawType,typeResolver:n,exampleResolver:i,fileContainingRawTypeReference:h.file,fileContainingExample:s,workspace:a})}};if(r["path-parameters"]!=null){let d=T7(t);for(let[f,m]of Object.entries(r["path-parameters"])){let h=s.rootApiFile["path-parameters"]?.[f],A=e["path-parameters"]?.[f],b=d[f];if(h!=null)c.push(p({name:s.casingsGenerator.generateName(f),pathParameterDeclaration:h,examplePathParameter:m}));else if(b!=null)l.push(p({name:s.casingsGenerator.generateName(f),pathParameterDeclaration:b,examplePathParameter:m}));else if(A!=null)u.push(p({name:s.casingsGenerator.generateName(f),pathParameterDeclaration:A,examplePathParameter:m}));else throw new N({message:`Path parameter ${f} does not exist`,code:N.Code.ReferenceError})}}return{rootPathParameters:c,endpointPathParameters:l,servicePathParameters:u}}function yOf({service:e,endpoint:t,example:r,typeResolver:n,exampleResolver:i,file:o,workspace:s}){let a=[],c=[];if(r.headers!=null)for(let[u,l]of Object.entries(r.headers)){let p=typeof t.request!="string"?t.request?.headers?.[u]:void 0,d=e.headers?.[u];p!=null?c.push({name:o.casingsGenerator.generateNameAndWireValue({name:kY({headerKey:u,header:p}).name,wireValue:u}),value:vf({example:l,rawTypeBeingExemplified:typeof p=="string"?p:p.type,typeResolver:n,exampleResolver:i,fileContainingRawTypeReference:o,fileContainingExample:o,workspace:s})}):d!=null&&a.push({name:o.casingsGenerator.generateNameAndWireValue({name:kY({headerKey:u,header:d}).name,wireValue:u}),value:vf({example:l,rawTypeBeingExemplified:typeof d=="string"?d:d.type,typeResolver:n,exampleResolver:i,fileContainingRawTypeReference:o,fileContainingExample:o,workspace:s})})}return{endpointHeaders:c,serviceHeaders:a}}function bOf({endpoint:e,example:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){let s=typeof e.request!="string"?e.request?.body:e.request;if(s==null||typeof s=="string"&&L_t(s)!=null)return;if(!gg(s))return ZT.reference(vf({example:t.request,rawTypeBeingExemplified:typeof s!="string"?s.type:s,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:i,fileContainingExample:i,workspace:o}));if(!t.request)return;if(!Lo(t.request))throw new N({message:`Example is not an object. Got: ${JSON.stringify(t.request)}`,code:N.Code.ValidationError});let a=[],c=[];for(let[u,l]of Object.entries(t.request)){let p=s.properties?.[u],d=typeof p=="string"?p:p?.type;if(!(d!=null&&Qk(d)!=null))if(p!=null)a.push({name:i.casingsGenerator.generateNameAndWireValue({name:qC({propertyKey:u,property:p}).name,wireValue:u}),value:vf({example:l,rawTypeBeingExemplified:typeof p!="string"?p.type:p,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:i,fileContainingExample:i,workspace:o}),originalTypeDeclaration:void 0});else{let f=mkt({extends_:s.extends,wirePropertyKey:u,typeResolver:r,file:i});if(f==null){if(s["extra-properties"]===!0){c.push({name:i.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u}),value:{jsonExample:l,shape:_Yi({example:l})}});continue}throw new N({message:"Could not find original type declaration for property: "+u,code:N.Code.ResolutionError})}a.push({name:i.casingsGenerator.generateNameAndWireValue({name:qC({propertyKey:u,property:f.rawPropertyType}).name,wireValue:u}),value:vf({example:l,rawTypeBeingExemplified:typeof f.rawPropertyType=="string"?f.rawPropertyType:f.rawPropertyType.type,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:f.file,fileContainingExample:i,workspace:o}),originalTypeDeclaration:f.typeName})}}return ZT.inlinedRequestBody({jsonExample:n.resolveAllReferencesInExampleOrThrow({example:t.request,file:i}).resolvedExample,properties:a,extraProperties:c.length>0?c:void 0})}function EOf({endpoint:e,example:t,typeResolver:r,errorResolver:n,exampleResolver:i,file:o,workspace:s}){return t.response==null?Ag.ok(vA.body(void 0)):_De(e,t.response,{body:a=>{if(a.error!=null){let c=n.getDeclarationOrThrow(a.error,o);return Ag.error({error:K0e({errorName:a.error,file:o}),body:c.declaration.type!=null?vf({example:a.body,rawTypeBeingExemplified:c.declaration.type,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:c.file,fileContainingExample:o,workspace:s}):void 0})}return Ag.ok(vA.body(IOf({endpoint:e,example:a,typeResolver:r,exampleResolver:i,file:o,workspace:s})))},stream:a=>{let c=typeof e["response-stream"]=="string"?e["response-stream"]:e["response-stream"]?.type;return Ag.ok(vA.stream(a.stream.map(u=>{if(c!=null)return vf({example:u,rawTypeBeingExemplified:c,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:o,fileContainingExample:o,workspace:s})}).filter(Fa)))},events:a=>{let c=typeof e["response-stream"]=="string"?e["response-stream"]:e["response-stream"]?.type;return Ag.ok(vA.sse(a.stream.map(({event:u,data:l})=>{if(c==null)return;let p=l,d=r.resolveType({type:c,file:o});if(d?._type==="named"&&v3(d.declaration)&&typeof d.declaration.discriminant=="object"&&d.declaration.discriminant?.context==="protocol"){let m=Aue(d.declaration);Lo(l)&&l[m]==null&&(p={[m]:u,...l})}let f=vf({example:p,rawTypeBeingExemplified:c,typeResolver:r,exampleResolver:i,fileContainingRawTypeReference:o,fileContainingExample:o,workspace:s});return{event:u,data:f}}).filter(Fa)))}})}function IOf({endpoint:e,example:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){let s=typeof e.response!="string"?e.response?.type:e.response;if(s!=null&&t.body!=null)return vf({example:t.body,rawTypeBeingExemplified:s,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:i,fileContainingExample:i,workspace:o})}function vOf({file:e,service:t,endpoint:r,example:n,pathParams:i}){let o=(0,I$a.default)(e.rootApiFile["base-path"]??"",t["base-path"],r.path);if(n["path-parameters"]!=null)for(let s of[...i.endpointPathParameters,...i.servicePathParameters,...i.rootPathParameters])o=o.replaceAll(`{${Mr(s.name)}}`,encodeURIComponent(`${s.value.jsonExample}`));return o=o.replaceAll("//","/"),o.startsWith("/")||(o=`/${o}`),o}jt();function C$a({endpoint:e,file:t,typeResolver:r}){let n=COf({endpoint:e,file:t,typeResolver:r}),i=typeof e.response!="string"?e.response?.docs:void 0;return{body:n,statusCode:typeof e.response!="string"?e.response?.["status-code"]:void 0,isWildcardStatusCode:void 0,docs:i}}function COf({endpoint:e,file:t,typeResolver:r}){let n=wOf({endpoint:e,file:t,typeResolver:r}),i=xOf({endpoint:e,file:t,typeResolver:r});if(n!=null&&i!=null){let o;switch(n.type){case"fileDownload":{o=J1.fileDownload({...n});break}case"json":{o=J1.json({...n.value});break}case"text":{o=J1.text({...n});break}case"bytes":{o=J1.bytes({...n});break}default:Ce(n)}return Iu.streamParameter({nonStreamResponse:o,streamResponse:i})}else{if(n!=null)return n;if(i!=null)return Iu.streaming(i)}}function wOf({endpoint:e,file:t,typeResolver:r}){let{response:n}=e;if(n!=null){let i=typeof n!="string"?n.docs:void 0,o=typeof n=="string"?n:n.type;if(o!=null)return Qk(o)!=null?Iu.fileDownload({docs:i,v2Examples:void 0}):SDe(o)!=null?Iu.text({docs:i,v2Examples:void 0}):I3(o)!=null?Iu.bytes({docs:i,v2Examples:void 0}):SOf(n,i,t,r)}}function xOf({endpoint:e,file:t,typeResolver:r}){let{["response-stream"]:n}=e;if(n!=null){let i=typeof n!="string"?n.docs:void 0,o=typeof n=="string"?n:n.type,s=typeof n=="string"?"json":n.format??"json";return Phe(o)?tI.text({docs:i,v2Examples:void 0}):typeof n!="string"&&s==="sse"?tI.sse({docs:i,payload:t.parseTypeReference(o),terminator:typeof n!="string"?n.terminator:void 0,v2Examples:void 0}):tI.json({docs:i,payload:t.parseTypeReference(o),terminator:typeof n!="string"?n.terminator:void 0,v2Examples:void 0})}}function SOf(e,t,r,n){let i=typeof e!="string"?e.type:e;if(i==null)return;let o=r.parseTypeReference(typeof e=="string"?e:{...e,type:i}),s=n.resolveTypeOrThrow({type:i,file:r}),a=typeof e!="string"?e.property:void 0;return a!=null?Iu.json(Yb.nestedPropertyAsResponse({docs:t,responseBodyType:o,responseProperty:ONe({typeResolver:n,file:r,resolvedType:s,property:a}),v2Examples:void 0})):Iu.json(Yb.response({docs:t,responseBodyType:o,v2Examples:void 0}))}jt();function w$a({propertyResolver:e,file:t,endpointName:r,endpointSchema:n,paginationPropertyComponents:i}){return Y0.cursor({page:e.resolveRequestPropertyOrThrow({file:t,endpoint:r,propertyComponents:i.cursor}),next:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:i.next_cursor}),results:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:i.results})})}function x$a({propertyResolver:e,file:t,endpointName:r,paginationPropertyComponents:n}){return Y0.custom({results:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:n.results})})}function S$a({propertyResolver:e,file:t,endpointName:r,endpointSchema:n,paginationPropertyComponents:i}){return Y0.offset({page:e.resolveRequestPropertyOrThrow({file:t,endpoint:r,propertyComponents:i.offset}),results:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:i.results}),step:i.step!=null?e.resolveRequestPropertyOrThrow({file:t,endpoint:r,propertyComponents:i.step}):void 0,hasNextPage:i.hasNextPage!=null?e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:i.hasNextPage}):void 0})}function _$a(e){if(lDr(e))return{type:"uri",nextUri:NB(e.next_uri),results:NB(e.results)};if(pDr(e))return{type:"path",nextPath:NB(e.next_path),results:NB(e.results)};if(BOf(e))return{type:"offset",offset:B7(e.offset),results:NB(e.results),step:e.step!=null?B7(e.step):void 0,hasNextPage:e["has-next-page"]!=null?NB(e["has-next-page"]):void 0};if(_Of(e))return{type:"cursor",cursor:B7(e.cursor),next_cursor:NB(e.next_cursor),results:NB(e.results)};if(TOf(e))return{type:"custom",results:NB(e.results)};throw new N({message:"Invalid pagination schema",code:N.Code.ValidationError})}function _Of(e){return e.cursor!=null}function lDr(e){return e.next_uri!=null}function pDr(e){return e.next_path!=null}function BOf(e){return e.offset!=null&&e.results!=null}function TOf(e){return"type"in e&&e.type==="custom"}function B$a({propertyResolver:e,file:t,endpointName:r,paginationPropertyComponents:n}){return Y0.path({nextPath:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:n.nextPath}),results:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:n.results})})}function T$a({propertyResolver:e,file:t,endpointName:r,paginationPropertyComponents:n}){return Y0.uri({nextUri:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:n.nextUri}),results:e.resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:n.results})})}function O$a({propertyResolver:e,file:t,endpointName:r,endpointSchema:n}){let i=typeof n.pagination=="boolean"?t.rootApiFile.pagination:n.pagination;if(!i)return;let o=_$a(i);switch(o.type){case"cursor":return w$a({propertyResolver:e,file:t,endpointName:r,endpointSchema:n,paginationPropertyComponents:o});case"offset":return S$a({propertyResolver:e,file:t,endpointName:r,endpointSchema:n,paginationPropertyComponents:o});case"custom":return x$a({propertyResolver:e,file:t,endpointName:r,paginationPropertyComponents:o});case"uri":return T$a({propertyResolver:e,file:t,endpointName:r,paginationPropertyComponents:o});case"path":return B$a({propertyResolver:e,file:t,endpointName:r,paginationPropertyComponents:o});default:Ce(o)}}function P$a({errors:e,file:t}){return e==null?[]:Object.values(e).map(r=>{let n=typeof r=="string"?r:r.error,i=K0e({errorName:n,file:t});return{docs:typeof r!="string"?r.docs:void 0,error:i}})}function D$a({endpointSchema:e}){if(e.retries&&e.retries.disabled!==void 0)return{disabled:e.retries.disabled}}function fDr({source:e}){return{filepath:e.relativeFilePath,packageName:e.packageName,options:e.csharpNamespace!=null?{csharp:{namespace:e.csharpNamespace}}:void 0}}function R$a({source:e,serviceNameOverride:t}){let r=t??e.serviceName;if(r!=null)return{file:fDr({source:e}),name:fkt.generateName(r)}}function F$a({file:e,serviceDeclaration:t,sourceResolver:r}){return ADe(t.source)?N$a(e,t.source,r,t.transport?.grpc?.["service-name"]):m3.http()}function k$a({file:e,serviceTransport:t,endpointDeclaration:r,sourceResolver:n}){let i=t.type==="grpc",o=t.type==="http",s=ADe(r.source),a=!s;if(i){if(o&&s)throw new N({message:"Cannot have a grpc endpoint on an http service",code:N.Code.ValidationError});if(i&&a)return m3.http();if(i&&s){let c=r.source,u=r.transport?.grpc?.["service-name"];return u?N$a(e,c,n,u):void 0}throw new N({message:`Internal error; failed to determine endpoint transport for
|
|
2540
|
-
${JSON.stringify(r)}"`,code:N.Code.InternalError})}}function N$a(e,t,r,n){let i=r.resolveSourceOrThrow({source:t,relativeFilepath:e.relativeFilepath});if(i==null||i.type!=="protobuf")throw new N({message:`Expected a protobuf source for ${t.proto}.`,code:N.Code.ResolutionError});let o=R$a({source:i,serviceNameOverride:n});if(o==null)throw new N({message:`Failed to resolve service name from ${i.relativeFilePath}.`,code:N.Code.IrConversionError});return m3.grpc({service:o})}function Q$a({rootDefaultUrl:e,rootPathParameters:t,serviceDefinition:r,file:n,errorResolver:i,typeResolver:o,propertyResolver:s,exampleResolver:a,variableResolver:c,sourceResolver:u,globalErrors:l,workspace:p,auth:d,irSettings:f}){let m=YYe({pathParameters:r["path-parameters"],location:Zt.PathParameterLocation.Service,file:n,variableResolver:c}),h=f.pathParameterOrder,A=(()=>{switch(h){case Rn.PathParameterOrder.UrlOrder:return r["base-path"]?sDr(r["base-path"],m):m;case Rn.PathParameterOrder.SpecOrder:return m;default:Ce(h)}})(),b=F$a({file:n,serviceDeclaration:r,sourceResolver:u}),v={fernFilepath:n.fernFilepath};return{availability:_N(r.availability),name:v,displayName:r["display-name"]??void 0,basePath:ub(r["base-path"]),headers:r.headers!=null?Object.entries(r.headers).map(([C,x])=>PU({headerKey:C,header:x,file:n})):[],pathParameters:A,encoding:ROf(b,r),transport:b,endpoints:Object.entries(r.endpoints).map(([C,x])=>{let B=x["base-path"]!=null?(0,dDr.default)(x["base-path"],x.path):n.rootApiFile["base-path"]!=null?(0,dDr.default)(n.rootApiFile["base-path"],r["base-path"],x.path):(0,dDr.default)(r["base-path"],x.path),O=YYe({pathParameters:T7(x),location:Zt.PathParameterLocation.Endpoint,file:n,variableResolver:c}),F=(()=>{switch(h){case Rn.PathParameterOrder.UrlOrder:return sDr(x.path,O);case Rn.PathParameterOrder.SpecOrder:return O;default:Ce(h)}})(),T=x["base-path"]!=null?F:[...t,...A,...F],L=(()=>{switch(h){case Rn.PathParameterOrder.UrlOrder:return sDr(B,T);case Rn.PathParameterOrder.SpecOrder:return T;default:Ce(h)}})(),K={...e_(x),id:"",name:n.casingsGenerator.generateName(C),displayName:x["display-name"],auth:typeof x.auth=="boolean"?x.auth:x.auth!=null?x.auth.length>0:r.auth,security:typeof x.auth>"u"||typeof x.auth=="boolean"?x.auth??r.auth===!0?Ww._visit(d.requirement,{any:()=>d.schemes.map(X=>({[X.key]:[]})),all:()=>[d.schemes.reduce((X,Y)=>({...X,[Y.key]:[]}),{})],endpointSecurity:()=>{},_other:()=>{}}):void 0:x.auth,docs:x.docs,idempotent:x.idempotent??r.idempotent??!1,baseUrl:x.url??r.url??e,v2BaseUrls:void 0,method:x.method!=null?DOf(x.method):Fd.Post,basePath:x["base-path"]!=null?ub(x["base-path"]):void 0,path:ub(x.path),fullPath:ub(B),pathParameters:F,allPathParameters:L,queryParameters:typeof x.request!="string"&&x.request?.["query-parameters"]!=null?Object.entries(x.request["query-parameters"]).map(([X,Y])=>uDr({file:n,queryParameterKey:X,queryParameter:Y})):[],headers:typeof x.request!="string"&&x.request?.headers!=null?Object.entries(x.request.headers).map(([X,Y])=>PU({headerKey:X,header:Y,file:n})):[],requestBody:qWa({request:x.request,file:n}),v2RequestBodies:void 0,sdkRequest:KWa({service:r,request:x.request,endpoint:x,endpointKey:C,file:n,typeResolver:o,propertyResolver:s}),response:C$a({endpoint:x,file:n,typeResolver:o}),v2Responses:void 0,errors:[...P$a({errors:x.errors,file:n}),...l],userSpecifiedExamples:x.examples!=null?x.examples.map(X=>{try{let Y=v$a({service:r,endpoint:x,example:X,typeResolver:o,errorResolver:i,exampleResolver:a,variableResolver:c,file:n,workspace:p});return Y===void 0?void 0:{example:Y,codeSamples:X["code-samples"]?.map(de=>JWa({codeSample:de,file:n}))}}catch{return}}).filter(X=>X!==void 0):[],autogeneratedExamples:[],pagination:O$a({propertyResolver:s,file:n,endpointName:C,endpointSchema:x}),transport:k$a({file:n,serviceTransport:b,endpointDeclaration:x,sourceResolver:u}),v2Examples:void 0,source:void 0,audiences:x.audiences,retries:D$a({endpointSchema:x}),apiPlayground:void 0,responseHeaders:[]};return K.id=Jl.generateEndpointId(v,K),K}),audiences:r.audiences}}function YYe({pathParameters:e,location:t,file:r,variableResolver:n}){return e==null?[]:Object.entries(e).map(([i,o])=>OOf({parameterName:i,parameter:o,location:t,file:r,variableResolver:n}))}function OOf({parameterName:e,parameter:t,location:r,file:n,variableResolver:i}){let o=typeof t!="string"&&"type"in t?t["client-default"]:void 0;return{...e_(t),name:n.casingsGenerator.generateName(e),valueType:POf({parameter:t,variableResolver:i,file:n}),location:r,variable:NGe(t)?i.getVariableIdOrThrow(typeof t=="string"?t:t.variable):void 0,clientDefault:lkt(o),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}},explode:void 0}}function POf({parameter:e,variableResolver:t,file:r}){let n=hkt({parameter:e,variableResolver:t,file:r});return n.file.parseTypeReference(n.rawType)}function hkt({parameter:e,variableResolver:t,file:r}){let n=mDr({parameter:e,variableResolver:t,file:r});if(n==null)throw new N({message:"Cannot resolve path parameter",code:N.Code.InternalError});return n}function mDr({parameter:e,variableResolver:t,file:r}){if(NGe(e)){let n=typeof e=="string"?e:e.variable,i=t.getDeclaration(n,r);return i==null?void 0:{rawType:typeof i.declaration=="string"?i.declaration:i.declaration.type,file:i.file}}else return{file:r,rawType:typeof e=="string"?e:e.type}}function DOf(e){switch(e){case"GET":return Fd.Get;case"POST":return Fd.Post;case"PUT":return Fd.Put;case"PATCH":return Fd.Patch;case"DELETE":return Fd.Delete;case"HEAD":return Fd.Head;default:Ce(e)}}function PU({headerKey:e,header:t,file:r}){let{name:n}=kY({headerKey:e,header:t}),i=typeof t!="string"?t["client-default"]:void 0;return{...e_(t),name:r.casingsGenerator.generateNameAndWireValue({wireValue:e,name:n}),valueType:r.parseTypeReference(t),env:typeof t=="string"?void 0:t.env,clientDefault:lkt(i),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}function kY({headerKey:e,header:t}){return typeof t!="string"&&t.name!=null?{name:t.name,wasExplicitlySet:!0}:{name:e,wasExplicitlySet:!1}}function ROf(e,t){switch(e.type){case"http":return{json:{},proto:void 0};case"grpc":return{json:void 0,proto:{}};default:Ce(e)}}jt();var hDr=we(Sm(),1);var j$a=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function FOf(e){return typeof e=="string"&&j$a.test(e)}var BYi=FOf;var QB=[];for(let e=0;e<256;++e)QB.push((e+256).toString(16).slice(1));function M$a(e,t=0){return(QB[e[t+0]]+QB[e[t+1]]+QB[e[t+2]]+QB[e[t+3]]+"-"+QB[e[t+4]]+QB[e[t+5]]+"-"+QB[e[t+6]]+QB[e[t+7]]+"-"+QB[e[t+8]]+QB[e[t+9]]+"-"+QB[e[t+10]]+QB[e[t+11]]+QB[e[t+12]]+QB[e[t+13]]+QB[e[t+14]]+QB[e[t+15]]).toLowerCase()}var kOf=new Uint8Array(16);function TYi(){return crypto.getRandomValues(kOf)}function NOf(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():QOf(e,t,r)}function QOf(e,t,r){e=e||{};let n=e.random??e.rng?.()??TYi();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return M$a(n)}var XO=NOf;var L$a="1.0.0";var gDr=class{ir;casingsGenerator;fullCasingsGenerator;auth;authValues;generatorConfig;extendedTypeIds;constructor(t){this.ir=t.ir,this.generatorConfig=t.generatorConfig,this.casingsGenerator=lx({generationLanguage:t.generationLanguage,smartCasing:t.smartCasing??t.ir.casingsConfig?.smartCasing??!0,keywords:t.ir.casingsConfig?.keywords}),this.fullCasingsGenerator=G0e({generationLanguage:t.generationLanguage,smartCasing:t.smartCasing??t.ir.casingsConfig?.smartCasing??!0,keywords:t.ir.casingsConfig?.keywords}),this.auth=this.convertAuth(this.ir.auth),this.authValues=this.getAuthValues(this.ir.auth),this.extendedTypeIds=this.computeExtendedTypeIds()}inflateName(t){return typeof t=="string"?this.fullCasingsGenerator.generateName(t):t}inflateNameAndWireValue(t){return typeof t=="string"?this.fullCasingsGenerator.generateNameAndWireValue(t):{wireValue:t.wireValue,name:this.inflateName(t.name)}}inflateFernFilepath(t){return{allParts:t.allParts.map(r=>this.inflateName(r)),packagePath:t.packagePath.map(r=>this.inflateName(r)),file:t.file!=null?this.inflateName(t.file):void 0}}computeExtendedTypeIds(){let t=new Set;for(let r of Object.values(this.ir.types))if(r.shape.type==="object")for(let n of r.shape.extends)t.add(n.typeId);return t}convert({disableExamples:t}){return{version:L$a,types:this.convertNamedTypes(),headers:this.convertHeaders(),endpoints:this.convertEndpoints({disableExamples:t}),pathParameters:this.convertPathParameters({pathParameters:this.ir.pathParameters}),environments:this.ir.environments!=null?this.convertEnvironments(this.ir.environments):void 0,variables:this.convertVariables(),generatorConfig:this.generatorConfig}}convertNamedTypes(){return Object.fromEntries(Object.entries(this.ir.types).map(([t,r])=>[t,this.convertTypeDeclaration(r)]))}convertHeaders(){return this.convertWireValueParameters({wireValueParameters:this.ir.headers})}convertVariables(){if(this.ir.variables.length!==0)return this.ir.variables.map(t=>({id:t.id,name:this.inflateName(t.name),typeReference:this.convertTypeReference(t.type)}))}convertEndpoints({disableExamples:t}){let r=this.getAllHttpEndpoints();return Object.fromEntries(r.map(n=>[n.id,this.convertEndpoint({endpoint:n,disableExamples:t})]))}convertEndpoint({endpoint:t,disableExamples:r}){let n=this.convertEndpointLocation({endpoint:t});return{auth:this.auth,declaration:this.convertDeclaration({name:t.name,fernFilepath:t.fernFilepath}),location:n,request:this.convertRequest({endpoint:t}),response:t.response?.body?._visit({json:()=>$t.Response.json(),streaming:()=>$t.Response.streaming(),streamParameter:()=>$t.Response.streamParameter(),fileDownload:()=>$t.Response.fileDownload(),text:()=>$t.Response.text(),bytes:()=>$t.Response.bytes(),_other:()=>$t.Response.json()})??$t.Response.json(),examples:r?void 0:this.getEndpointSnippetRequests({endpoint:t,location:n})}}convertRequest({endpoint:t}){let r=this.convertPathParameters({pathParameters:[...t.servicePathParameters,...t.pathParameters]});if(t.sdkRequest==null&&t.requestBody==null)return $t.Request.body({pathParameters:r,body:void 0});if(t.sdkRequest==null)throw new N({message:`Internal error; endpoint "${t.id}" has a request body but no SDK request`,code:N.Code.InternalError});switch(t.sdkRequest.shape.type){case"justRequestBody":return $t.Request.body({pathParameters:r,body:this.convertReferencedRequestBodyType({body:t.sdkRequest.shape.value})});case"wrapper":return this.convertInlinedRequest({fernFilepath:t.fernFilepath,wrapper:t.sdkRequest.shape,pathParameters:r,queryParameters:this.convertQueryParameters({queryParameters:t.queryParameters}),headers:this.convertWireValueParameters({wireValueParameters:[...t.serviceHeaders,...t.headers]}),body:t.requestBody});default:Ce(t.sdkRequest.shape)}}convertReferencedRequestBodyType({body:t}){switch(t.type){case"bytes":return $t.ReferencedRequestBodyType.bytes();case"typeReference":return $t.ReferencedRequestBodyType.typeReference(this.convertTypeReference(t.requestBodyType));default:Ce(t)}}convertInlinedRequest({fernFilepath:t,wrapper:r,pathParameters:n,queryParameters:i,headers:o,body:s}){return $t.Request.inlined({declaration:this.convertDeclaration({name:r.wrapperName,fernFilepath:t}),pathParameters:n,queryParameters:i,headers:o,body:s!=null?this.convertInlinedRequestBody({wrapper:r,body:s}):void 0,metadata:this.convertInlinedRequestMetadata({wrapper:r})})}convertInlinedRequestMetadata({wrapper:t}){return{includePathParameters:t.includePathParameters??!1,onlyPathParameters:t.onlyPathParameters??!1}}convertInlinedRequestBody({wrapper:t,body:r}){switch(r.type){case"inlinedRequestBody":{let n=[...r.extendedProperties??[],...r.properties];return $t.InlinedRequestBody.properties(this.convertBodyPropertiesToParameters({properties:n}))}case"reference":return $t.InlinedRequestBody.referenced({bodyKey:this.inflateName(t.bodyKey),bodyType:$t.ReferencedRequestBodyType.typeReference(this.convertTypeReference(r.requestBodyType))});case"bytes":return $t.InlinedRequestBody.referenced({bodyKey:this.inflateName(t.bodyKey),bodyType:$t.ReferencedRequestBodyType.bytes()});case"fileUpload":return this.convertFileUploadRequestBody({properties:r.properties});default:Ce(r)}}convertFileUploadRequestBody({properties:t}){return $t.InlinedRequestBody.fileUpload({properties:this.convertFileUploadRequestBodyProperties({properties:t})})}convertFileUploadRequestBodyProperties({properties:t}){return t.map(r=>{switch(r.type){case"file":return this.convertFileUploadRequestBodyFileProperty({fileProperty:r.value});case"bodyProperty":return $t.FileUploadRequestBodyProperty.bodyProperty({name:this.inflateNameAndWireValue(r.name),typeReference:this.convertTypeReference(r.valueType),propertyAccess:r.propertyAccess,variable:void 0});default:Ce(r)}})}convertFileUploadRequestBodyFileProperty({fileProperty:t}){let r=t.key,n=typeof r=="string"?{wireValue:r,name:this.fullCasingsGenerator.generateName(r)}:{wireValue:r.wireValue,name:this.fullCasingsGenerator.generateName(r.name)};switch(t.type){case"file":return $t.FileUploadRequestBodyProperty.file(n);case"fileArray":return $t.FileUploadRequestBodyProperty.fileArray(n);default:Ce(t)}}convertPathParameters({pathParameters:t}){return t.map(r=>({name:{name:this.inflateName(r.name),wireValue:Mr(r.name)},typeReference:this.convertTypeReference(r.valueType),propertyAccess:void 0,variable:r.variable}))}convertBodyPropertiesToParameters({properties:t}){return t.map(r=>({name:this.inflateNameAndWireValue(r.name),typeReference:this.convertTypeReference(r.valueType),propertyAccess:r.propertyAccess,variable:void 0}))}convertWireValueParameters({wireValueParameters:t}){return t.map(r=>({name:this.inflateNameAndWireValue(r.name),typeReference:this.convertTypeReference(r.valueType),propertyAccess:void 0,variable:void 0}))}convertQueryParameters({queryParameters:t}){let r=[];for(let n of t){let i=this.convertTypeReference(n.valueType);n.allowMultiple&&(i=$t.TypeReference.list(i)),r.push({name:this.inflateNameAndWireValue(n.name),typeReference:i,propertyAccess:void 0,variable:void 0})}return r}convertTypeReference(t){switch(t.type){case"container":return this.convertContainerType(t.container);case"named":return this.convertNamedType(t);case"primitive":return this.convertPrimitiveType(t.primitive);case"unknown":return this.convertUnknownType();default:Ce(t)}}convertContainerType(t){switch(t.type){case"list":return $t.TypeReference.list(this.convertTypeReference(t.list));case"map":return $t.TypeReference.map({key:this.convertTypeReference(t.keyType),value:this.convertTypeReference(t.valueType)});case"optional":return $t.TypeReference.optional(this.convertTypeReference(t.optional));case"nullable":return $t.TypeReference.nullable(this.convertTypeReference(t.nullable));case"set":return $t.TypeReference.set(this.convertTypeReference(t.set));case"literal":return $t.TypeReference.literal(this.convertLiteral(t.literal));default:Ce(t)}}convertNamedType(t){return $t.TypeReference.named(t.typeId)}convertTypeDeclaration(t){let r=this.convertDeclaration(t.name);switch(t.shape.type){case"alias":return this.convertAlias({declaration:r,alias:t.shape});case"enum":return this.convertEnum({declaration:r,enum_:t.shape});case"object":return this.convertObject({declaration:r,object:t.shape,typeId:t.name.typeId});case"union":return this.convertDiscriminatedUnion({declaration:r,union:t.shape});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({declaration:r,union:t.shape});default:Ce(t.shape)}}convertAlias({declaration:t,alias:r}){return $t.NamedType.alias({declaration:t,typeReference:this.convertTypeReference(r.aliasOf)})}convertEnum({declaration:t,enum_:r}){return $t.NamedType.enum({declaration:t,values:r.values.map(n=>this.inflateNameAndWireValue(n.name))})}convertObject({declaration:t,object:r,typeId:n}){let o=this.extendedTypeIds.has(n)?[...r.properties,...r.extendedProperties??[]]:[...r.extendedProperties??[],...r.properties],s=r.extends.length>0?r.extends.map(a=>a.typeId):void 0;return this.convertObjectProperties({declaration:t,properties:o,extends_:s,additionalProperties:r.extraProperties})}convertObjectProperties({declaration:t,properties:r,extends_:n,additionalProperties:i}){return $t.NamedType.object({declaration:t,properties:this.convertBodyPropertiesToParameters({properties:r}),extends:n,additionalProperties:i})}convertDiscriminatedUnion({declaration:t,union:r}){let n=[...this.resolveProperties(r.extends),...r.baseProperties];return $t.NamedType.discriminatedUnion({declaration:t,discriminant:this.inflateNameAndWireValue(r.discriminant),types:Object.fromEntries(r.types.map(i=>[er(i.discriminantValue),this.convertDiscriminatedUnionType({inheritedProperties:n,discriminantValue:i.discriminantValue,singleUnionTypeProperties:i.shape})]))})}convertDiscriminatedUnionType({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperties:n}){switch(n.propertiesType){case"samePropertiesAsObject":return this.convertDiscriminatedUnionTypeObject({inheritedProperties:t,discriminantValue:r,declaredTypeName:n});case"singleProperty":return this.convertDiscriminatedUnionTypeSingleProperty({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperty:n});case"noProperties":return this.convertDiscriminatedUnionTypeNoProperties({inheritedProperties:t,discriminantValue:r});default:Ce(n)}}convertDiscriminatedUnionTypeObject({inheritedProperties:t,discriminantValue:r,declaredTypeName:n}){return $t.SingleDiscriminatedUnionType.samePropertiesAsObject({typeId:n.typeId,discriminantValue:this.inflateNameAndWireValue(r),properties:this.convertBodyPropertiesToParameters({properties:t})})}convertDiscriminatedUnionTypeSingleProperty({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperty:n}){return $t.SingleDiscriminatedUnionType.singleProperty({typeReference:this.convertTypeReference(n.type),discriminantValue:this.inflateNameAndWireValue(r),properties:t.length>0?this.convertBodyPropertiesToParameters({properties:t}):void 0})}convertDiscriminatedUnionTypeNoProperties({inheritedProperties:t,discriminantValue:r}){return $t.SingleDiscriminatedUnionType.noProperties({discriminantValue:this.inflateNameAndWireValue(r),properties:t.length>0?this.convertBodyPropertiesToParameters({properties:t}):void 0})}convertUndiscriminatedUnion({declaration:t,union:r}){return $t.NamedType.undiscriminatedUnion({declaration:t,types:r.members.map(n=>this.convertTypeReference(n.type))})}convertLiteral(t){switch(t.type){case"boolean":return $t.LiteralType.boolean(t.boolean);case"string":return $t.LiteralType.string(t.string);default:Ce(t)}}convertPrimitiveType(t){return $t.TypeReference.primitive(t.v1)}convertUnknownType(){return $t.TypeReference.unknown()}convertAuth(t){if(t.schemes[0]==null)return;let r=t.schemes[0];switch(r.type){case"basic":return $t.Auth.basic({username:this.inflateName(r.username),usernameOmit:r.usernameOmit,password:this.inflateName(r.password),passwordOmit:r.passwordOmit});case"bearer":return $t.Auth.bearer({token:this.inflateName(r.token)});case"header":return $t.Auth.header({header:{name:this.inflateNameAndWireValue(r.name),typeReference:this.convertTypeReference(r.valueType),propertyAccess:void 0,variable:void 0}});case"oauth":return $t.Auth.oauth({clientId:this.fullCasingsGenerator.generateName("clientId"),clientSecret:this.fullCasingsGenerator.generateName("clientSecret")});case"inferred":return $t.Auth.inferred({parameters:this.getInferredAuthParameters(r)});default:Ce(r)}}getAuthValues(t){let r=t.schemes[0];if(r!=null)switch(r.type){case"bearer":return $t.AuthValues.bearer({token:r.tokenPlaceholder??"<token>"});case"basic":return $t.AuthValues.basic({username:r.usernameOmit?"":r.usernamePlaceholder??"<username>",password:r.passwordOmit?"":r.passwordPlaceholder??"<password>"});case"header":return $t.AuthValues.header({value:r.headerPlaceholder??"<value>"});case"oauth":return $t.AuthValues.oauth({clientId:"<clientId>",clientSecret:"<clientSecret>"});case"inferred":return $t.AuthValues.inferred({values:this.getInferredAuthValues(r)});default:Ce(r)}}getInferredAuthParameters(t){let r=[],n=Object.values(this.ir.services).flatMap(i=>i.endpoints).find(i=>i.id===t.tokenEndpoint.endpoint.endpointId);if(n==null)return r;for(let i of n.headers)(i.valueType.type!=="container"||i.valueType.container.type!=="literal")&&r.push({name:this.inflateNameAndWireValue(i.name),typeReference:this.convertTypeReference(i.valueType),propertyAccess:void 0,variable:void 0});if(n.requestBody!=null){let i=this.getRequestBodyProperties(n.requestBody);for(let o of i)(o.valueType.type!=="container"||o.valueType.container.type!=="literal")&&r.push({name:this.inflateNameAndWireValue(o.name),typeReference:this.convertTypeReference(o.valueType),propertyAccess:void 0,variable:void 0})}return r}getInferredAuthValues(t){let r={},n=Object.values(this.ir.services).flatMap(i=>i.endpoints).find(i=>i.id===t.tokenEndpoint.endpoint.endpointId);if(n==null)return r;for(let i of n.headers)if(i.valueType.type!=="container"||i.valueType.container.type!=="literal"){let o=er(i.name);r[o]=o}if(n.requestBody!=null){let i=this.getRequestBodyProperties(n.requestBody);for(let o of i)if(o.valueType.type!=="container"||o.valueType.container.type!=="literal"){let s=er(o.name);r[s]=s}}return r}getRequestBodyProperties(t){let r=[];if(t.type==="inlinedRequestBody")r.push(...t.properties);else if(t.type==="reference"){let n=t.requestBodyType;if(n.type==="named"){let i=this.ir.types[n.typeId];i!=null&&i.shape.type==="object"&&r.push(...i.shape.properties)}}return r}convertEnvironments(t){return{defaultEnvironment:t.defaultEnvironment,environments:t.environments._visit({singleBaseUrl:r=>$t.Environments.singleBaseUrl({environments:r.environments.map(n=>({docs:n.docs,id:n.id,name:this.inflateName(n.name),url:n.url}))}),multipleBaseUrls:r=>$t.Environments.multipleBaseUrls({baseUrls:r.baseUrls.map(n=>({id:n.id,name:this.inflateName(n.name)})),environments:r.environments.map(n=>({docs:n.docs,id:n.id,name:this.inflateName(n.name),urls:n.urls}))}),_other:()=>{throw new N({message:"Unknown environments type",code:N.Code.InternalError})}})}}convertDeclaration({name:t,fernFilepath:r}){return{name:this.inflateName(t),fernFilepath:this.inflateFernFilepath(r)}}convertEndpointLocation({endpoint:t}){return{method:t.method,path:this.getFullPathForEndpoint(t)}}getAllHttpEndpoints(){return Object.values(this.ir.services).flatMap(t=>t.endpoints.map(r=>({...r,servicePathParameters:t.pathParameters,serviceHeaders:t.headers,fernFilepath:t.name.fernFilepath})))}resolveProperties(t){let r=[];for(let n of t){let i=this.resolveObjectTypeOrThrow(n.typeId);r.push(...this.resolveProperties(i.extends)),r.push(...i.properties)}return Object.values(r)}resolveObjectTypeOrThrow(t){let r=this.ir.types[t];if(r==null)throw new N({message:`Internal error; type "${t}" not found`,code:N.Code.InternalError});if(r.shape.type!=="object")throw new N({message:`Internal error; type "${t}" is not an object`,code:N.Code.InternalError});return r.shape}getFullPathForEndpoint(t){let r="";t.fullPath.head.length>0&&(r=(0,hDr.default)(r,t.fullPath.head));for(let n of t.fullPath.parts)r=(0,hDr.default)(r,"{"+n.pathParameter+"}"),n.tail.length>0&&(r=(0,hDr.default)(r,n.tail));return r.startsWith("/")?r:`/${r}`}getGlobalHeaderExampleValues(){let t={};for(let r of this.ir.headers){if(r.valueType.type==="container"&&r.valueType.container.type==="literal"||r.valueType.type==="container"&&r.valueType.container.type==="optional")continue;let n=er(r.name);t[n]=`<${n}>`}return t}getEndpointSnippetRequests({endpoint:t,location:r}){let n=[];for(let i of[...t.userSpecifiedExamples,...t.autogeneratedExamples]){let o=new Set;[...this.ir.pathParameters,...t.pathParameters].forEach(a=>{a.variable!=null&&o.add(Mr(a.name))});let s=[...i.example?.rootPathParameters??[],...i.example?.servicePathParameters??[],...i.example?.endpointPathParameters??[]].filter(a=>!o.has(Mr(a.name)));n.push({id:i?.example?.id??XO(),name:i?.example?.name!=null?Mr(i.example.name):void 0,endpoint:r,baseUrl:void 0,environment:void 0,auth:this.authValues,headers:{...this.getGlobalHeaderExampleValues(),...Object.fromEntries([...i.example?.serviceHeaders??[],...i.example?.endpointHeaders??[]].map(a=>[er(a.name),a.value.jsonExample]))},pathParameters:Object.fromEntries(s.map(a=>[Mr(a.name),a.value.jsonExample])),queryParameters:Object.fromEntries([...i.example?.queryParameters??[]].map(a=>[er(a.name),a.value.jsonExample])),requestBody:i.example?.request?.jsonExample})}return n}};function DNe({ir:e,generationLanguage:t,smartCasing:r,disableExamples:n,generatorConfig:i}){return new gDr({ir:e,generationLanguage:t,smartCasing:r,generatorConfig:i}).convert({disableExamples:n})}var ZO={};ne(ZO,{validateObjectExample:()=>PNe,validateTypeExample:()=>aDr,validateTypeReferenceExample:()=>t_});jt();XA();function U$a(e){return{errorInstanceIdKey:e.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}}var ADr=e=>{let t=P6(e.file.fernFilepath),r=e.endpointId;return`endpoint_${t}.${r}`};function yDr({fernFilePath:e}){return e.packagePath.length===0&&e.file==null}function bDr({resolvedEndpoint:e}){return{endpointId:ADr(e),serviceId:Jl.generateServiceIdFromFernFilepath(e.file.fernFilepath),subpackageId:yDr({fernFilePath:e.file.fernFilepath})?void 0:Jl.generateSubpackageId(e.file.fernFilepath)}}function z$a({endpointResolver:e,propertyResolver:t,file:r,refreshTokenEndpoint:n}){let i=e.resolveEndpointOrThrow({endpoint:n.endpoint,file:r}),o;try{o=n.responseProperties.expires_in!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:n.endpoint,propertyComponents:n.responseProperties.expires_in}):void 0}catch{}return{endpointReference:{endpointId:ADr(i),serviceId:Jl.generateServiceIdFromFernFilepath(i.file.fernFilepath),subpackageId:yDr({fernFilePath:i.file.fernFilepath})?void 0:Jl.generateSubpackageId(i.file.fernFilepath)},requestProperties:{refreshToken:t.resolveRequestPropertyOrThrow({file:r,endpoint:n.endpoint,propertyComponents:n.requestProperties.refresh_token})},responseProperties:{accessToken:t.resolveResponsePropertyOrThrow({file:r,endpoint:n.endpoint,propertyComponents:n.responseProperties.access_token}),expiresIn:o,refreshToken:n.responseProperties.refresh_token!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:n.endpoint,propertyComponents:n.responseProperties.refresh_token}):void 0}}}function V$a({endpointResolver:e,propertyResolver:t,typeResolver:r,file:n,tokenEndpoint:i}){let o=e.resolveEndpointOrThrow({endpoint:i.endpoint,file:n}),s=MOf({endpoint:o.endpoint,file:o.file,typeResolver:r}),a;try{a=i.responseProperties.expires_in!=null?t.resolveResponsePropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.responseProperties.expires_in}):void 0}catch{}return{endpointReference:bDr({resolvedEndpoint:o}),requestProperties:{clientId:t.resolveRequestPropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.requestProperties.client_id}),clientSecret:t.resolveRequestPropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.requestProperties.client_secret}),scopes:i.requestProperties.scopes!=null?t.resolveRequestPropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.requestProperties.scopes}):void 0,customProperties:jOf({requestBodyPropertyNames:s,tokenEndpoint:i,file:n,propertyResolver:t})},responseProperties:{accessToken:t.resolveResponsePropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.responseProperties.access_token}),expiresIn:a,refreshToken:i.responseProperties.refresh_token!=null?t.resolveResponsePropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.responseProperties.refresh_token}):void 0}}}var jOf=({requestBodyPropertyNames:e,tokenEndpoint:t,file:r,propertyResolver:n})=>{let i=e.filter(o=>!t.requestProperties.client_id.includes(o)&&!t.requestProperties.client_secret.includes(o)&&(t.requestProperties.scopes==null||!t.requestProperties.scopes.includes(o)));return i.length>0?i.map(o=>n.resolveRequestPropertyOrThrow({file:r,endpoint:t.endpoint,propertyComponents:[o]})):void 0};function MOf({endpoint:e,file:t,typeResolver:r}){let n=e.request;if(n==null)return[];if(typeof n=="string")return EDr({typeName:n,file:t,typeResolver:r});let i=n.body;if(i==null)return[];if(typeof i=="string")return EDr({typeName:i,file:t,typeResolver:r});if(gg(i)){let o=Object.keys(i.properties??{});if(i.extends!=null){let s=typeof i.extends=="string"?[i.extends]:i.extends;for(let a of s)o.push(...EDr({typeName:a,file:t,typeResolver:r}))}return o}return EDr({typeName:i.type,file:t,typeResolver:r})}function EDr({typeName:e,file:t,typeResolver:r}){let n=r.resolveType({type:e,file:t});if(n==null||n._type!=="named")return[];let i=n.declaration,o=[];return"properties"in i&&i.properties!=null&&o.push(...Object.keys(i.properties)),"base-properties"in i&&i["base-properties"]!=null&&o.push(...Object.keys(i["base-properties"])),o}function q$a({propertyResolver:e,endpointResolver:t,typeResolver:r,file:n,oauthScheme:i,tokenEndpoint:o,refreshTokenEndpoint:s}){let a=V$a({propertyResolver:e,endpointResolver:t,typeResolver:r,file:n,tokenEndpoint:o});if(a==null)throw new N({message:"Failed to convert OAuth token endpoint.",code:N.Code.IrConversionError});let c=s!=null?z$a({propertyResolver:e,endpointResolver:t,file:n,refreshTokenEndpoint:s}):void 0;return{clientIdEnvVar:i["client-id-env"],clientSecretEnvVar:i["client-secret-env"],tokenPrefix:i["token-prefix"],tokenHeader:i["token-header"],scopes:i.scopes,tokenEndpoint:a,refreshEndpoint:c}}var gkt={requestProperties:{type:"access_token",client_id:["client_id"],client_secret:["client_secret"],scopes:void 0},responseProperties:{type:"access_token",access_token:["access_token"],expires_in:["expires_in"],refresh_token:void 0}},OYi={requestProperties:{type:"refresh_token",refresh_token:["refresh_token"]},responseProperties:{type:"access_token",access_token:["access_token"],refresh_token:void 0,expires_in:["expires_in"]}};function G$a(e){return{endpoint:e["get-token"].endpoint,requestProperties:LOf({requestProperties:e["get-token"]?.["request-properties"]}),responseProperties:UOf({responseProperties:e["get-token"]?.["response-properties"]})}}function W$a(e){if(e["refresh-token"]!=null)return{endpoint:e["refresh-token"].endpoint,requestProperties:zOf({requestProperties:e["refresh-token"]?.["request-properties"]}),responseProperties:VOf({responseProperties:e["refresh-token"]?.["response-properties"]})}}function LOf({requestProperties:e}){if(e==null)return gkt.requestProperties;let t=e["client-id"],r=e["client-secret"],n=e.scopes;return{type:"access_token",client_id:t!=null?B7(t):gkt.requestProperties.client_id,client_secret:r!=null?B7(r):gkt.requestProperties.client_secret,scopes:n!=null?B7(n):gkt.requestProperties.scopes}}function UOf({responseProperties:e}){return $$a({responseProperties:e,defaultValue:gkt.responseProperties})}function zOf({requestProperties:e}){if(e==null)return OYi.requestProperties;let t=e["refresh-token"];return{type:"refresh_token",refresh_token:t!=null?B7(t):OYi.requestProperties.refresh_token}}function VOf({responseProperties:e}){return $$a({responseProperties:e,defaultValue:OYi.responseProperties})}function $$a({responseProperties:e,defaultValue:t}){if(e==null)return t;let r=e["access-token"],n=e["expires-in"],i=e["refresh-token"];return{type:"access_token",access_token:r!=null?NB(r):t.access_token,expires_in:n!=null?NB(n):t.expires_in,refresh_token:i!=null?NB(i):t.refresh_token}}function Y$a({rawApiFileSchema:e,file:t,propertyResolver:r,endpointResolver:n,typeResolver:i}){if(e.auth==null)return{docs:void 0,requirement:Ww.All,schemes:[]};let o=typeof e.auth!="string"?e.auth.docs:void 0;return BDe(e.auth,{single:s=>{let a=PYi({reference:s,authSchemeDeclarations:e["auth-schemes"],file:t,propertyResolver:r,endpointResolver:n,typeResolver:i});return{docs:o,requirement:Ww.All,schemes:[a]}},any:({any:s})=>({docs:o,requirement:Ww.Any,schemes:s.map(a=>PYi({reference:a,authSchemeDeclarations:e["auth-schemes"],file:t,propertyResolver:r,endpointResolver:n,typeResolver:i}))}),endpointSecurity:()=>({docs:o,requirement:Ww.EndpointSecurity,schemes:Object.keys(e["auth-schemes"]??{}).map(s=>PYi({reference:s,authSchemeDeclarations:e["auth-schemes"],file:t,propertyResolver:r,endpointResolver:n,typeResolver:i}))})})}function PYi({reference:e,authSchemeDeclarations:t,file:r,propertyResolver:n,endpointResolver:i,typeResolver:o}){let s=(c,u)=>{let l=t?.[c];if(l==null)throw new N({message:"Unknown auth scheme: "+c,code:N.Code.ReferenceError});return TDe(l,{header:p=>Gp.header({key:c,docs:u,name:r.casingsGenerator.generateNameAndWireValue({name:p.name??c,wireValue:p.header}),valueType:r.parseTypeReference(p.type??"string"),prefix:p.prefix,headerEnvVar:p.env,headerPlaceholder:p.placeholder}),basic:p=>K$a({key:c,file:r,docs:u,rawScheme:p}),tokenBearer:p=>H$a({key:c,file:r,docs:u,rawScheme:p}),inferredBearer:p=>qOf({key:c,file:r,docs:u,rawScheme:p,propertyResolver:n,endpointResolver:i}),oauth:p=>J$a({key:c,file:r,docs:u,rawScheme:p,propertyResolver:n,endpointResolver:i,typeResolver:o})})},a=typeof e=="string"?e:e.scheme;switch(a){case"bearer":return H$a({key:a,file:r,docs:void 0,rawScheme:void 0});case"basic":return K$a({key:a,file:r,docs:void 0,rawScheme:void 0});case"oauth":return J$a({key:a,file:r,docs:void 0,rawScheme:void 0,propertyResolver:n,endpointResolver:i,typeResolver:o});default:return s(a,typeof e!="string"?e.docs:void 0)}}function H$a({key:e,file:t,docs:r,rawScheme:n}){return Gp.bearer({key:e,docs:r,token:t.casingsGenerator.generateName(n?.token?.name??"token"),tokenEnvVar:n?.token?.env,tokenPlaceholder:n?.token?.placeholder})}function K$a({key:e,file:t,docs:r,rawScheme:n}){return Gp.basic({key:e,docs:r,username:t.casingsGenerator.generateName(n?.username?.name??"username"),usernameEnvVar:n?.username?.env,usernameOmit:n?.username?.omit,usernamePlaceholder:n?.username?.placeholder,password:t.casingsGenerator.generateName(n?.password?.name??"password"),passwordEnvVar:n?.password?.env,passwordOmit:n?.password?.omit,passwordPlaceholder:n?.password?.placeholder})}function J$a({key:e,file:t,docs:r,rawScheme:n,propertyResolver:i,endpointResolver:o,typeResolver:s}){if(n?.type==="client-credentials")return Gp.oauth({key:e,docs:r,configuration:lH.clientCredentials(q$a({propertyResolver:i,endpointResolver:o,typeResolver:s,file:t,oauthScheme:n,tokenEndpoint:G$a(n),refreshTokenEndpoint:W$a(n)}))});throw new N({message:`Unknown OAuth type: '${n?.type}'`,code:N.Code.ValidationError})}function qOf({key:e,file:t,docs:r,rawScheme:n,propertyResolver:i,endpointResolver:o}){return Gp.inferred({key:e,docs:r,tokenEndpoint:GOf({file:t,rawScheme:n,propertyResolver:i,endpointResolver:o})})}function GOf({file:e,rawScheme:t,propertyResolver:r,endpointResolver:n}){let i=t["get-token"],o=typeof i=="string"?{endpoint:i}:i,s=n.resolveEndpointOrThrow({endpoint:o.endpoint,file:e});return{endpoint:bDr({resolvedEndpoint:s}),expiryProperty:JOf({tokenEndpoint:s,getTokenEndpointConfig:o,propertyResolver:r}),authenticatedRequestHeaders:$Of({tokenEndpoint:s,getTokenEndpointConfig:o,propertyResolver:r})}}var WOf=["access_token","accessToken","AccessToken","token","Token","auth_token","authToken","AuthToken","bearer_token","bearerToken","BearerToken","jwt","Jwt","authentication_token","authenticationToken","AuthenticationToken"];function $Of({tokenEndpoint:e,getTokenEndpointConfig:t,propertyResolver:r}){let n=new Map,i=t["authenticated-request-headers"]??[];if(i.length>0&&i.forEach(o=>{n.set(o["header-name"].toLowerCase(),{headerName:o["header-name"],responseProperty:r.resolveResponsePropertyOrThrow({file:e.file,endpoint:e.endpointId,propertyComponents:NB(o["response-property"])}),valuePrefix:o["value-prefix"]})}),!n.has("authorization")){let o=HOf({tokenEndpoint:e,propertyResolver:r});o&&n.set("authorization",{headerName:"Authorization",responseProperty:o,valuePrefix:"Bearer "})}return Array.from(n.values())}function HOf({tokenEndpoint:e,propertyResolver:t}){for(let r of WOf)try{let n=t.resolveResponseProperty({file:e.file,endpoint:e.endpointId,propertyComponents:[r]});if(n)return n}catch{}}var KOf=["expires_in","expiresIn","ExpiresIn","exp","Exp","expiry","Expiry","expires","Expires","expires_at","expiresAt","ExpiresAt","expiration","Expiration","valid_until","validUntil","ValidUntil"];function JOf({tokenEndpoint:e,getTokenEndpointConfig:t,propertyResolver:r}){if(t["expiry-response-property"])return r.resolveResponsePropertyOrThrow({file:e.file,endpoint:e.endpointId,propertyComponents:NB(t["expiry-response-property"])});for(let n of KOf)try{let i=r.resolveResponseProperty({file:e.file,endpoint:e.endpointId,propertyComponents:[n]});if(i)return i}catch{}}function X$a({file:e,rawApiFileSchema:t}){if(t.version!=null)return Fhe.header({header:YOf({file:e,header:t.version.header}),value:XOf({file:e,versionDeclaration:t.version})})}function YOf({file:e,header:t}){return typeof t=="string"?PU({file:e,headerKey:t,header:{type:"string"}}):PU({file:e,headerKey:t.value,header:{type:"string",name:t.name,env:t.env}})}function XOf({file:e,versionDeclaration:t}){return cDr({_enum:{default:t.default,enum:t.values},file:e})}jt();function Z$a({channel:e,typeResolver:t,exampleResolver:r,variableResolver:n,file:i,workspace:o}){let s=[];for(let[a,c]of Object.entries(e.messages??{}))s.push({type:a,availability:_N(c.availability),docs:c.docs,origin:c.origin,body:tPf({body:c.body,file:i}),displayName:c["display-name"],methodName:c["method-name"]});return{availability:_N(e.availability),path:ub(e.path),baseUrl:e.url,auth:e.auth,name:i.fernFilepath.file??i.casingsGenerator.generateName(e["display-name"]??e.path),displayName:e["display-name"],connectMethodName:e["connect-method-name"],headers:e.headers!=null?Object.entries(e.headers).map(([a,c])=>PU({headerKey:a,header:c,file:i})):[],docs:e.docs,pathParameters:e["path-parameters"]!=null?YYe({pathParameters:e["path-parameters"],location:Zt.PathParameterLocation.Endpoint,file:i,variableResolver:n}):[],queryParameters:e["query-parameters"]!=null?Object.entries(e["query-parameters"]).map(([a,c])=>{let{name:u}=bue({queryParameterKey:a,queryParameter:c}),l=i.parseTypeReference(c);return{...e_(c),name:i.casingsGenerator.generateNameAndWireValue({wireValue:a,name:u}),valueType:l,allowMultiple:typeof c!="string"&&c["allow-multiple"]!=null?c["allow-multiple"]:!1,clientDefault:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}},explode:void 0}}):[],messages:Object.values(s),examples:(e.examples??[]).map(a=>{let c=nPf({channel:e,example:a,typeResolver:t,exampleResolver:r,variableResolver:n,file:i,workspace:o});return{name:a.name!=null?i.casingsGenerator.generateName(a.name):void 0,docs:a.docs,url:oPf({channel:e,example:a,pathParams:c}),...c,...iPf({channel:e,example:a,typeResolver:t,exampleResolver:r,file:i,workspace:o}),queryParameters:a["query-parameters"]!=null?Object.entries(a["query-parameters"]).map(([u,l])=>{let p=e["query-parameters"]?.[u];if(p==null)throw new N({message:`Query parameter ${u} does not exist`,code:N.Code.ReferenceError});return{name:i.casingsGenerator.generateNameAndWireValue({name:bue({queryParameterKey:u,queryParameter:p}).name,wireValue:u}),value:vf({example:l,rawTypeBeingExemplified:typeof p=="string"?p:p.type,typeResolver:t,exampleResolver:r,fileContainingRawTypeReference:i,fileContainingExample:i,workspace:o}),shape:ZOf({queryParameter:p})}}):[],messages:a.messages.map(u=>{let l=e.messages?.[u.type];if(l==null)throw new N({message:`Message ${u.type} does not exist`,code:N.Code.ReferenceError});return{type:u.type,body:ePf({message:l,example:u.body,typeResolver:t,exampleResolver:r,file:i,workspace:o})}})}}),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}function ZOf({queryParameter:e}){return(typeof e!="string"&&e["allow-multiple"]!=null?e["allow-multiple"]:!1)?$w.exploded():$w.single()}function ePf({message:e,example:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){if(!sPf(e.body))return i6.reference(vf({example:t,rawTypeBeingExemplified:typeof e.body!="string"?e.body.type:e.body,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:i,fileContainingExample:i,workspace:o}));if(!Lo(t))throw new N({message:"Example must be an object",code:N.Code.ValidationError});let s=[];for(let[a,c]of Object.entries(t)){let u=e.body.properties?.[a];if(u!=null)s.push({name:i.casingsGenerator.generateNameAndWireValue({name:qC({propertyKey:a,property:u}).name,wireValue:a}),value:vf({example:c,rawTypeBeingExemplified:typeof u!="string"?u.type:u,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:i,fileContainingExample:i,workspace:o}),originalTypeDeclaration:void 0});else{let l=mkt({extends_:e.body.extends,wirePropertyKey:a,typeResolver:r,file:i});if(l==null)throw new N({message:"Could not find original type declaration for property: "+a,code:N.Code.ResolutionError});s.push({name:i.casingsGenerator.generateNameAndWireValue({name:qC({propertyKey:a,property:l.rawPropertyType}).name,wireValue:a}),value:vf({example:c,rawTypeBeingExemplified:typeof l.rawPropertyType=="string"?l.rawPropertyType:l.rawPropertyType.type,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:l.file,fileContainingExample:i,workspace:o}),originalTypeDeclaration:l.typeName})}}return i6.inlinedBody({jsonExample:n.resolveAllReferencesInExampleOrThrow({example:t,file:i}).resolvedExample,properties:s,extraProperties:void 0})}function tPf({body:e,file:t}){return typeof e=="string"||rPf(e)?eB.reference({docs:void 0,bodyType:t.parseTypeReference(e)}):eB.inlinedBody({name:t.casingsGenerator.generateName(e.name),extends:_7(e.extends??[]).map(r=>ZS({typeName:r,file:t})),properties:Object.entries(e.properties??{}).map(([r,n])=>({name:t.casingsGenerator.generateNameAndWireValue({name:qC({propertyKey:r,property:n}).name,wireValue:r}),value:t.parseTypeReference(n),valueType:t.parseTypeReference(n),availability:void 0,docs:void 0}))})}function rPf(e){return e.type!=null}function nPf({channel:e,example:t,typeResolver:r,exampleResolver:n,variableResolver:i,file:o,workspace:s}){let a=[],c=({name:u,pathParameterDeclaration:l,examplePathParameter:p})=>{let d=hkt({parameter:l,variableResolver:i,file:o});return{name:u,value:vf({example:p,rawTypeBeingExemplified:d.rawType,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:d.file,fileContainingExample:o,workspace:s})}};if(t["path-parameters"]!=null){let u=T7(e);for(let[l,p]of Object.entries(t["path-parameters"])){let d=u[l];if(d!=null)a.push(c({name:o.casingsGenerator.generateName(l),pathParameterDeclaration:d,examplePathParameter:p}));else throw new N({message:`Path parameter ${l} does not exist`,code:N.Code.ReferenceError})}}return{pathParameters:a}}function iPf({channel:e,example:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){let s=[];if(t.headers!=null)for(let[a,c]of Object.entries(t.headers)){let u=e.headers?.[a];u!=null&&s.push({name:i.casingsGenerator.generateNameAndWireValue({name:kY({headerKey:a,header:u}).name,wireValue:a}),value:vf({example:c,rawTypeBeingExemplified:typeof u=="string"?u:u.type,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:i,fileContainingExample:i,workspace:o})})}return{headers:s}}function oPf({channel:e,example:t,pathParams:r}){let n=e.path;if(t["path-parameters"]!=null)for(let i of[...r.pathParameters])n=n.replaceAll(`{${Mr(i.name)}}`,encodeURIComponent(`${i.value.jsonExample}`));return n}function sPf(e){return typeof e=="string"?!1:e.extends!=null||e.properties!=null}function eHa({errorName:e,errorDeclaration:t,file:r,typeResolver:n,exampleResolver:i,workspace:o}){let s=[];if(t.type!=null&&t.examples!=null)for(let a of t.examples)s.push({name:a.name!=null?r.casingsGenerator.generateName(a.name):void 0,docs:a.docs,jsonExample:i.resolveAllReferencesInExampleOrThrow({example:a.value,file:r}).resolvedExample,shape:vf({example:a.value,rawTypeBeingExemplified:t.type,fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:n,exampleResolver:i,workspace:o})});return{name:K0e({errorName:e,file:r}),discriminantValue:r.casingsGenerator.generateNameAndWireValue({wireValue:e,name:e}),docs:typeof t!="string"?t.docs:void 0,statusCode:t["status-code"],isWildcardStatusCode:void 0,type:t.type!=null?r.parseTypeReference(t.type):void 0,examples:s,v2Examples:void 0,displayName:void 0,headers:[]}}jt();var tHa="content";function rHa(e,t){if(e==null||e.strategy==="status-code")return n6.statusCode();if(e.strategy==="property")return n6.property({discriminant:t.casingsGenerator.generateNameAndWireValue({name:e["property-name"],wireValue:e["property-name"]}),contentProperty:t.casingsGenerator.generateNameAndWireValue({name:tHa,wireValue:tHa})});Ce(e)}var IDr=we(Sm(),1);function nHa({readme:e,services:t}){let r=new DYi(t);return{apiName:e.apiName,disabledFeatures:e.disabledSections?.map(n=>n.toUpperCase()),apiReferenceLink:e.apiReferenceLink,bannerLink:e.bannerLink,introduction:e.introduction,customSections:e.customSections,exampleStyle:e.exampleStyle,whiteLabel:!1,defaultEndpoint:e.defaultEndpoint!=null?r.getEndpointForReadmeOrThrow(e.defaultEndpoint).id:void 0,features:e.features!=null?Object.fromEntries(Object.entries(e.features).map(([n,i])=>[n,i.map(o=>r.getEndpointForReadmeOrThrow(o).id)])):void 0}}var DYi=class{endpoints={};constructor(t){this.endpoints=this.buildEndpoints(t)}getEndpointForReadme(t){let r=cPf({endpoint:t}),n=this.getEndpointKeyForReadmeEndpoint(r);return this.endpoints[n]}getEndpointForReadmeOrThrow(t){let r=this.getEndpointForReadme(t);if(r==null)throw new N({message:`Endpoint not found for ${JSON.stringify(t)}`,code:N.Code.ResolutionError});return r}buildEndpoints(t){let r={};for(let n of Object.values(t))for(let i of n.endpoints)r[this.getEndpointKeyForHttpEndpoint(i)]=i;return r}getEndpointKeyForReadmeEndpoint(t){return this.getEndpointKey({method:t.method,path:t.path,stream:t.stream??!1})}getEndpointKeyForHttpEndpoint(t){return this.getEndpointKey({method:t.method,path:aPf(t),stream:t.response?.body?.type==="streaming"})}getEndpointKey({method:t,path:r,stream:n}){return`${t}|${r}|${n}`}};function aPf(e){let t="";e.fullPath.head.length>0&&(t=(0,IDr.default)(t,e.fullPath.head));for(let r of e.fullPath.parts)t=(0,IDr.default)(t,"{"+r.pathParameter+"}"),r.tail.length>0&&(t=(0,IDr.default)(t,r.tail));return t.startsWith("/")?t:`/${t}`}function cPf({endpoint:e}){if(typeof e=="string"){let t=e.split(" ");if(t.length!==2||t[0]==null||t[1]==null)throw new N({message:`invalid endpoint string: ${e}`,code:N.Code.ParseError});return{method:t[0],path:t[1]}}return e}jt();function iHa({webhooks:e,file:t,typeResolver:r,exampleResolver:n,workspace:i,defaultSignature:o}){let s=[];for(let[a,c]of Object.entries(e))s.push({id:Jl.generateWebhookId(t.fernFilepath,a),availability:_N(c.availability),displayName:c["display-name"],docs:c.docs,method:c.method,name:t.casingsGenerator.generateName(a),headers:c.headers!=null?Object.entries(c.headers).map(([u,l])=>PU({headerKey:u,header:l,file:t})):[],payload:uPf({payload:c.payload,file:t}),signatureVerification:gPf({signature:c.signature??o,file:t}),fileUploadPayload:void 0,responses:fPf({webhook:c,file:t,typeResolver:r}),examples:c.examples!=null?pPf({webhook:c,examples:c.examples,file:t,typeResolver:r,exampleResolver:n,workspace:i}):void 0,v2Examples:void 0});return s}function uPf({payload:e,file:t}){return typeof e=="string"?hS.reference({docs:void 0,payloadType:t.parseTypeReference(e)}):qYe(e)?hS.reference({docs:void 0,payloadType:t.parseTypeReference(e.type)}):hS.inlinedPayload({name:t.casingsGenerator.generateName(e.name),extends:_7(e.extends).map(r=>ZS({typeName:r,file:t})),properties:e.properties!=null?Object.entries(e.properties).map(([r,n])=>lPf({propertyKey:r,propertyDefinition:n,docs:typeof n!="string"?n.docs:void 0,availability:typeof n!="string"?_N(n.availability):void 0,file:t})):[]})}function lPf({propertyKey:e,propertyDefinition:t,docs:r,availability:n,file:i}){return{docs:r,availability:n,name:i.casingsGenerator.generateNameAndWireValue({wireValue:e,name:qC({propertyKey:e,property:t}).name}),valueType:i.parseTypeReference(t)}}function pPf({webhook:e,examples:t,file:r,typeResolver:n,exampleResolver:i,workspace:o}){let s=typeof e.payload=="string"?e.payload:qYe(e.payload)?e.payload.type:void 0;if(s!=null)return t.map(a=>({docs:e.docs,name:a.name!=null?r.casingsGenerator.generateName(a.name):void 0,payload:vf({example:a.payload,rawTypeBeingExemplified:s,fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:n,exampleResolver:i,workspace:o})}));if(!Lo(e.payload))throw new N({message:`Example webhook payload is not an object. Got: ${JSON.stringify(e.payload)}`,code:N.Code.ValidationError});return t.map(a=>({docs:e.docs,name:a.name!=null?r.casingsGenerator.generateName(a.name):void 0,payload:vf({example:a.payload,rawTypeBeingExemplified:"map<string, unknown>",fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:n,exampleResolver:i,workspace:o})}))}function fPf({webhook:e,file:t,typeResolver:r}){let n=[];if(e.response!=null){let i=dPf({response:e.response,file:t,typeResolver:r}),o=typeof e.response!="string"?e.response["status-code"]:void 0,s=typeof e.response!="string"?e.response.docs:void 0;n.push({body:i,statusCode:o,isWildcardStatusCode:void 0,docs:s})}if(e["response-stream"]!=null){let i=mPf({responseStream:e["response-stream"],file:t,typeResolver:r});if(i!=null){let o=typeof e["response-stream"]!="string"?e["response-stream"].docs:void 0;n.push({body:Iu.streaming(i),statusCode:void 0,isWildcardStatusCode:void 0,docs:o})}}return n.length>0?n:void 0}function dPf({response:e,file:t,typeResolver:r}){let n=typeof e!="string"?e.docs:void 0,i=typeof e=="string"?e:e.type;if(i!=null)return Qk(i)!=null?Iu.fileDownload({docs:n,v2Examples:void 0}):SDe(i)!=null?Iu.text({docs:n,v2Examples:void 0}):I3(i)!=null?Iu.bytes({docs:n,v2Examples:void 0}):hPf(e,n,t,r)}function mPf({responseStream:e,file:t,typeResolver:r}){let n=typeof e!="string"?e.docs:void 0,i=typeof e=="string"?e:e.type,o=typeof e=="string"?"json":e.format??"json";return Phe(i)?tI.text({docs:n,v2Examples:void 0}):typeof e!="string"&&o==="sse"?tI.sse({docs:n,payload:t.parseTypeReference(i),terminator:typeof e!="string"?e.terminator:void 0,v2Examples:void 0}):tI.json({docs:n,payload:t.parseTypeReference(i),terminator:typeof e!="string"?e.terminator:void 0,v2Examples:void 0})}function hPf(e,t,r,n){let i=typeof e!="string"?e.type:e;if(i==null)return;let o=r.parseTypeReference(typeof e=="string"?e:{...e,type:i}),s=n.resolveTypeOrThrow({type:i,file:r}),a=typeof e!="string"?e.property:void 0;return a!=null?Iu.json(Yb.nestedPropertyAsResponse({docs:t,responseBodyType:o,responseProperty:ONe({typeResolver:n,file:r,resolvedType:s,property:a}),v2Examples:void 0})):Iu.json(Yb.response({docs:t,responseBodyType:o,v2Examples:void 0}))}function gPf({signature:e,file:t}){if(e!=null)switch(e.type){case"hmac":return IG.hmac(APf({hmac:e,file:t}));case"asymmetric":return IG.asymmetric(yPf({asymmetric:e,file:t}));default:return}}function APf({hmac:e,file:t}){return{signatureHeaderName:t.casingsGenerator.generateNameAndWireValue({wireValue:e.header,name:e.header}),algorithm:bPf(e.algorithm),encoding:oHa(e.encoding),signaturePrefix:e["signature-prefix"],payloadFormat:vPf(e["payload-format"]),timestamp:sHa({timestamp:e.timestamp,file:t})}}function yPf({asymmetric:e,file:t}){return{signatureHeaderName:t.casingsGenerator.generateNameAndWireValue({wireValue:e.header,name:e.header}),algorithm:EPf(e["asymmetric-algorithm"]),encoding:oHa(e.encoding),signaturePrefix:e["signature-prefix"],keySource:IPf({asymmetric:e,file:t}),timestamp:sHa({timestamp:e.timestamp,file:t})}}function bPf(e){switch(e){case"sha1":return EG.Sha1;case"sha384":return EG.Sha384;case"sha512":return EG.Sha512;case"sha256":case void 0:return EG.Sha256}}function oHa(e){switch(e){case"hex":return bDe.Hex;case"base64":case void 0:return bDe.Base64}}function EPf(e){switch(e){case"rsa-sha256":return Z1.RsaSha256;case"rsa-sha384":return Z1.RsaSha384;case"rsa-sha512":return Z1.RsaSha512;case"ecdsa-sha256":return Z1.EcdsaSha256;case"ecdsa-sha384":return Z1.EcdsaSha384;case"ecdsa-sha512":return Z1.EcdsaSha512;case"ed25519":return Z1.Ed25519}}function IPf({asymmetric:e,file:t}){return e["jwks-url"]!=null?bG.jwks({url:e["jwks-url"],keyIdHeader:e["key-id-header"]!=null?t.casingsGenerator.generateNameAndWireValue({wireValue:e["key-id-header"],name:e["key-id-header"]}):void 0}):bG.static({})}function vPf(e){return e==null?{components:[h3.Body],delimiter:"",bodySort:void 0}:{components:e.components.map(wPf),delimiter:e.delimiter??"",bodySort:CPf(e["body-sort"])}}function CPf(e){switch(e){case"alphabetical":return O_t.Alphabetical;case void 0:return}}function wPf(e){switch(e){case"body":return h3.Body;case"timestamp":return h3.Timestamp;case"notification-url":return h3.NotificationUrl;case"message-id":return h3.MessageId}}function sHa({timestamp:e,file:t}){if(e!=null)return{headerName:t.casingsGenerator.generateNameAndWireValue({wireValue:e.header,name:e.header}),format:xPf(e.format),tolerance:e.tolerance}}function xPf(e){switch(e){case"unix-millis":return Qse.UnixMillis;case"iso8601":return Qse.Iso8601;case"unix-seconds":case void 0:return Qse.UnixSeconds}}function aHa({name:e,source:t}){return Bp.userDefined({file:fDr({source:t}),name:fkt.generateName(e)})}function cHa({encoding:e}){if(e.proto!=null&&e.proto.type!=null){let t=SPf({type:e.proto.type});if(t!=null)return t}}function SPf({type:e}){switch(e){case"google.protobuf.Any":return Bp.wellKnown(mi.any());case"google.protobuf.Api":return Bp.wellKnown(mi.api());case"google.protobuf.BoolValue":return Bp.wellKnown(mi.boolValue());case"google.protobuf.BytesValue":return Bp.wellKnown(mi.bytesValue());case"google.protobuf.DoubleValue":return Bp.wellKnown(mi.doubleValue());case"google.protobuf.Duration":return Bp.wellKnown(mi.duration());case"google.protobuf.Empty":return Bp.wellKnown(mi.empty());case"google.protobuf.Enum":return Bp.wellKnown(mi.enum());case"google.protobuf.EnumValue":return Bp.wellKnown(mi.enumValue());case"google.protobuf.Field":return Bp.wellKnown(mi.field());case"google.protobuf.FieldCardinality":return Bp.wellKnown(mi.fieldCardinality());case"google.protobuf.FieldKind":return Bp.wellKnown(mi.fieldKind());case"google.protobuf.FieldMask":return Bp.wellKnown(mi.fieldMask());case"google.protobuf.FloatVlaue":return Bp.wellKnown(mi.floatValue());case"google.protobuf.Int32Value":return Bp.wellKnown(mi.int32Value());case"google.protobuf.Int64Value":return Bp.wellKnown(mi.int64Value());case"google.protobuf.ListValue":return Bp.wellKnown(mi.listValue());case"google.protobuf.Method":return Bp.wellKnown(mi.method());case"google.protobuf.Mixin":return Bp.wellKnown(mi.mixin());case"google.protobuf.NullValue":return Bp.wellKnown(mi.nullValue());case"google.protobuf.Option":return Bp.wellKnown(mi.option());case"google.protobuf.SourceContext":return Bp.wellKnown(mi.sourceContext());case"google.protobuf.StringValue":return Bp.wellKnown(mi.stringValue());case"google.protobuf.Struct":return Bp.wellKnown(mi.struct());case"google.protobuf.Syntax":return Bp.wellKnown(mi.syntax());case"google.protobuf.Timestamp":return Bp.wellKnown(mi.timestamp());case"google.protobuf.Type":return Bp.wellKnown(mi.type());case"google.protobuf.Uint32Value":return Bp.wellKnown(mi.uint32Value());case"google.protobuf.Uint64Value":return Bp.wellKnown(mi.uint64Value());case"google.protobuf.Value":return Bp.wellKnown(mi.value())}}jt();function _Pf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function XYe(e,t,r){if(t.length===0)return e;let n=new Map;for(let o=0;o<t.length;o++){let s=t[o],a=r[o];s!=null&&a!=null&&n.set(s,a)}if(n.size===0)return e;let i=Array.from(n.keys()).map(o=>`\\b${_Pf(o)}\\b`).join("|");return e.replace(new RegExp(i,"g"),o=>n.get(o)??o)}function uHa({generic:e,file:t,typeResolver:r}){let n=typeof e=="string"?e:e.type,i=Jb(n);if(i==null)throw new N({message:`Invalid generic type definition: ${n}`,code:N.Code.ValidationError});let o=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:n,file:t});if(i.arguments&&sf(o.declaration)){let s=Jb(o.typeName)?.arguments??[],a=Object.entries(o.declaration.properties??{}).map(([u,l])=>{let p=l;return typeof l=="string"?p=XYe(l,s,i.arguments):typeof l=="object"&&l!=null&&"type"in l&&(p={...l,type:XYe(l.type,s,i.arguments)}),[u,p]}),c=_7(o.declaration.extends).map(u=>{let l=XYe(u,s,i.arguments);return ZS({typeName:l,file:t})});return Cc.object({extends:c,properties:ckt({properties:Object.fromEntries(a)},t),extraProperties:o.declaration["extra-properties"]??!1,extendedProperties:void 0})}throw new N({message:`Generic type definition not supported: ${n}`,code:N.Code.ValidationError})}function lHa({alias:e,file:t,typeResolver:r}){let n=typeof e=="string"?e:e.type;return p3(n)?uHa({generic:n,file:t,typeResolver:r}):Cc.alias({aliasOf:t.parseTypeReference(e),resolvedType:BPf({aliasOf:n,file:t,typeResolver:r})})}function BPf({aliasOf:e,file:t,typeResolver:r}){let n=r.resolveTypeOrThrow({type:e,file:t});switch(n._type){case"primitive":return X1.primitive(n.originalTypeReference.primitive);case"container":return X1.container(n.originalTypeReference.container);case"unknown":return X1.unknown();case"named":{let i=sf(n.declaration)?yG.Object:v3(n.declaration)?yG.Union:wG(n.declaration)?yG.Enum:QGe(n.declaration)?yG.UndiscriminatedUnion:Ce(n.declaration);return X1.named({name:n.name,shape:i})}}}jt();function pHa({union:e,file:t}){let r=e.union.filter((n,i)=>{let o=typeof n=="string"?n:n.type;return e.union.findIndex(s=>(typeof s=="string"?s:s.type)===o)===i});return Cc.undiscriminatedUnion({baseProperties:e["base-properties"]!=null?Object.entries(e["base-properties"]).map(([n,i])=>({...e_(i),name:t.casingsGenerator.generateNameAndWireValue({wireValue:n,name:qC({propertyKey:n,property:i}).name}),valueType:t.parseTypeReference(i),propertyAccess:H0e({property:i}),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}})):void 0,members:r.map(n=>{let i=t.parseTypeReference(typeof n=="string"?n:n.type);return{type:i.type==="named"?{...i,displayName:typeof n=="string"?_k(Mr(i.name)):n["display-name"]??_k(Mr(i.name))}:i,docs:typeof n=="string"?void 0:n.docs}})})}function fHa(e){let t=[];if(e.extends!=null){let r=typeof e.extends=="string"?[e.extends]:e.extends;t.push(...r)}return e.properties!=null&&t.push(...Object.values(e.properties).map(r=>typeof r=="string"?r:r.type)),t}function FYi({typeDeclaration:e,file:t,typeResolver:r,seenTypeNames:n=new RYi}){let i=nv(e,{alias:s=>{let a=typeof s=="string"?s:s.type,c=Jb(a);if(c!=null){let u=new Set(c.arguments??[]),l=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:a,file:t}),p=Jb(l.typeName)?.arguments;if(sf(l.declaration)){let d=fHa(l.declaration);p&&d.filter(f=>!p.includes(f)).map(f=>XYe(f,p,c.arguments)).forEach(f=>u.add(f))}return Array.from(u)}return[a]},object:s=>fHa(s),discriminatedUnion:s=>{let a=[];return s["base-properties"]!=null&&a.push(...Object.values(s["base-properties"]).map(c=>typeof c=="string"?c:c.type)),a.push(...Object.values(s.union).reduce((c,u)=>{let l=typeof u=="string"?u:u.type;return typeof l=="string"&&c.push(l),c},[])),a},undiscriminatedUnion:s=>{let a=[];return s["base-properties"]!=null&&a.push(...Object.values(s["base-properties"]).map(c=>typeof c=="string"?c:c.type)),a.push(...Object.values(s.union).reduce((c,u)=>{let l=typeof u=="string"?u:u.type;return typeof l=="string"&&c.push(l),c},[])),a},enum:()=>[]}),o=[];for(let s of i){let a=rv({type:s,_default:void 0,validation:void 0,visitor:{primitive:()=>[],map:({keyType:c,valueType:u})=>[...c,...u],list:c=>c,optional:c=>c,nullable:c=>c,set:c=>c,named:c=>[c],literal:()=>[],unknown:()=>[]}});for(let c of a){let u=ZS({typeName:c,file:t});if(!n.hasTypeNameBeenSeen(u)){n.addTypeName(u),o.push(u);let l=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:c,file:t});if(p3(l.typeName))continue;o.push(...FYi({typeDeclaration:l.declaration,file:l.file,typeResolver:r,seenTypeNames:n}))}}}return o}var RYi=class{cache=new Set;addTypeName(t){this.cache.add(this.computeCacheKey(t))}hasTypeNameBeenSeen(t){return this.cache.has(this.computeCacheKey(t))}computeCacheKey(t){return t.fernFilepath.allParts.map(r=>Mr(r)).join("/")+":"+Mr(t.name)}};function dHa({typeName:e,typeDeclaration:t,file:r,typeResolver:n,exampleResolver:i,sourceResolver:o,workspace:s}){let a=e_(t),c=ZS({typeName:e,file:r}),u=FYi({typeDeclaration:t,file:r,typeResolver:n}),l={};sf(t)&&(l=_Ne(t.properties??{}));let p=OPf({file:r,typeDeclaration:t,typeName:e,sourceResolver:o});return{propertiesByAudience:l,typeDeclaration:{...a,inline:FPf(t),name:c,shape:TPf({typeDeclaration:t,file:r,typeResolver:n}),referencedTypes:new Set(u.map(d=>d.typeId)),encoding:PPf({typeDeclaration:t,source:p}),source:p,userProvidedExamples:typeof t!="string"&&t.examples!=null?t.examples.map(d=>({name:d.name!=null?r.casingsGenerator.generateName(d.name):void 0,docs:d.docs,jsonExample:i.resolveAllReferencesInExampleOrThrow({example:d.value,file:r}).resolvedExample,shape:SYi({typeName:c,example:d.value,typeResolver:n,exampleResolver:i,typeDeclaration:t,fileContainingType:r,fileContainingExample:r,workspace:s})})):[],autogeneratedExamples:[],v2Examples:void 0},descendantFilepaths:new Set(u.map(d=>d.fernFilepath))}}function TPf({typeDeclaration:e,file:t,typeResolver:r}){return nv(e,{alias:n=>lHa({alias:n,file:t,typeResolver:r}),object:n=>zWa({object:n,file:t}),discriminatedUnion:n=>e$a({union:n,file:t,typeResolver:r}),undiscriminatedUnion:n=>pHa({union:n,file:t}),enum:n=>Cc.enum(cDr({_enum:n,file:t}))})}function OPf({file:e,typeDeclaration:t,typeName:r,sourceResolver:n}){if(typeof t=="string"||t.source==null&&t.encoding==null)return;if(t.encoding!=null){let o=cHa({encoding:t.encoding});if(o!=null)return kse.proto(o)}if(t.source==null)return;let i=n.resolveSourceOrThrow({source:t.source,relativeFilepath:e.relativeFilepath});if(!(i==null||i.type!=="protobuf"))return kse.proto(aHa({source:i,name:r}))}function PPf({typeDeclaration:e,source:t}){return typeof e!="string"&&e.encoding!=null?DPf(e.encoding):RPf(t)}function DPf(e){return e.proto!=null?{json:void 0,proto:{}}:{json:{},proto:void 0}}function RPf(e){return e!=null&&e.type==="proto"?{json:void 0,proto:{}}:{json:{},proto:void 0}}function FPf(e){if(typeof e!="string"&&"inline"in e)return e.inline}function mHa(e,t){let r=t[e];if(r==null)throw N.internalError(`Failed to load type declaration for type ${e}`);return r}function hHa(e){e.types=Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,NPf({typeDeclaration:r,ir:e})])),e.services=Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(n=>kPf({endpoint:n,ir:e}))}]))}function kPf({endpoint:e,ir:t}){return e.requestBody?.type!=="inlinedRequestBody"?e:{...e,requestBody:{...e.requestBody,extendedProperties:e.requestBody.extends.flatMap(r=>gHa(r,t))}}}function NPf({typeDeclaration:e,ir:t}){return e.shape.type==="object"?{...e,shape:{...e.shape,extendedProperties:e.shape.extends.flatMap(r=>gHa(r,t))}}:e}function gHa(e,t){let r=kYi(e.typeId,t);return AHa({objectTypeDeclaration:r,ir:t})}function kYi(e,t){let r=mHa(e,t.types);switch(r.shape.type){case"object":return r.shape;case"alias":if(r.shape.resolvedType.type==="named")return kYi(r.shape.resolvedType.name.typeId,t)}throw N.internalError(`Unexpected error: ${e} is extended but has shape ${r.shape.type}`)}function AHa({objectTypeDeclaration:e,ir:t}){let r=e.extends.flatMap(n=>{let i=kYi(n.typeId,t);return AHa({objectTypeDeclaration:i,ir:t})});return[...e.properties,...r]}Xi();var vDr=class{subpackages={};rootPackage={docs:void 0,fernFilepath:{allParts:[],packagePath:[],file:void 0},websocket:void 0,service:void 0,types:[],errors:[],subpackages:[],webhooks:void 0,navigationConfig:void 0};addPackageRedirection({from:t,to:r}){let n=this.getPackageForFernFilepath(t);if(n.navigationConfig!=null)throw new N({message:"Found duplicate navigationConfig for package",code:N.Code.InternalError});n.navigationConfig={pointsTo:Jl.generateSubpackageId(r)}}addDocs(t,r){let n=this.getPackageForFernFilepath(t);if(n.docs!=null)throw new N({message:"Found duplicate docs for package",code:N.Code.InternalError});n.docs=r}addSubpackage(t){this.getPackageForFernFilepath(t)}addType(t,r){this.getPackageForFernFilepath(r.name.fernFilepath).types.push(t)}addError(t,r){this.getPackageForFernFilepath(r.name.fernFilepath).errors.push(t)}addService(t,r){let n=this.getPackageForFernFilepath(r.name.fernFilepath);if(n.service!=null)throw new N({message:"Found duplicate service for "+t,code:N.Code.InternalError});n.service=t}addWebhookGroup(t,r){let n=this.getPackageForFernFilepath(r);if(n.webhooks!=null)throw new N({message:"Found duplicate webhook group for "+t,code:N.Code.InternalError});n.webhooks=t}addWebSocketChannel(t,r){let n=this.getPackageForFernFilepath(r);if(n.webhooks!=null)throw new N({message:"Found duplicate webhook group for "+t,code:N.Code.InternalError});n.websocket=t}build(t){t!=null&&(Object.entries(this.subpackages).forEach(([n,i])=>{t.hasSubpackageId(n)?this.subpackages[n]={...i,types:i.types.filter(o=>t.hasTypeId(o)),errors:i.errors.filter(o=>t.hasErrorId(o)),service:i.service!=null&&t.hasServiceId(i.service)?i.service:void 0,websocket:i.websocket!=null&&t.hasChannel(i.websocket)?i.websocket:void 0,subpackages:i.subpackages.filter(o=>t.hasSubpackageId(o))}:delete this.subpackages[n]}),this.rootPackage={...this.rootPackage,types:this.rootPackage.types.filter(n=>t.hasTypeId(n)),errors:this.rootPackage.errors.filter(n=>t.hasErrorId(n)),service:this.rootPackage.service!=null&&t.hasServiceId(this.rootPackage.service)?this.rootPackage.service:void 0,subpackages:this.rootPackage.subpackages.filter(n=>t.hasSubpackageId(n)),webhooks:this.rootPackage.webhooks!=null?this.rootPackage.webhooks:void 0});let r=new Set(this.getAllChildrenWithEndpoints(this.rootPackage));return{subpackages:tp(this.subpackages,(n,i)=>({...n,hasEndpointsInTree:r.has(i)})),rootPackage:{...this.rootPackage,hasEndpointsInTree:r.size>0||this.rootPackage.service!=null}}}sortRootPackage(t){if(!yHa(this.rootPackage.subpackages,t))throw new N({message:"Sorted subpackages differ from unsorted packages in root",code:N.Code.InternalError});this.rootPackage.subpackages=t}sortSubpackage(t,r){let n=this.subpackages[t];if(n==null)throw new N({message:"Subpackage does not exist: "+t,code:N.Code.ResolutionError});if(!yHa(n.subpackages,r))throw new N({message:"Sorted subpackages differ from unsorted packages",code:N.Code.InternalError});n.subpackages=r}getAllSubpackagesWithEndpoints(t){let r=this.subpackages[t];if(r==null)throw new N({message:"Subpackage does not exist: "+t,code:N.Code.ResolutionError});let n=this.getAllChildrenWithEndpoints(r);return(n.length>0||r.service!=null)&&n.push(t),n}getAllChildrenWithEndpoints(t){return t.subpackages.flatMap(r=>[...this.getAllSubpackagesWithEndpoints(r)])}getPackageForFernFilepath(t,r=0,n=this.rootPackage){let i=t.allParts[r];if(i==null)return n;let o=n.subpackages.map(l=>{let p=this.subpackages[l];if(p==null)throw new N({message:"Subpackage ID is invalid: "+l,code:N.Code.InternalError});return p}),s=r+1,a={allParts:t.allParts.slice(0,s),packagePath:t.packagePath.slice(0,s),file:s===t.allParts.length?t.file:void 0},c=Mr(i),u=o.find(l=>Mr(l.name)===c);if(u==null){let l=Jl.generateSubpackageId(a),p={docs:void 0,fernFilepath:a,name:i,displayName:void 0,service:void 0,types:[],errors:[],subpackages:[],navigationConfig:void 0,webhooks:void 0,websocket:void 0};this.subpackages[l]=p,n.subpackages.push(l),u=p}return this.getPackageForFernFilepath(t,s,u)}};function yHa(e,t){if(e.length!==t.length)return!1;let r=new Set(e);for(let n of t)if(!r.has(n))return!1;return!0}function bHa({reference:e,referencedIn:t,imports:r}){let[n,i,...o]=e.split(".");if(n==null||o.length>0)return;if(i==null)return{endpointName:n,relativeFilepath:t};let a=r[n];if(a!=null)return{endpointName:i,relativeFilepath:$0e({referencedIn:t,importPath:a})}}var RNe=class{workspace;constructor(t){this.workspace=t}resolveEndpointOrThrow({endpoint:t,file:r}){let n=this.resolveEndpoint({endpoint:t,file:r});if(n==null)throw new N({message:"Cannot resolve endpoint: "+t+" in file "+r.relativeFilepath,code:N.Code.ResolutionError});return n}resolveEndpointByMethodAndPath({method:t,path:r,namespace:n,casingsGenerator:i}){let o;return uv(this.workspace,(s,a,c)=>{if(n!=null&&this.getNamespaceFromFilepath(s)!==n)return;let u=mu({relativeFilepath:s,definitionFile:a,casingsGenerator:i,rootApiFile:this.workspace.definition.rootApiFile.contents,defaultUrl:c.defaultUrl});for(let[l,p]of Object.entries(a.service?.endpoints??{}))p.method===t&&p.path===r&&(o={endpointId:l,endpoint:p,file:u})}),AFe(this.workspace,(s,a)=>{if(n!=null&&this.getNamespaceFromFilepath(s)!==n)return;let c=mu({relativeFilepath:s,definitionFile:a,casingsGenerator:i,rootApiFile:this.workspace.definition.rootApiFile.contents});for(let[u,l]of Object.entries(a.service?.endpoints??{}))l.method===t&&l.path===r&&(o={endpointId:u,endpoint:l,file:c})}),o}getNamespaceFromFilepath(t){let r=t.split("/");if(r.length>1)return r[0]}resolveEndpoint({endpoint:t,file:r}){let i=new Fse().tryParse(t);if(i!=null)return this.resolveEndpointByMethodAndPath({method:i.method,path:i.path,namespace:i.namespace,casingsGenerator:r.casingsGenerator});let o=this.getDeclarationOfEndpoint({referenceToEndpoint:t,file:r});if(o==null)return;let s=o.file.definitionFile.service?.endpoints?.[o.endpointName];if(s!=null)return{endpointId:o.endpointName,endpoint:s,file:o.file}}getDeclarationOfEndpoint({referenceToEndpoint:t,file:r}){let n=bHa({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(n==null)return;let i=Z3(this.workspace,n.relativeFilepath);if(!(i==null||i.service?.endpoints?.[n.endpointName]==null))return{endpointName:n.endpointName,file:mu({relativeFilepath:n.relativeFilepath,definitionFile:i,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}};var FNe=class{workspace;constructor(t){this.workspace=t}getDeclarationOrThrow(t,r){let n=this.getDeclaration(t,r);if(n==null)throw new N({message:"Error does not exist: "+t,code:N.Code.ResolutionError});return n}getDeclaration(t,r){let n=D6({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(n==null)return;let i=Z3(this.workspace,n.relativeFilepath);if(i==null)return;let o=i.errors?.[n.typeName];if(o!=null)return{declaration:o,file:mu({definitionFile:i,relativeFilepath:n.relativeFilepath,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}};jt();var R6=class{typeResolver;constructor(t){this.typeResolver=t}resolveAllReferencesInExample({example:t,file:r}){if(typeof t=="string"){let n=this.resolveExample({example:t,file:r});return n==null?n:typeof n.resolvedExample=="string"?(n.resolvedExample.startsWith(`\\${"$"}`)&&(n.resolvedExample=n.resolvedExample.slice(1)),n):this.resolveAllReferencesInExample({example:n.resolvedExample,file:n.file})}else if(Lo(t)){let n={};for(let[i,o]of Object.entries(t)){let s=this.resolveAllReferencesInExample({example:o,file:r});if(s==null)return;let a=i.startsWith(`\\${"$"}`)?i.slice(1):i;n[a]=s.resolvedExample}return{resolvedExample:n}}else if(Array.isArray(t)){let n=[];for(let i of t){let o=this.resolveAllReferencesInExample({example:i,file:r});if(o==null)return;n.push(o.resolvedExample)}return{resolvedExample:n}}return{resolvedExample:t}}resolveAllReferencesInExampleOrThrow({example:t,file:r}){let n=this.resolveAllReferencesInExample({example:t,file:r});if(n==null)throw new N({message:"Failed to resolve examples",code:N.Code.ResolutionError});return n}resolveExample({example:t,file:r}){return typeof t!="string"?{resolvedExample:t,file:r}:t.startsWith("$")?this.parseExampleReference(t)==null?{resolvedExample:t,file:r}:this.resolveExampleReference(t,r):{resolvedExample:t,file:r}}resolveExampleReference(t,r){let n=this.parseExampleReference(t);if(n==null)return;let i=this.typeResolver.getDeclarationOfNamedType({referenceToNamedType:n.rawTypeReference,file:r});if(i==null||typeof i.declaration=="string"||i.declaration.examples==null)return;let o=i.declaration.examples.find(s=>s.name===n.exampleName);if(o!=null)return this.resolveExample({example:o.value,file:i.file})}resolveExampleOrThrow({example:t,file:r}){let n=this.resolveExample({example:t,file:r});if(n==null)throw new N({message:"Cannot resolve example: "+t,code:N.Code.ResolutionError});return n}parseExampleReference(t){let[r,n,i,...o]=t.split(".");if(r==null||n==null||o.length>0)return;if(i==null){let a=r.slice("$".length);return NYi(a)?{rawTypeReference:a,exampleName:n}:void 0}let s=r.slice("$".length);if(!(!NYi(s)||!NYi(n)))return{rawTypeReference:`${s}.${n}`,exampleName:i}}};function NYi(e){if(e.length===0)return!1;let t=e.charAt(0);return t>="a"&&t<="z"||t>="A"&&t<="Z"}jt();var CDr=class{typeResolver;endpointResolver;constructor(t,r){this.typeResolver=t,this.endpointResolver=r,this.typeResolver=t,this.endpointResolver=r}resolveRequestPropertyOrThrow({file:t,endpoint:r,propertyComponents:n}){let i=this.resolveRequestProperty({file:t,endpoint:r,propertyComponents:n});if(i==null)throw new N({message:"Cannot resolve request property from endpoint: "+r+" in file "+t.relativeFilepath,code:N.Code.ResolutionError});return i}resolveRequestProperty({file:t,endpoint:r,propertyComponents:n}){let i=this.endpointResolver.resolveEndpointOrThrow({endpoint:r,file:t});if(i.endpoint.request==null)return;if(typeof i.endpoint.request!="string")return this.resolveRequestPropertyFromInlinedRequest({typeResolver:this.typeResolver,file:i.file,requestType:i.endpoint.request,propertyComponents:n});let o=this.typeResolver.resolveTypeOrThrow({type:i.endpoint.request,file:i.file}),s=this.resolveObjectProperty({file:i.file,resolvedType:o,propertyComponents:n});if(s!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:n,file:t,resolvedType:o}),property:Y1.body(s)}}resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:n}){let i=this.resolveResponseProperty({file:t,endpoint:r,propertyComponents:n});if(i==null)throw new N({message:"Cannot resolve response property from endpoint: "+r+" in file "+t.relativeFilepath,code:N.Code.ResolutionError});return i}resolveResponseProperty({file:t,endpoint:r,propertyComponents:n}){let i=this.endpointResolver.resolveEndpointOrThrow({endpoint:r,file:t}),o=this.typeResolver.resolveTypeOrThrow({type:(typeof i.endpoint.response!="string"?i.endpoint.response?.type:i.endpoint.response)??"",file:i.file}),s=this.resolveObjectProperty({file:i.file,resolvedType:o,propertyComponents:n});if(s!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:n,resolvedType:o,file:t}),property:s}}resolveRequestPropertyFromInlinedRequest({typeResolver:t,file:r,requestType:n,propertyComponents:i}){if(i.length===1){let o=i[0]??"",s=n["query-parameters"]?.[o]??void 0;if(s!=null)return{property:Y1.query(uDr({file:r,queryParameterKey:o,queryParameter:s})),propertyPath:void 0}}return this.resolveRequestPropertyFromInlinedRequestBody({typeResolver:t,file:r,requestType:n,propertyComponents:i})}resolveRequestPropertyFromInlinedRequestBody({typeResolver:t,file:r,requestType:n,propertyComponents:i}){if(n.body==null)return;if(typeof n.body=="string"){let a=t.resolveTypeOrThrow({type:n.body,file:r}),c=this.resolveObjectProperty({file:r,resolvedType:a,propertyComponents:i});return c==null?void 0:{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:i,file:r,resolvedType:a}),property:Y1.body(c)}}if(gg(n.body)){let a=nDr({typeResolver:t,file:r,objectSchema:n.body,propertyComponents:i});return a==null?void 0:{propertyPath:this.propertyPathFromPropertyComponentsFromInlineRequestBody({propertyComponents:i,file:r,body:n.body}),property:Y1.body(a)}}let o=t.resolveTypeOrThrow({type:n.body.type,file:r}),s=rDr({typeResolver:t,file:GYe(o)??r,resolvedType:o,propertyComponents:i});if(s!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:i,file:r,resolvedType:o}),property:Y1.body(s)}}resolveObjectProperty({file:t,resolvedType:r,propertyComponents:n}){return rDr({typeResolver:this.typeResolver,file:GYe(r)??t,resolvedType:r,propertyComponents:n})}propertyPathFromPropertyComponents({propertyComponents:t,file:r,resolvedType:n}){if(t.length<=1)return[];let i=kNe(n),o=n,s=[],a=[];for(let c of t.slice(0,-1))a.push(c),o=QPf({typeResolver:this.typeResolver,file:r,resolvedType:o,propertyName:c,breadcrumbs:a,rootTypeTitle:i}),s.push({name:r.casingsGenerator.generateName(c),type:o.originalTypeReference});return s}propertyPathFromPropertyComponentsFromInlineRequestBody({propertyComponents:t,file:r,body:n}){if(t.length<=1)return[];let i=[],o=[];for(let s of t.slice(0,-1)){o.push(s);let a=nDr({typeResolver:this.typeResolver,file:r,objectSchema:n,propertyComponents:o});if(!a)throw new N({message:`Cannot find property '${o.join(".")}' in inline request body in file ${r.relativeFilepath}`,code:N.Code.InternalError});i.push({name:r.casingsGenerator.generateName(s),type:a.valueType})}return i}};function QPf({typeResolver:e,file:t,resolvedType:r,propertyName:n,breadcrumbs:i,rootTypeTitle:o}){let s=ZYe({typeResolver:e,file:t,resolvedType:r,propertyName:n});if(!s)throw new N({message:`Cannot find property '${i.join(".")}' in ${o}`,code:N.Code.InternalError});return s}function ZYe({typeResolver:e,file:t,resolvedType:r,propertyName:n}){switch(r._type){case"container":switch(r.container._type){case"list":return;case"literal":return;case"map":return;case"nullable":{let i=ZYe({typeResolver:e,file:t,resolvedType:r.container.itemType,propertyName:n});return i||void 0}case"optional":{let i=ZYe({typeResolver:e,file:t,resolvedType:r.container.itemType,propertyName:n});return i||void 0}case"set":return;default:Ce(r.container)}break;case"primitive":return;case"unknown":return;case"named":{let i=r.declaration;if("properties"in i&&i.properties!=null){for(let[o,s]of Object.entries(i.properties))if(o===n)return e.resolveTypeOrThrow({type:typeof s=="string"?s:s.type,file:r.file})}if("base-properties"in i&&i["base-properties"]!=null){for(let[o,s]of Object.entries(i["base-properties"]))if(o===n)return e.resolveTypeOrThrow({type:typeof s=="string"?s:s.type,file:r.file})}if("extends"in i&&i.extends!=null){let o=Array.isArray(i.extends)?i.extends:[i.extends];for(let s of o){let a=e.resolveTypeOrThrow({type:s,file:r.file}),c=ZYe({file:"file"in a?a.file:t,typeResolver:e,resolvedType:a,propertyName:n});if(c)return c}}if("union"in i&&i.union!=null)if(Array.isArray(i.union))for(let o of i.union){let s=e.resolveTypeOrThrow({type:typeof o=="string"?o:o.type,file:r.file}),a=ZYe({file:"file"in s?s.file:t,typeResolver:e,resolvedType:s,propertyName:n});if(a)return a}else for(let[,o]of Object.entries(i.union)){let s=typeof o=="string"?o:o.type;if(!s)continue;let a=e.resolveTypeOrThrow({type:s,file:r.file}),c=ZYe({file:"file"in a?a.file:t,typeResolver:e,resolvedType:a,propertyName:n});if(c)return c}return}default:Ce(r)}}function kNe(e){switch(e._type){case"container":switch(e.container._type){case"list":return`list<${kNe(e.container.itemType)}>}`;case"literal":return`literal<${e.container.literal._visit({boolean:t=>t.toString(),string:t=>t,_other:t=>t.type})}>`;case"map":return`map<${kNe(e.container.keyType)}, ${kNe(e.container.valueType)}>}`;case"nullable":return`nullable<${kNe(e.container.itemType)}>}`;case"optional":return`optional<${kNe(e.container.itemType)}>}`;case"set":return`set<${kNe(e.container.itemType)}>}`;default:Ce(e.container)}break;case"named":return Mr(e.name.name);case"primitive":return e.primitive.v1;case"unknown":return"unknown";default:Ce(e)}}var af=class{workspace;constructor(t){this.workspace=t}resolveTypeOrThrow({type:t,file:r}){let n=this.resolveType({type:t,file:r});if(n==null)throw new N({message:"Cannot resolve type: "+t+" in file "+r.relativeFilepath,code:N.Code.ResolutionError});return n}getDeclarationOfNamedTypeOrThrow({referenceToNamedType:t,file:r}){let n=this.getDeclarationOfNamedType({referenceToNamedType:t,file:r});if(n==null)throw new N({message:"Cannot find declaration of type: "+t+" in file "+r.relativeFilepath,code:N.Code.ResolutionError});return n}getDeclarationOfNamedType({referenceToNamedType:t,file:r}){let n=D6({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(n==null)return;let i=Z3(this.workspace,n.relativeFilepath);if(i==null)return;let o=i.types?.[n.typeName];if(o==null){let s=Jb(n.typeName);if(s!=null){for(let a of Object.keys(i.types??{})??[])if(s.name&&a.startsWith(s.name)&&a.endsWith(">")){let c=i.types?.[a];return c!=null?{typeName:a,declaration:c,file:mu({relativeFilepath:n.relativeFilepath,definitionFile:i,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}:void 0}}return}return{typeName:n.typeName,declaration:o,file:mu({relativeFilepath:n.relativeFilepath,definitionFile:i,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}resolveType({type:t,file:r,objectPath:n=[]}){return rv({type:t,_default:void 0,validation:void 0,visitor:{primitive:i=>({_type:"primitive",primitive:i,originalTypeReference:jr.primitive(i)}),unknown:()=>({_type:"unknown",originalTypeReference:jr.unknown()}),map:({keyType:i,valueType:o})=>i!=null&&o!=null?{_type:"container",container:{_type:"map",keyType:i,valueType:o},originalTypeReference:jr.container(js.map({keyType:i.originalTypeReference,valueType:o.originalTypeReference}))}:void 0,list:i=>i!=null?{_type:"container",container:{_type:"list",itemType:i},originalTypeReference:jr.container(js.list(i.originalTypeReference))}:void 0,optional:i=>i!=null?{_type:"container",container:{_type:"optional",itemType:i},originalTypeReference:jr.container(js.optional(i.originalTypeReference))}:void 0,nullable:i=>i!=null?{_type:"container",container:{_type:"nullable",itemType:i},originalTypeReference:jr.container(js.nullable(i.originalTypeReference))}:void 0,set:i=>i!=null?{_type:"container",container:{_type:"set",itemType:i},originalTypeReference:jr.container(js.set(i.originalTypeReference))}:void 0,literal:i=>({_type:"container",container:{_type:"literal",literal:i},originalTypeReference:jr.container(js.literal(i))}),named:i=>{let o=this.getDeclarationOfNamedType({referenceToNamedType:i,file:r});if(o==null)return;let s={typeName:o.typeName,file:o.file.relativeFilepath,reference:i};if(!n.some(a=>a.file===s.file&&a.typeName===s.typeName))return this.resolveNamedTypeFromDeclaration({referenceToNamedType:i,referencedIn:r,rawDeclaration:o,objectPath:[...n,s]})}}})}resolveNamedTypeOrThrow({referenceToNamedType:t,file:r}){let n=this.resolveNamedType({referenceToNamedType:t,file:r});if(n==null)throw new N({message:"Cannot resolve type: "+t,code:N.Code.ResolutionError});return n}resolveNamedType({referenceToNamedType:t,file:r}){let n=this.getDeclarationOfNamedType({referenceToNamedType:t,file:r});if(n!=null)return this.resolveNamedTypeFromDeclaration({referenceToNamedType:t,referencedIn:r,rawDeclaration:n})}resolveNamedTypeFromDeclaration({referenceToNamedType:t,referencedIn:r,rawDeclaration:n,objectPath:i=[]}){let{declaration:o,file:s}=n;if(Khe(o))return this.resolveType({type:typeof o=="string"?o:o.type,file:s,objectPath:i});let a=pkt({type:t,_default:void 0,validation:void 0,file:r});if(!(a.type!=="named"||Z3(this.workspace,s.relativeFilepath)==null))return{_type:"named",rawName:n.typeName,name:a,declaration:o,filepath:s.relativeFilepath,objectPath:i,originalTypeReference:a,file:s}}};var O7=class e{static VARIABLE_PREFIX="$";getDeclarationOrThrow(t,r){let n=this.getDeclaration(t,r);if(n==null)throw new N({message:"Variable does not exist: "+t,code:N.Code.ResolutionError});return n}getDeclaration(t,r){if(!t.startsWith(e.VARIABLE_PREFIX))return;let n=r.rootApiFile.variables?.[t.substring(1)];if(n!=null)return{declaration:n,file:yue({casingsGenerator:r.casingsGenerator,rootApiFile:r.rootApiFile})}}getVariableIdOrThrow(t){let r=this.getVariableId(t);if(r==null)throw new N({message:"Variable reference does not start with "+e.VARIABLE_PREFIX,code:N.Code.ResolutionError});return r}getVariableId(t){if(t.startsWith(e.VARIABLE_PREFIX))return t.substring(e.VARIABLE_PREFIX.length)}};function wDr(e,t){if(t){for(let[r,n]of Object.entries(t))if(typeof n!="string"&&r===e)return n.audiences}}var EHa={pathParameterOrder:Rn.PathParameterOrder.UrlOrder};function IHa({workspace:e}){let t=e.generatorsConfiguration?.api?.settings,r={...EHa};for(let n of Object.keys(EHa)){let i=t?.[n];i!==void 0&&(r[n]=i)}return r}function Sg({workspace:e,generationLanguage:t,keywords:r,smartCasing:n,exampleGeneration:i,audiences:o,readme:s,packageName:a,version:c,fdrApiDefinitionId:u,sourceResolver:l,disableDynamicExamples:p,dynamicGeneratorConfig:d,generationMetadata:f}){let m=IHa({workspace:e}),h=lx({generationLanguage:t,keywords:r,smartCasing:n}),A=new BNe(o),b=yue({casingsGenerator:h,rootApiFile:e.definition.rootApiFile.contents}),v=(e.definition.rootApiFile.contents.errors??[]).map(ht=>({error:K0e({errorName:ht,file:b}),docs:void 0})),w=new af(e),C=new RNe(e),x=new CDr(w,C),B=new FNe(e),O=new R6(w),F=new O7,L=rkt({casingsGenerator:h,rawApiFileSchema:e.definition.rootApiFile.contents})?.environmentsConfig,K={selfHosted:!1,fdrApiDefinitionId:u,apiVersion:X$a({file:b,rawApiFileSchema:e.definition.rootApiFile.contents}),apiName:h.generateName(e.definition.rootApiFile.contents.name),apiDisplayName:e.definition.rootApiFile.contents["display-name"],apiDocs:akt(e.definition.rootApiFile.contents.docs),auth:Y$a({rawApiFileSchema:e.definition.rootApiFile.contents,file:b,propertyResolver:x,endpointResolver:C,typeResolver:w}),headers:e.definition.rootApiFile.contents.headers!=null?Object.entries(e.definition.rootApiFile.contents.headers).map(([ht,Pt])=>PU({headerKey:ht,header:Pt,file:b})):[],idempotencyHeaders:e.definition.rootApiFile.contents["idempotency-headers"]!=null?Object.entries(e.definition.rootApiFile.contents["idempotency-headers"]).map(([ht,Pt])=>PU({headerKey:ht,header:Pt,file:b})):[],types:{},errors:{},services:{},constants:U$a(h),environments:L,errorDiscriminationStrategy:rHa(e.definition.rootApiFile.contents["error-discrimination"],b),basePath:e.definition.rootApiFile.contents["base-path"]!=null?ub(e.definition.rootApiFile.contents["base-path"]):void 0,pathParameters:YYe({pathParameters:e.definition.rootApiFile.contents["path-parameters"],file:b,location:Zt.PathParameterLocation.Root,variableResolver:F}),variables:e.definition.rootApiFile.contents.variables!=null?Object.entries(e.definition.rootApiFile.contents.variables).map(([ht,Pt])=>({docs:typeof Pt!="string"?Pt.docs:void 0,id:ht,name:b.casingsGenerator.generateName(ht),type:b.parseTypeReference(Pt)})):[],serviceTypeReferenceInfo:{typesReferencedOnlyByService:{},sharedTypes:[]},webhookGroups:{},websocketChannels:{},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,audiences:e.definition.rootApiFile.contents.audiences,generationMetadata:f,apiPlayground:!0,casingsConfig:{generationLanguage:t,keywords:r,smartCasing:n}},X=new vDr,Y=ht=>{X.addSubpackage(ht.fernFilepath),_p(ht.definitionFile,{imports:bt,docs:Pt=>{Pt!=null&&X.addDocs(ht.fernFilepath,Pt)},types:Pt=>{if(Pt!=null)for(let[Lt,Ut]of Object.entries(Pt)){if(p3(Lt))continue;let be=dHa({typeName:Lt,typeDeclaration:Ut,file:ht,typeResolver:w,exampleResolver:O,sourceResolver:l,workspace:e}),pe=be.typeDeclaration;i.disabled&&(pe.userProvidedExamples=[],pe.autogeneratedExamples=[]);let ze=be.descendantFilepaths,at=Jl.generateTypeId(pe.name);K.types[at]=pe,X.addType(at,pe),A.addType({declaredTypeName:pe.name,descendantTypeIds:pe.referencedTypes,descendantTypeIdsByAudience:{},propertiesByAudience:be.propertiesByAudience,descendantFilepaths:ze}),A.markTypeForAudiences(pe.name,UWa(Ut))}},errors:Pt=>{if(Pt==null)return;if(e.definition.rootApiFile.contents["error-discrimination"]==null)throw new N({message:"error-discrimination is missing in api.yml but there are declared errors.",code:N.Code.ConfigError});for(let[Ut,be]of Object.entries(Pt)){let pe=eHa({errorName:Ut,errorDeclaration:be,file:ht,typeResolver:w,exampleResolver:O,workspace:e}),ze=Jl.generateErrorId(pe.name);K.errors[ze]=pe,X.addError(ze,pe),A.addError(pe)}},service:Pt=>{if(Pt==null)return;let Lt=Q$a({rootDefaultUrl:ht.defaultUrl??e.definition.rootApiFile.contents["default-url"],rootPathParameters:K.pathParameters,serviceDefinition:Pt,file:ht,errorResolver:B,typeResolver:w,propertyResolver:x,exampleResolver:O,sourceResolver:l,globalErrors:v,variableResolver:F,workspace:e,auth:K.auth,irSettings:m}),Ut=Jl.generateServiceId(Lt.name);K.services[Ut]=Lt,X.addService(Ut,Lt);let be={};Lt.endpoints.forEach(pe=>{i.disabled&&(pe.autogeneratedExamples=[],pe.userSpecifiedExamples=[]);let ze=Mr(pe.name),at=Pt.endpoints[ze];A.addEndpoint(Lt,pe,at),be[ze]=pe}),Pt.audiences!=null&&A.markEndpointForAudience(Lt.name,Lt.endpoints,Pt.audiences),Object.entries(Pt.endpoints).map(([pe,ze])=>{let at=be[pe];at!=null&&ze.audiences!=null&&A.markEndpointForAudience(Lt.name,[at],ze.audiences)})},webhooks:Pt=>{if(Pt==null)return;let Lt=Jl.generateWebhookGroupId(ht.fernFilepath),Ut=iHa({webhooks:Pt,file:ht,typeResolver:w,exampleResolver:O,workspace:e,defaultSignature:ht.definitionFile["webhook-signature"]}),be={};for(let pe of Ut)be[Mr(pe.name)]=pe;Object.entries(Pt).forEach(([pe,ze])=>{let at=be[pe];at!=null&&(A.addWebhook(ht.fernFilepath,at,ze),ze.audiences!=null&&A.markWebhookForAudiences(ht.fernFilepath,at,ze.audiences))}),K.webhookGroups[Lt]=Ut,X.addWebhookGroup(Lt,ht.fernFilepath)},"webhook-signature":bt,channel:Pt=>{if(Pt==null)return;let Lt=Jl.generateWebSocketChannelId(ht.fernFilepath),Ut=Z$a({channel:Pt,file:ht,variableResolver:F,typeResolver:w,exampleResolver:O,workspace:e});A.addChannel(ht.fernFilepath,Lt,Ut,Pt),Pt.audiences!=null&&A.markChannelForAudiences(ht.fernFilepath,Lt,Pt.audiences),K.websocketChannels!=null&&(K.websocketChannels[Lt]=Ut,X.addWebSocketChannel(Lt,ht.fernFilepath))}})};uv(e,(ht,Pt,Lt)=>{Y(mu({relativeFilepath:ht,definitionFile:Pt,casingsGenerator:h,rootApiFile:e.definition.rootApiFile.contents,defaultUrl:Lt.defaultUrl}))}),AFe(e,(ht,Pt)=>{if(Pt.navigation!=null)if(typeof Pt.navigation=="string")X.addPackageRedirection({from:SN({relativeFilepath:ht,casingsGenerator:h}),to:SN({relativeFilepath:eI(e3(ht),$s.of(Pt.navigation)),casingsGenerator:h})});else{let Lt=Pt.navigation.map(Ut=>Jl.generateSubpackageId(SN({relativeFilepath:eI(e3(ht),$s.of(Ut)),casingsGenerator:h})));ht===Rf?X.sortRootPackage(Lt):X.sortSubpackage(Jl.generateSubpackageId(SN({relativeFilepath:ht,casingsGenerator:h})),Lt)}}),K.serviceTypeReferenceInfo=MPf(A),hHa(K);let de=i.disabled?K:okt({ir:K,exampleGeneration:i}),he=e.definition.rootApiFile.contents,ae=L?.environments._visit({singleBaseUrl:ht=>ht.environments.filter(Pt=>wDr(Pt.id,he.environments)!=null).length===0,multipleBaseUrls:ht=>ht.environments.filter(Pt=>wDr(Pt.id,he.environments)!=null).length===0,_other:()=>!1});L?.environments.environments.forEach(ht=>{A.markEnvironmentForAudiences(ht,wDr(ht.id,he.environments)??[],ae)});let me=A.hasNoAudiences()?void 0:A.build(),Re=yYi(de,me),Qe=e.definition.rootApiFile.contents.auth!=null&&Object.values(Re.services).every(ht=>ht.endpoints.every(Pt=>Pt.auth)),re=Object.values(Re.services).some(ht=>ht.endpoints.some(Pt=>Pt.response?.body?.type==="streaming")),ie=Object.values(Re.services).some(ht=>ht.endpoints.some(Pt=>Pt.pagination!=null)),Ee=Object.values(Re.services).some(ht=>ht.endpoints.some(Pt=>Pt.response?.body?.type==="fileDownload")),Ie={isAuthMandatory:Qe,hasStreamingEndpoints:re,hasPaginatedEndpoints:ie,hasFileDownloadEndpoints:Ee,platformHeaders:{language:"X-Fern-Language",sdkName:"X-Fern-SDK-Name",sdkVersion:"X-Fern-SDK-Version",userAgent:c!=null&&a!=null?{header:"User-Agent",value:`${a}/${c}`}:void 0}},Fe=s??e.generatorsConfiguration?.rawConfiguration.readme,Ue=Fe!=null?nHa({readme:Fe,services:K.services}):void 0,st=jPf({...Re,...X.build(me),sdkConfig:Ie,readmeConfig:Ue});return{...st,dynamic:DNe({ir:st,generatorConfig:d,disableExamples:p,generationLanguage:t,smartCasing:n})}}function jPf(e){let t=r=>{if(!r||typeof r!="object")return r;if(Array.isArray(r))return r.map(t);for(let n in r){let i=r[n];n==="docs"&&typeof i=="string"?r[n]=akt(i):i&&typeof i=="object"&&t(i)}return r};return t(e)}function MPf(e){let t={},r=[],n=e.getTypesReferencedByService();for(let[i,o]of Object.entries(n)){if(o.size===1){let s=o.values().next().value;if(s==null)break;t[s]===void 0&&(t[s]=[]),t[s]?.push(i);continue}r.push(i)}return{typesReferencedOnlyByService:t,sharedTypes:r}}var Jf=lx({generationLanguage:void 0,keywords:void 0,smartCasing:!1});var QYi={name:"exploded-form-data-is-array",create:({workspace:e})=>{let t=new af(e);return{definitionFile:{httpEndpoint:({endpoint:r},{relativeFilepath:n,contents:i})=>{if(r.request==null||typeof r.request=="string"||r.request?.body==null||typeof r.request.body=="string")return[];if(!LPf(r.request.body))return[];let o=[];for(let[s,a]of Object.entries(r.request.body.properties??{})){if(typeof a=="string"||a.style!=="exploded")continue;let c=mu({relativeFilepath:n,definitionFile:i,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),u=t.resolveType({type:a.type,file:c});if(u==null)return[];vHa(u)||o.push({message:`${s} is exploded and must be a list. Did you mean list<${a.type}>?`,severity:"error"})}return o}}}}};function vHa(e){return e._type!=="container"?!1:e.container._type==="list"?!0:e.container._type==="optional"||e.container._type==="nullable"?vHa(e.container.itemType):!1}function LPf(e){return e?.properties!=null}Xt();var jYi={name:"import-file-exists",create:({workspace:e})=>{let t=Object.keys(Dae(e.definition)),r=new Set;return t.forEach(n=>{let i=Ye(e.definition.absoluteFilePath,De.of(n));r.add(i)}),{definitionFile:{import:({importedAs:n,importPath:i},{relativeFilepath:o})=>{let s=[],a=Ye(e.definition.absoluteFilePath,Sn(o),De.of(i));return r.has(a)||s.push({severity:"fatal",message:`Import ${ve.bold(n)} points to non-existent path ${ve.bold(i)}.`}),s}}}}};function xDr(e){return e.definition.rootApiFile.contents.environments==null?[]:Object.values(e.definition.rootApiFile.contents.environments).reduce((t,r)=>{if(oO(r))for(let n of Object.keys(r.urls))t.includes(n)||t.push(n);return t},[])}var MYi={name:"matching-environment-urls",create:({workspace:e})=>{let t=xDr(e);return t.length===0?{}:{rootApiFile:{environment:({environmentId:r,environment:n})=>{let i=[],o=s=>{i.push({severity:"fatal",message:`Environment ${r} is missing URL for ${ve.bold(s)}`})};return CH(n,{singleBaseUrl:()=>{for(let s of t)o(s)},multipleBaseUrls:s=>{for(let a of t)s.urls[a]==null&&o(a)}}),i}}}}};jt();Xt();var LYi={name:"no-circular-imports",DISABLE_RULE:!0,create:({workspace:e})=>{let t=UPf(e.definition.namedDefinitionFiles);return{definitionFile:{import:({importPath:r},{relativeFilepath:n})=>{let i=t[n];if(i==null)return[];let o=$0e({referencedIn:n,importPath:De.of(r)});return i.filter(({chainWithoutStartingFilepath:a})=>a.length===0||a[0]===o).map(a=>({severity:"fatal",message:a.chainWithoutStartingFilepath.length===0?"A file cannot import itself":`Circular import detected: ${[a.startingFilepath,...a.chainWithoutStartingFilepath,a.startingFilepath].join(" -> ")}`}))}}}}};function UPf(e){let t={};for(let r of UT(e))t[r]=CHa(r,[r],e);return t}function CHa(e,t,r){let n=[],i=r[e];if(i==null)return[];if(i.contents.imports!=null)for(let o of Object.values(i.contents.imports)){let s=$0e({referencedIn:e,importPath:De.of(o)});t.includes(s)?t[0]===s&&t[0]===zPf(t)&&n.push({startingFilepath:s,chainWithoutStartingFilepath:t.slice(1)}):n.push(...CHa(s,[...t,s],r))}return n}function zPf(e){return e.reduce((t,r)=>r<t?r:t)}jt();var SDr=class{workspace;typeResolver;constructor(t){this.workspace=t,this.typeResolver=new af(t)}isTypeComplex(t,r){let n=mu({relativeFilepath:r.relativeFilepath,definitionFile:r.contents,casingsGenerator:Jf,rootApiFile:this.workspace.definition.rootApiFile.contents}),i=this.typeResolver.resolveType({type:t,file:n});if(i==null)return;let o=new Set;return this.isResolvedReferenceComplex({type:i,file:n,visited:o})}isResolvedReferenceComplex({type:t,file:r,visited:n}){switch(t._type){case"container":return this.isResolvedContainerComplex({type:t.container,file:r,visited:n});case"named":return this.isNamedTypeComplex({type:t,file:r,visited:n});case"primitive":return!1;case"unknown":return!1;default:Ce(t)}}isResolvedContainerComplex({type:t,file:r,visited:n}){switch(t._type){case"literal":return!1;case"map":return(this.isResolvedReferenceComplex({type:t.keyType,file:r,visited:n})||this.isResolvedReferenceComplex({type:t.valueType,file:r,visited:n}))&&!(t.keyType._type==="primitive"&&t.keyType.primitive.v1==="STRING"&&t.valueType._type==="unknown");case"optional":case"nullable":case"list":case"set":return this.isResolvedReferenceComplex({type:t.itemType,file:r,visited:n});default:Ce(t)}}isNamedTypeComplex({type:t,file:r,visited:n}){if(n.has(t.rawName))return!1;if(n.add(t.rawName),v3(t.declaration))return!0;if(wG(t.declaration))return!1;if(sf(t.declaration))return this.objectHasComplexProperties({typeName:t.rawName,objectDeclaration:t.declaration,file:r,visited:n});if(QGe(t.declaration)){for(let i of t.declaration.union){let o=typeof i=="string"?i:i.type,s=this.isTypeComplex(o,{contents:r.definitionFile,relativeFilepath:r.relativeFilepath});if(s!=null&&s)return!0}return!1}Ce(t.declaration)}objectHasComplexProperties({typeName:t,objectDeclaration:r,file:n,visited:i}){return OU({typeName:t,objectDeclaration:r,typeResolver:this.typeResolver,definitionFile:n.definitionFile,workspace:this.workspace,filepathOfDeclaration:n.relativeFilepath,smartCasing:!1}).some(s=>this.isComplex({type:s.resolvedPropertyType,file:n,visited:i}))}isComplex({type:t,file:r,visited:n}){switch(t._type){case"named":return this.isNamedTypeComplex({type:t,file:r,visited:n});case"primitive":case"unknown":return!1;case"container":return this.isComplexContainer({type:t.container,file:r,visited:n});default:Ce(t)}}isComplexContainer({type:t,file:r,visited:n}){switch(t._type){case"literal":return!1;case"map":return this.isComplex({type:t.keyType,file:r,visited:n})||this.isComplex({type:t.valueType,file:r,visited:n});case"optional":case"nullable":case"list":case"set":return this.isComplex({type:t.itemType,file:r,visited:n});default:Ce(t)}}};var UYi={name:"no-complex-query-params",create:({workspace:e})=>{let t=new SDr(e);return{definitionFile:{queryParameter:({queryParameter:r},n)=>{let i=typeof r=="string"?r:r.type,o=t.isTypeComplex(i,n);return o!=null&&o?[{severity:"fatal",message:`${i} is not a valid type for a query parameter`}]:[]}}}}};var zYi={name:"no-conflicting-endpoint-parameters",create:()=>({definitionFile:{pathParameter:({pathParameterKey:e})=>e===iDr?[{severity:"fatal",message:`Path parameter ${ve.bold(e)} is not suitable for code generation, because it can conflict with the request body parameter.`}]:[]}})};function Akt({service:e,endpoint:t}){return e["base-path"]+t.path}var _Dr=class{root=new VYi;registerEndpoint(t){this.root.insert(this.getPathPartsForEndpoint(t),t)}getConflictingEndpoints(t){return this.root.getMatchingEndpoints(this.getPathPartsForEndpoint(t)).filter(r=>!(r.relativeFilepath===t.relativeFilepath&&r.endpointId===t.endpointId)&&r.endpoint.method===t.endpoint.method)}getPathPartsForEndpoint(t){return Akt({service:t.service,endpoint:t.endpoint}).split("/").filter(r=>r.length>0)}},VYi=class e{childPaths={};childPathParam;endpointsThatEndWithThisNode=[];insert(t,r){let[n,...i]=t;if(n==null){this.endpointsThatEndWithThisNode.push(r);return}(this.isPathParam(n)?this.childPathParam??=new e:this.childPaths[n]??=new e).insert(i,r)}getMatchingEndpoints(t){let[r,...n]=t;if(r==null)return this.endpointsThatEndWithThisNode;let i=[];if(this.isPathParam(r))i.push(...Object.values(this.childPaths).flatMap(o=>o.getMatchingEndpoints(n)));else{let o=this.childPaths[r];o!=null&&i.push(...o.getMatchingEndpoints(n))}return this.childPathParam!=null&&i.push(...this.childPathParam.getMatchingEndpoints(n)),i}isPathParam(t){return t.startsWith("{")&&t.endsWith("}")}};var qYi={name:"no-conflicting-endpoint-paths",create:({workspace:e})=>{let t=new _Dr;return uv(e,(r,n)=>{nB(n,{httpEndpoint:({service:i,endpointId:o,endpoint:s})=>{t.registerEndpoint({service:i,endpointId:o,endpoint:s,relativeFilepath:r})}})}),{definitionFile:{httpEndpoint:({service:r,endpoint:n,endpointId:i},{relativeFilepath:o})=>{let s=t.getConflictingEndpoints({service:r,endpointId:i,endpoint:n,relativeFilepath:o});return s.length===0?[]:[{severity:"warning",message:[`Endpoint path ${Akt({service:r,endpoint:n})} conflicts with other endpoints:`,...s.map(a=>` - ${a.relativeFilepath} -> ${a.endpointId} ${ve.dim(Akt({service:a.service,endpoint:a.endpoint}))}`)].join(`
|
|
2540
|
+
${JSON.stringify(r)}"`,code:N.Code.InternalError})}}function N$a(e,t,r,n){let i=r.resolveSourceOrThrow({source:t,relativeFilepath:e.relativeFilepath});if(i==null||i.type!=="protobuf")throw new N({message:`Expected a protobuf source for ${t.proto}.`,code:N.Code.ResolutionError});let o=R$a({source:i,serviceNameOverride:n});if(o==null)throw new N({message:`Failed to resolve service name from ${i.relativeFilePath}.`,code:N.Code.IrConversionError});return m3.grpc({service:o})}function Q$a({rootDefaultUrl:e,rootPathParameters:t,serviceDefinition:r,file:n,errorResolver:i,typeResolver:o,propertyResolver:s,exampleResolver:a,variableResolver:c,sourceResolver:u,globalErrors:l,workspace:p,auth:d,irSettings:f}){let m=YYe({pathParameters:r["path-parameters"],location:Zt.PathParameterLocation.Service,file:n,variableResolver:c}),h=f.pathParameterOrder,A=(()=>{switch(h){case Rn.PathParameterOrder.UrlOrder:return r["base-path"]?sDr(r["base-path"],m):m;case Rn.PathParameterOrder.SpecOrder:return m;default:Ce(h)}})(),b=F$a({file:n,serviceDeclaration:r,sourceResolver:u}),v={fernFilepath:n.fernFilepath};return{availability:_N(r.availability),name:v,displayName:r["display-name"]??void 0,basePath:ub(r["base-path"]),headers:r.headers!=null?Object.entries(r.headers).map(([C,x])=>PU({headerKey:C,header:x,file:n})):[],pathParameters:A,encoding:ROf(b,r),transport:b,endpoints:Object.entries(r.endpoints).map(([C,x])=>{let B=x["base-path"]!=null?(0,dDr.default)(x["base-path"],x.path):n.rootApiFile["base-path"]!=null?(0,dDr.default)(n.rootApiFile["base-path"],r["base-path"],x.path):(0,dDr.default)(r["base-path"],x.path),O=YYe({pathParameters:T7(x),location:Zt.PathParameterLocation.Endpoint,file:n,variableResolver:c}),F=(()=>{switch(h){case Rn.PathParameterOrder.UrlOrder:return sDr(x.path,O);case Rn.PathParameterOrder.SpecOrder:return O;default:Ce(h)}})(),T=x["base-path"]!=null?F:[...t,...A,...F],L=(()=>{switch(h){case Rn.PathParameterOrder.UrlOrder:return sDr(B,T);case Rn.PathParameterOrder.SpecOrder:return T;default:Ce(h)}})(),K={...e_(x),id:"",name:n.casingsGenerator.generateName(C),displayName:x["display-name"],auth:typeof x.auth=="boolean"?x.auth:x.auth!=null?x.auth.length>0:r.auth??d.schemes.length>0,security:typeof x.auth>"u"||typeof x.auth=="boolean"?x.auth??(r.auth??d.schemes.length>0)===!0?Ww._visit(d.requirement,{any:()=>d.schemes.map(X=>({[X.key]:[]})),all:()=>[d.schemes.reduce((X,Y)=>({...X,[Y.key]:[]}),{})],endpointSecurity:()=>{},_other:()=>{}}):void 0:x.auth,docs:x.docs,idempotent:x.idempotent??r.idempotent??!1,baseUrl:x.url??r.url??e,v2BaseUrls:void 0,method:x.method!=null?DOf(x.method):Fd.Post,basePath:x["base-path"]!=null?ub(x["base-path"]):void 0,path:ub(x.path),fullPath:ub(B),pathParameters:F,allPathParameters:L,queryParameters:typeof x.request!="string"&&x.request?.["query-parameters"]!=null?Object.entries(x.request["query-parameters"]).map(([X,Y])=>uDr({file:n,queryParameterKey:X,queryParameter:Y})):[],headers:typeof x.request!="string"&&x.request?.headers!=null?Object.entries(x.request.headers).map(([X,Y])=>PU({headerKey:X,header:Y,file:n})):[],requestBody:qWa({request:x.request,file:n}),v2RequestBodies:void 0,sdkRequest:KWa({service:r,request:x.request,endpoint:x,endpointKey:C,file:n,typeResolver:o,propertyResolver:s}),response:C$a({endpoint:x,file:n,typeResolver:o}),v2Responses:void 0,errors:[...P$a({errors:x.errors,file:n}),...l],userSpecifiedExamples:x.examples!=null?x.examples.map(X=>{try{let Y=v$a({service:r,endpoint:x,example:X,typeResolver:o,errorResolver:i,exampleResolver:a,variableResolver:c,file:n,workspace:p});return Y===void 0?void 0:{example:Y,codeSamples:X["code-samples"]?.map(de=>JWa({codeSample:de,file:n}))}}catch{return}}).filter(X=>X!==void 0):[],autogeneratedExamples:[],pagination:O$a({propertyResolver:s,file:n,endpointName:C,endpointSchema:x}),transport:k$a({file:n,serviceTransport:b,endpointDeclaration:x,sourceResolver:u}),v2Examples:void 0,source:void 0,audiences:x.audiences,retries:D$a({endpointSchema:x}),apiPlayground:void 0,responseHeaders:[]};return K.id=Jl.generateEndpointId(v,K),K}),audiences:r.audiences}}function YYe({pathParameters:e,location:t,file:r,variableResolver:n}){return e==null?[]:Object.entries(e).map(([i,o])=>OOf({parameterName:i,parameter:o,location:t,file:r,variableResolver:n}))}function OOf({parameterName:e,parameter:t,location:r,file:n,variableResolver:i}){let o=typeof t!="string"&&"type"in t?t["client-default"]:void 0;return{...e_(t),name:n.casingsGenerator.generateName(e),valueType:POf({parameter:t,variableResolver:i,file:n}),location:r,variable:NGe(t)?i.getVariableIdOrThrow(typeof t=="string"?t:t.variable):void 0,clientDefault:lkt(o),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}},explode:void 0}}function POf({parameter:e,variableResolver:t,file:r}){let n=hkt({parameter:e,variableResolver:t,file:r});return n.file.parseTypeReference(n.rawType)}function hkt({parameter:e,variableResolver:t,file:r}){let n=mDr({parameter:e,variableResolver:t,file:r});if(n==null)throw new N({message:"Cannot resolve path parameter",code:N.Code.InternalError});return n}function mDr({parameter:e,variableResolver:t,file:r}){if(NGe(e)){let n=typeof e=="string"?e:e.variable,i=t.getDeclaration(n,r);return i==null?void 0:{rawType:typeof i.declaration=="string"?i.declaration:i.declaration.type,file:i.file}}else return{file:r,rawType:typeof e=="string"?e:e.type}}function DOf(e){switch(e){case"GET":return Fd.Get;case"POST":return Fd.Post;case"PUT":return Fd.Put;case"PATCH":return Fd.Patch;case"DELETE":return Fd.Delete;case"HEAD":return Fd.Head;default:Ce(e)}}function PU({headerKey:e,header:t,file:r}){let{name:n}=kY({headerKey:e,header:t}),i=typeof t!="string"?t["client-default"]:void 0;return{...e_(t),name:r.casingsGenerator.generateNameAndWireValue({wireValue:e,name:n}),valueType:r.parseTypeReference(t),env:typeof t=="string"?void 0:t.env,clientDefault:lkt(i),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}function kY({headerKey:e,header:t}){return typeof t!="string"&&t.name!=null?{name:t.name,wasExplicitlySet:!0}:{name:e,wasExplicitlySet:!1}}function ROf(e,t){switch(e.type){case"http":return{json:{},proto:void 0};case"grpc":return{json:void 0,proto:{}};default:Ce(e)}}jt();var hDr=we(Sm(),1);var j$a=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function FOf(e){return typeof e=="string"&&j$a.test(e)}var BYi=FOf;var QB=[];for(let e=0;e<256;++e)QB.push((e+256).toString(16).slice(1));function M$a(e,t=0){return(QB[e[t+0]]+QB[e[t+1]]+QB[e[t+2]]+QB[e[t+3]]+"-"+QB[e[t+4]]+QB[e[t+5]]+"-"+QB[e[t+6]]+QB[e[t+7]]+"-"+QB[e[t+8]]+QB[e[t+9]]+"-"+QB[e[t+10]]+QB[e[t+11]]+QB[e[t+12]]+QB[e[t+13]]+QB[e[t+14]]+QB[e[t+15]]).toLowerCase()}var kOf=new Uint8Array(16);function TYi(){return crypto.getRandomValues(kOf)}function NOf(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():QOf(e,t,r)}function QOf(e,t,r){e=e||{};let n=e.random??e.rng?.()??TYi();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return M$a(n)}var XO=NOf;var L$a="1.0.0";var gDr=class{ir;casingsGenerator;fullCasingsGenerator;auth;authValues;generatorConfig;extendedTypeIds;constructor(t){this.ir=t.ir,this.generatorConfig=t.generatorConfig,this.casingsGenerator=lx({generationLanguage:t.generationLanguage,smartCasing:t.smartCasing??t.ir.casingsConfig?.smartCasing??!0,keywords:t.ir.casingsConfig?.keywords}),this.fullCasingsGenerator=G0e({generationLanguage:t.generationLanguage,smartCasing:t.smartCasing??t.ir.casingsConfig?.smartCasing??!0,keywords:t.ir.casingsConfig?.keywords}),this.auth=this.convertAuth(this.ir.auth),this.authValues=this.getAuthValues(this.ir.auth),this.extendedTypeIds=this.computeExtendedTypeIds()}inflateName(t){return typeof t=="string"?this.fullCasingsGenerator.generateName(t):t}inflateNameAndWireValue(t){return typeof t=="string"?this.fullCasingsGenerator.generateNameAndWireValue(t):{wireValue:t.wireValue,name:this.inflateName(t.name)}}inflateFernFilepath(t){return{allParts:t.allParts.map(r=>this.inflateName(r)),packagePath:t.packagePath.map(r=>this.inflateName(r)),file:t.file!=null?this.inflateName(t.file):void 0}}computeExtendedTypeIds(){let t=new Set;for(let r of Object.values(this.ir.types))if(r.shape.type==="object")for(let n of r.shape.extends)t.add(n.typeId);return t}convert({disableExamples:t}){return{version:L$a,types:this.convertNamedTypes(),headers:this.convertHeaders(),endpoints:this.convertEndpoints({disableExamples:t}),pathParameters:this.convertPathParameters({pathParameters:this.ir.pathParameters}),environments:this.ir.environments!=null?this.convertEnvironments(this.ir.environments):void 0,variables:this.convertVariables(),generatorConfig:this.generatorConfig}}convertNamedTypes(){return Object.fromEntries(Object.entries(this.ir.types).map(([t,r])=>[t,this.convertTypeDeclaration(r)]))}convertHeaders(){return this.convertWireValueParameters({wireValueParameters:this.ir.headers})}convertVariables(){if(this.ir.variables.length!==0)return this.ir.variables.map(t=>({id:t.id,name:this.inflateName(t.name),typeReference:this.convertTypeReference(t.type)}))}convertEndpoints({disableExamples:t}){let r=this.getAllHttpEndpoints();return Object.fromEntries(r.map(n=>[n.id,this.convertEndpoint({endpoint:n,disableExamples:t})]))}convertEndpoint({endpoint:t,disableExamples:r}){let n=this.convertEndpointLocation({endpoint:t});return{auth:this.auth,declaration:this.convertDeclaration({name:t.name,fernFilepath:t.fernFilepath}),location:n,request:this.convertRequest({endpoint:t}),response:t.response?.body?._visit({json:()=>$t.Response.json(),streaming:()=>$t.Response.streaming(),streamParameter:()=>$t.Response.streamParameter(),fileDownload:()=>$t.Response.fileDownload(),text:()=>$t.Response.text(),bytes:()=>$t.Response.bytes(),_other:()=>$t.Response.json()})??$t.Response.json(),examples:r?void 0:this.getEndpointSnippetRequests({endpoint:t,location:n})}}convertRequest({endpoint:t}){let r=this.convertPathParameters({pathParameters:[...t.servicePathParameters,...t.pathParameters]});if(t.sdkRequest==null&&t.requestBody==null)return $t.Request.body({pathParameters:r,body:void 0});if(t.sdkRequest==null)throw new N({message:`Internal error; endpoint "${t.id}" has a request body but no SDK request`,code:N.Code.InternalError});switch(t.sdkRequest.shape.type){case"justRequestBody":return $t.Request.body({pathParameters:r,body:this.convertReferencedRequestBodyType({body:t.sdkRequest.shape.value})});case"wrapper":return this.convertInlinedRequest({fernFilepath:t.fernFilepath,wrapper:t.sdkRequest.shape,pathParameters:r,queryParameters:this.convertQueryParameters({queryParameters:t.queryParameters}),headers:this.convertWireValueParameters({wireValueParameters:[...t.serviceHeaders,...t.headers]}),body:t.requestBody});default:Ce(t.sdkRequest.shape)}}convertReferencedRequestBodyType({body:t}){switch(t.type){case"bytes":return $t.ReferencedRequestBodyType.bytes();case"typeReference":return $t.ReferencedRequestBodyType.typeReference(this.convertTypeReference(t.requestBodyType));default:Ce(t)}}convertInlinedRequest({fernFilepath:t,wrapper:r,pathParameters:n,queryParameters:i,headers:o,body:s}){return $t.Request.inlined({declaration:this.convertDeclaration({name:r.wrapperName,fernFilepath:t}),pathParameters:n,queryParameters:i,headers:o,body:s!=null?this.convertInlinedRequestBody({wrapper:r,body:s}):void 0,metadata:this.convertInlinedRequestMetadata({wrapper:r})})}convertInlinedRequestMetadata({wrapper:t}){return{includePathParameters:t.includePathParameters??!1,onlyPathParameters:t.onlyPathParameters??!1}}convertInlinedRequestBody({wrapper:t,body:r}){switch(r.type){case"inlinedRequestBody":{let n=[...r.extendedProperties??[],...r.properties];return $t.InlinedRequestBody.properties(this.convertBodyPropertiesToParameters({properties:n}))}case"reference":return $t.InlinedRequestBody.referenced({bodyKey:this.inflateName(t.bodyKey),bodyType:$t.ReferencedRequestBodyType.typeReference(this.convertTypeReference(r.requestBodyType))});case"bytes":return $t.InlinedRequestBody.referenced({bodyKey:this.inflateName(t.bodyKey),bodyType:$t.ReferencedRequestBodyType.bytes()});case"fileUpload":return this.convertFileUploadRequestBody({properties:r.properties});default:Ce(r)}}convertFileUploadRequestBody({properties:t}){return $t.InlinedRequestBody.fileUpload({properties:this.convertFileUploadRequestBodyProperties({properties:t})})}convertFileUploadRequestBodyProperties({properties:t}){return t.map(r=>{switch(r.type){case"file":return this.convertFileUploadRequestBodyFileProperty({fileProperty:r.value});case"bodyProperty":return $t.FileUploadRequestBodyProperty.bodyProperty({name:this.inflateNameAndWireValue(r.name),typeReference:this.convertTypeReference(r.valueType),propertyAccess:r.propertyAccess,variable:void 0});default:Ce(r)}})}convertFileUploadRequestBodyFileProperty({fileProperty:t}){let r=t.key,n=typeof r=="string"?{wireValue:r,name:this.fullCasingsGenerator.generateName(r)}:{wireValue:r.wireValue,name:this.fullCasingsGenerator.generateName(r.name)};switch(t.type){case"file":return $t.FileUploadRequestBodyProperty.file(n);case"fileArray":return $t.FileUploadRequestBodyProperty.fileArray(n);default:Ce(t)}}convertPathParameters({pathParameters:t}){return t.map(r=>({name:{name:this.inflateName(r.name),wireValue:Mr(r.name)},typeReference:this.convertTypeReference(r.valueType),propertyAccess:void 0,variable:r.variable}))}convertBodyPropertiesToParameters({properties:t}){return t.map(r=>({name:this.inflateNameAndWireValue(r.name),typeReference:this.convertTypeReference(r.valueType),propertyAccess:r.propertyAccess,variable:void 0}))}convertWireValueParameters({wireValueParameters:t}){return t.map(r=>({name:this.inflateNameAndWireValue(r.name),typeReference:this.convertTypeReference(r.valueType),propertyAccess:void 0,variable:void 0}))}convertQueryParameters({queryParameters:t}){let r=[];for(let n of t){let i=this.convertTypeReference(n.valueType);n.allowMultiple&&(i=$t.TypeReference.list(i)),r.push({name:this.inflateNameAndWireValue(n.name),typeReference:i,propertyAccess:void 0,variable:void 0})}return r}convertTypeReference(t){switch(t.type){case"container":return this.convertContainerType(t.container);case"named":return this.convertNamedType(t);case"primitive":return this.convertPrimitiveType(t.primitive);case"unknown":return this.convertUnknownType();default:Ce(t)}}convertContainerType(t){switch(t.type){case"list":return $t.TypeReference.list(this.convertTypeReference(t.list));case"map":return $t.TypeReference.map({key:this.convertTypeReference(t.keyType),value:this.convertTypeReference(t.valueType)});case"optional":return $t.TypeReference.optional(this.convertTypeReference(t.optional));case"nullable":return $t.TypeReference.nullable(this.convertTypeReference(t.nullable));case"set":return $t.TypeReference.set(this.convertTypeReference(t.set));case"literal":return $t.TypeReference.literal(this.convertLiteral(t.literal));default:Ce(t)}}convertNamedType(t){return $t.TypeReference.named(t.typeId)}convertTypeDeclaration(t){let r=this.convertDeclaration(t.name);switch(t.shape.type){case"alias":return this.convertAlias({declaration:r,alias:t.shape});case"enum":return this.convertEnum({declaration:r,enum_:t.shape});case"object":return this.convertObject({declaration:r,object:t.shape,typeId:t.name.typeId});case"union":return this.convertDiscriminatedUnion({declaration:r,union:t.shape});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({declaration:r,union:t.shape});default:Ce(t.shape)}}convertAlias({declaration:t,alias:r}){return $t.NamedType.alias({declaration:t,typeReference:this.convertTypeReference(r.aliasOf)})}convertEnum({declaration:t,enum_:r}){return $t.NamedType.enum({declaration:t,values:r.values.map(n=>this.inflateNameAndWireValue(n.name))})}convertObject({declaration:t,object:r,typeId:n}){let o=this.extendedTypeIds.has(n)?[...r.properties,...r.extendedProperties??[]]:[...r.extendedProperties??[],...r.properties],s=r.extends.length>0?r.extends.map(a=>a.typeId):void 0;return this.convertObjectProperties({declaration:t,properties:o,extends_:s,additionalProperties:r.extraProperties})}convertObjectProperties({declaration:t,properties:r,extends_:n,additionalProperties:i}){return $t.NamedType.object({declaration:t,properties:this.convertBodyPropertiesToParameters({properties:r}),extends:n,additionalProperties:i})}convertDiscriminatedUnion({declaration:t,union:r}){let n=[...this.resolveProperties(r.extends),...r.baseProperties];return $t.NamedType.discriminatedUnion({declaration:t,discriminant:this.inflateNameAndWireValue(r.discriminant),types:Object.fromEntries(r.types.map(i=>[er(i.discriminantValue),this.convertDiscriminatedUnionType({inheritedProperties:n,discriminantValue:i.discriminantValue,singleUnionTypeProperties:i.shape})]))})}convertDiscriminatedUnionType({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperties:n}){switch(n.propertiesType){case"samePropertiesAsObject":return this.convertDiscriminatedUnionTypeObject({inheritedProperties:t,discriminantValue:r,declaredTypeName:n});case"singleProperty":return this.convertDiscriminatedUnionTypeSingleProperty({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperty:n});case"noProperties":return this.convertDiscriminatedUnionTypeNoProperties({inheritedProperties:t,discriminantValue:r});default:Ce(n)}}convertDiscriminatedUnionTypeObject({inheritedProperties:t,discriminantValue:r,declaredTypeName:n}){return $t.SingleDiscriminatedUnionType.samePropertiesAsObject({typeId:n.typeId,discriminantValue:this.inflateNameAndWireValue(r),properties:this.convertBodyPropertiesToParameters({properties:t})})}convertDiscriminatedUnionTypeSingleProperty({inheritedProperties:t,discriminantValue:r,singleUnionTypeProperty:n}){return $t.SingleDiscriminatedUnionType.singleProperty({typeReference:this.convertTypeReference(n.type),discriminantValue:this.inflateNameAndWireValue(r),properties:t.length>0?this.convertBodyPropertiesToParameters({properties:t}):void 0})}convertDiscriminatedUnionTypeNoProperties({inheritedProperties:t,discriminantValue:r}){return $t.SingleDiscriminatedUnionType.noProperties({discriminantValue:this.inflateNameAndWireValue(r),properties:t.length>0?this.convertBodyPropertiesToParameters({properties:t}):void 0})}convertUndiscriminatedUnion({declaration:t,union:r}){return $t.NamedType.undiscriminatedUnion({declaration:t,types:r.members.map(n=>this.convertTypeReference(n.type))})}convertLiteral(t){switch(t.type){case"boolean":return $t.LiteralType.boolean(t.boolean);case"string":return $t.LiteralType.string(t.string);default:Ce(t)}}convertPrimitiveType(t){return $t.TypeReference.primitive(t.v1)}convertUnknownType(){return $t.TypeReference.unknown()}convertAuth(t){if(t.schemes[0]==null)return;let r=t.schemes[0];switch(r.type){case"basic":return $t.Auth.basic({username:this.inflateName(r.username),usernameOmit:r.usernameOmit,password:this.inflateName(r.password),passwordOmit:r.passwordOmit});case"bearer":return $t.Auth.bearer({token:this.inflateName(r.token)});case"header":return $t.Auth.header({header:{name:this.inflateNameAndWireValue(r.name),typeReference:this.convertTypeReference(r.valueType),propertyAccess:void 0,variable:void 0}});case"oauth":return $t.Auth.oauth({clientId:this.fullCasingsGenerator.generateName("clientId"),clientSecret:this.fullCasingsGenerator.generateName("clientSecret")});case"inferred":return $t.Auth.inferred({parameters:this.getInferredAuthParameters(r)});default:Ce(r)}}getAuthValues(t){let r=t.schemes[0];if(r!=null)switch(r.type){case"bearer":return $t.AuthValues.bearer({token:r.tokenPlaceholder??"<token>"});case"basic":return $t.AuthValues.basic({username:r.usernameOmit?"":r.usernamePlaceholder??"<username>",password:r.passwordOmit?"":r.passwordPlaceholder??"<password>"});case"header":return $t.AuthValues.header({value:r.headerPlaceholder??"<value>"});case"oauth":return $t.AuthValues.oauth({clientId:"<clientId>",clientSecret:"<clientSecret>"});case"inferred":return $t.AuthValues.inferred({values:this.getInferredAuthValues(r)});default:Ce(r)}}getInferredAuthParameters(t){let r=[],n=Object.values(this.ir.services).flatMap(i=>i.endpoints).find(i=>i.id===t.tokenEndpoint.endpoint.endpointId);if(n==null)return r;for(let i of n.headers)(i.valueType.type!=="container"||i.valueType.container.type!=="literal")&&r.push({name:this.inflateNameAndWireValue(i.name),typeReference:this.convertTypeReference(i.valueType),propertyAccess:void 0,variable:void 0});if(n.requestBody!=null){let i=this.getRequestBodyProperties(n.requestBody);for(let o of i)(o.valueType.type!=="container"||o.valueType.container.type!=="literal")&&r.push({name:this.inflateNameAndWireValue(o.name),typeReference:this.convertTypeReference(o.valueType),propertyAccess:void 0,variable:void 0})}return r}getInferredAuthValues(t){let r={},n=Object.values(this.ir.services).flatMap(i=>i.endpoints).find(i=>i.id===t.tokenEndpoint.endpoint.endpointId);if(n==null)return r;for(let i of n.headers)if(i.valueType.type!=="container"||i.valueType.container.type!=="literal"){let o=er(i.name);r[o]=o}if(n.requestBody!=null){let i=this.getRequestBodyProperties(n.requestBody);for(let o of i)if(o.valueType.type!=="container"||o.valueType.container.type!=="literal"){let s=er(o.name);r[s]=s}}return r}getRequestBodyProperties(t){let r=[];if(t.type==="inlinedRequestBody")r.push(...t.properties);else if(t.type==="reference"){let n=t.requestBodyType;if(n.type==="named"){let i=this.ir.types[n.typeId];i!=null&&i.shape.type==="object"&&r.push(...i.shape.properties)}}return r}convertEnvironments(t){return{defaultEnvironment:t.defaultEnvironment,environments:t.environments._visit({singleBaseUrl:r=>$t.Environments.singleBaseUrl({environments:r.environments.map(n=>({docs:n.docs,id:n.id,name:this.inflateName(n.name),url:n.url}))}),multipleBaseUrls:r=>$t.Environments.multipleBaseUrls({baseUrls:r.baseUrls.map(n=>({id:n.id,name:this.inflateName(n.name)})),environments:r.environments.map(n=>({docs:n.docs,id:n.id,name:this.inflateName(n.name),urls:n.urls}))}),_other:()=>{throw new N({message:"Unknown environments type",code:N.Code.InternalError})}})}}convertDeclaration({name:t,fernFilepath:r}){return{name:this.inflateName(t),fernFilepath:this.inflateFernFilepath(r)}}convertEndpointLocation({endpoint:t}){return{method:t.method,path:this.getFullPathForEndpoint(t)}}getAllHttpEndpoints(){return Object.values(this.ir.services).flatMap(t=>t.endpoints.map(r=>({...r,servicePathParameters:t.pathParameters,serviceHeaders:t.headers,fernFilepath:t.name.fernFilepath})))}resolveProperties(t){let r=[];for(let n of t){let i=this.resolveObjectTypeOrThrow(n.typeId);r.push(...this.resolveProperties(i.extends)),r.push(...i.properties)}return Object.values(r)}resolveObjectTypeOrThrow(t){let r=this.ir.types[t];if(r==null)throw new N({message:`Internal error; type "${t}" not found`,code:N.Code.InternalError});if(r.shape.type!=="object")throw new N({message:`Internal error; type "${t}" is not an object`,code:N.Code.InternalError});return r.shape}getFullPathForEndpoint(t){let r="";t.fullPath.head.length>0&&(r=(0,hDr.default)(r,t.fullPath.head));for(let n of t.fullPath.parts)r=(0,hDr.default)(r,"{"+n.pathParameter+"}"),n.tail.length>0&&(r=(0,hDr.default)(r,n.tail));return r.startsWith("/")?r:`/${r}`}getGlobalHeaderExampleValues(){let t={};for(let r of this.ir.headers){if(r.valueType.type==="container"&&r.valueType.container.type==="literal"||r.valueType.type==="container"&&r.valueType.container.type==="optional")continue;let n=er(r.name);t[n]=`<${n}>`}return t}getEndpointSnippetRequests({endpoint:t,location:r}){let n=[];for(let i of[...t.userSpecifiedExamples,...t.autogeneratedExamples]){let o=new Set;[...this.ir.pathParameters,...t.pathParameters].forEach(a=>{a.variable!=null&&o.add(Mr(a.name))});let s=[...i.example?.rootPathParameters??[],...i.example?.servicePathParameters??[],...i.example?.endpointPathParameters??[]].filter(a=>!o.has(Mr(a.name)));n.push({id:i?.example?.id??XO(),name:i?.example?.name!=null?Mr(i.example.name):void 0,endpoint:r,baseUrl:void 0,environment:void 0,auth:this.authValues,headers:{...this.getGlobalHeaderExampleValues(),...Object.fromEntries([...i.example?.serviceHeaders??[],...i.example?.endpointHeaders??[]].map(a=>[er(a.name),a.value.jsonExample]))},pathParameters:Object.fromEntries(s.map(a=>[Mr(a.name),a.value.jsonExample])),queryParameters:Object.fromEntries([...i.example?.queryParameters??[]].map(a=>[er(a.name),a.value.jsonExample])),requestBody:i.example?.request?.jsonExample})}return n}};function DNe({ir:e,generationLanguage:t,smartCasing:r,disableExamples:n,generatorConfig:i}){return new gDr({ir:e,generationLanguage:t,smartCasing:r,generatorConfig:i}).convert({disableExamples:n})}var ZO={};ne(ZO,{validateObjectExample:()=>PNe,validateTypeExample:()=>aDr,validateTypeReferenceExample:()=>t_});jt();XA();function U$a(e){return{errorInstanceIdKey:e.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}}var ADr=e=>{let t=P6(e.file.fernFilepath),r=e.endpointId;return`endpoint_${t}.${r}`};function yDr({fernFilePath:e}){return e.packagePath.length===0&&e.file==null}function bDr({resolvedEndpoint:e}){return{endpointId:ADr(e),serviceId:Jl.generateServiceIdFromFernFilepath(e.file.fernFilepath),subpackageId:yDr({fernFilePath:e.file.fernFilepath})?void 0:Jl.generateSubpackageId(e.file.fernFilepath)}}function z$a({endpointResolver:e,propertyResolver:t,file:r,refreshTokenEndpoint:n}){let i=e.resolveEndpointOrThrow({endpoint:n.endpoint,file:r}),o;try{o=n.responseProperties.expires_in!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:n.endpoint,propertyComponents:n.responseProperties.expires_in}):void 0}catch{}return{endpointReference:{endpointId:ADr(i),serviceId:Jl.generateServiceIdFromFernFilepath(i.file.fernFilepath),subpackageId:yDr({fernFilePath:i.file.fernFilepath})?void 0:Jl.generateSubpackageId(i.file.fernFilepath)},requestProperties:{refreshToken:t.resolveRequestPropertyOrThrow({file:r,endpoint:n.endpoint,propertyComponents:n.requestProperties.refresh_token})},responseProperties:{accessToken:t.resolveResponsePropertyOrThrow({file:r,endpoint:n.endpoint,propertyComponents:n.responseProperties.access_token}),expiresIn:o,refreshToken:n.responseProperties.refresh_token!=null?t.resolveResponsePropertyOrThrow({file:r,endpoint:n.endpoint,propertyComponents:n.responseProperties.refresh_token}):void 0}}}function V$a({endpointResolver:e,propertyResolver:t,typeResolver:r,file:n,tokenEndpoint:i}){let o=e.resolveEndpointOrThrow({endpoint:i.endpoint,file:n}),s=MOf({endpoint:o.endpoint,file:o.file,typeResolver:r}),a;try{a=i.responseProperties.expires_in!=null?t.resolveResponsePropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.responseProperties.expires_in}):void 0}catch{}return{endpointReference:bDr({resolvedEndpoint:o}),requestProperties:{clientId:t.resolveRequestPropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.requestProperties.client_id}),clientSecret:t.resolveRequestPropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.requestProperties.client_secret}),scopes:i.requestProperties.scopes!=null?t.resolveRequestPropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.requestProperties.scopes}):void 0,customProperties:jOf({requestBodyPropertyNames:s,tokenEndpoint:i,file:n,propertyResolver:t})},responseProperties:{accessToken:t.resolveResponsePropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.responseProperties.access_token}),expiresIn:a,refreshToken:i.responseProperties.refresh_token!=null?t.resolveResponsePropertyOrThrow({file:n,endpoint:i.endpoint,propertyComponents:i.responseProperties.refresh_token}):void 0}}}var jOf=({requestBodyPropertyNames:e,tokenEndpoint:t,file:r,propertyResolver:n})=>{let i=e.filter(o=>!t.requestProperties.client_id.includes(o)&&!t.requestProperties.client_secret.includes(o)&&(t.requestProperties.scopes==null||!t.requestProperties.scopes.includes(o)));return i.length>0?i.map(o=>n.resolveRequestPropertyOrThrow({file:r,endpoint:t.endpoint,propertyComponents:[o]})):void 0};function MOf({endpoint:e,file:t,typeResolver:r}){let n=e.request;if(n==null)return[];if(typeof n=="string")return EDr({typeName:n,file:t,typeResolver:r});let i=n.body;if(i==null)return[];if(typeof i=="string")return EDr({typeName:i,file:t,typeResolver:r});if(gg(i)){let o=Object.keys(i.properties??{});if(i.extends!=null){let s=typeof i.extends=="string"?[i.extends]:i.extends;for(let a of s)o.push(...EDr({typeName:a,file:t,typeResolver:r}))}return o}return EDr({typeName:i.type,file:t,typeResolver:r})}function EDr({typeName:e,file:t,typeResolver:r}){let n=r.resolveType({type:e,file:t});if(n==null||n._type!=="named")return[];let i=n.declaration,o=[];return"properties"in i&&i.properties!=null&&o.push(...Object.keys(i.properties)),"base-properties"in i&&i["base-properties"]!=null&&o.push(...Object.keys(i["base-properties"])),o}function q$a({propertyResolver:e,endpointResolver:t,typeResolver:r,file:n,oauthScheme:i,tokenEndpoint:o,refreshTokenEndpoint:s}){let a=V$a({propertyResolver:e,endpointResolver:t,typeResolver:r,file:n,tokenEndpoint:o});if(a==null)throw new N({message:"Failed to convert OAuth token endpoint.",code:N.Code.IrConversionError});let c=s!=null?z$a({propertyResolver:e,endpointResolver:t,file:n,refreshTokenEndpoint:s}):void 0;return{clientIdEnvVar:i["client-id-env"],clientSecretEnvVar:i["client-secret-env"],tokenPrefix:i["token-prefix"],tokenHeader:i["token-header"],scopes:i.scopes,tokenEndpoint:a,refreshEndpoint:c}}var gkt={requestProperties:{type:"access_token",client_id:["client_id"],client_secret:["client_secret"],scopes:void 0},responseProperties:{type:"access_token",access_token:["access_token"],expires_in:["expires_in"],refresh_token:void 0}},OYi={requestProperties:{type:"refresh_token",refresh_token:["refresh_token"]},responseProperties:{type:"access_token",access_token:["access_token"],refresh_token:void 0,expires_in:["expires_in"]}};function G$a(e){return{endpoint:e["get-token"].endpoint,requestProperties:LOf({requestProperties:e["get-token"]?.["request-properties"]}),responseProperties:UOf({responseProperties:e["get-token"]?.["response-properties"]})}}function W$a(e){if(e["refresh-token"]!=null)return{endpoint:e["refresh-token"].endpoint,requestProperties:zOf({requestProperties:e["refresh-token"]?.["request-properties"]}),responseProperties:VOf({responseProperties:e["refresh-token"]?.["response-properties"]})}}function LOf({requestProperties:e}){if(e==null)return gkt.requestProperties;let t=e["client-id"],r=e["client-secret"],n=e.scopes;return{type:"access_token",client_id:t!=null?B7(t):gkt.requestProperties.client_id,client_secret:r!=null?B7(r):gkt.requestProperties.client_secret,scopes:n!=null?B7(n):gkt.requestProperties.scopes}}function UOf({responseProperties:e}){return $$a({responseProperties:e,defaultValue:gkt.responseProperties})}function zOf({requestProperties:e}){if(e==null)return OYi.requestProperties;let t=e["refresh-token"];return{type:"refresh_token",refresh_token:t!=null?B7(t):OYi.requestProperties.refresh_token}}function VOf({responseProperties:e}){return $$a({responseProperties:e,defaultValue:OYi.responseProperties})}function $$a({responseProperties:e,defaultValue:t}){if(e==null)return t;let r=e["access-token"],n=e["expires-in"],i=e["refresh-token"];return{type:"access_token",access_token:r!=null?NB(r):t.access_token,expires_in:n!=null?NB(n):t.expires_in,refresh_token:i!=null?NB(i):t.refresh_token}}function Y$a({rawApiFileSchema:e,file:t,propertyResolver:r,endpointResolver:n,typeResolver:i}){if(e.auth==null)return{docs:void 0,requirement:Ww.All,schemes:[]};let o=typeof e.auth!="string"?e.auth.docs:void 0;return BDe(e.auth,{single:s=>{let a=PYi({reference:s,authSchemeDeclarations:e["auth-schemes"],file:t,propertyResolver:r,endpointResolver:n,typeResolver:i});return{docs:o,requirement:Ww.All,schemes:[a]}},any:({any:s})=>({docs:o,requirement:Ww.Any,schemes:s.map(a=>PYi({reference:a,authSchemeDeclarations:e["auth-schemes"],file:t,propertyResolver:r,endpointResolver:n,typeResolver:i}))}),endpointSecurity:()=>({docs:o,requirement:Ww.EndpointSecurity,schemes:Object.keys(e["auth-schemes"]??{}).map(s=>PYi({reference:s,authSchemeDeclarations:e["auth-schemes"],file:t,propertyResolver:r,endpointResolver:n,typeResolver:i}))})})}function PYi({reference:e,authSchemeDeclarations:t,file:r,propertyResolver:n,endpointResolver:i,typeResolver:o}){let s=(c,u)=>{let l=t?.[c];if(l==null)throw new N({message:"Unknown auth scheme: "+c,code:N.Code.ReferenceError});return TDe(l,{header:p=>Gp.header({key:c,docs:u,name:r.casingsGenerator.generateNameAndWireValue({name:p.name??c,wireValue:p.header}),valueType:r.parseTypeReference(p.type??"string"),prefix:p.prefix,headerEnvVar:p.env,headerPlaceholder:p.placeholder}),basic:p=>K$a({key:c,file:r,docs:u,rawScheme:p}),tokenBearer:p=>H$a({key:c,file:r,docs:u,rawScheme:p}),inferredBearer:p=>qOf({key:c,file:r,docs:u,rawScheme:p,propertyResolver:n,endpointResolver:i}),oauth:p=>J$a({key:c,file:r,docs:u,rawScheme:p,propertyResolver:n,endpointResolver:i,typeResolver:o})})},a=typeof e=="string"?e:e.scheme;switch(a){case"bearer":return H$a({key:a,file:r,docs:void 0,rawScheme:void 0});case"basic":return K$a({key:a,file:r,docs:void 0,rawScheme:void 0});case"oauth":return J$a({key:a,file:r,docs:void 0,rawScheme:void 0,propertyResolver:n,endpointResolver:i,typeResolver:o});default:return s(a,typeof e!="string"?e.docs:void 0)}}function H$a({key:e,file:t,docs:r,rawScheme:n}){return Gp.bearer({key:e,docs:r,token:t.casingsGenerator.generateName(n?.token?.name??"token"),tokenEnvVar:n?.token?.env,tokenPlaceholder:n?.token?.placeholder})}function K$a({key:e,file:t,docs:r,rawScheme:n}){return Gp.basic({key:e,docs:r,username:t.casingsGenerator.generateName(n?.username?.name??"username"),usernameEnvVar:n?.username?.env,usernameOmit:n?.username?.omit,usernamePlaceholder:n?.username?.placeholder,password:t.casingsGenerator.generateName(n?.password?.name??"password"),passwordEnvVar:n?.password?.env,passwordOmit:n?.password?.omit,passwordPlaceholder:n?.password?.placeholder})}function J$a({key:e,file:t,docs:r,rawScheme:n,propertyResolver:i,endpointResolver:o,typeResolver:s}){if(n?.type==="client-credentials")return Gp.oauth({key:e,docs:r,configuration:lH.clientCredentials(q$a({propertyResolver:i,endpointResolver:o,typeResolver:s,file:t,oauthScheme:n,tokenEndpoint:G$a(n),refreshTokenEndpoint:W$a(n)}))});throw new N({message:`Unknown OAuth type: '${n?.type}'`,code:N.Code.ValidationError})}function qOf({key:e,file:t,docs:r,rawScheme:n,propertyResolver:i,endpointResolver:o}){return Gp.inferred({key:e,docs:r,tokenEndpoint:GOf({file:t,rawScheme:n,propertyResolver:i,endpointResolver:o})})}function GOf({file:e,rawScheme:t,propertyResolver:r,endpointResolver:n}){let i=t["get-token"],o=typeof i=="string"?{endpoint:i}:i,s=n.resolveEndpointOrThrow({endpoint:o.endpoint,file:e});return{endpoint:bDr({resolvedEndpoint:s}),expiryProperty:JOf({tokenEndpoint:s,getTokenEndpointConfig:o,propertyResolver:r}),authenticatedRequestHeaders:$Of({tokenEndpoint:s,getTokenEndpointConfig:o,propertyResolver:r})}}var WOf=["access_token","accessToken","AccessToken","token","Token","auth_token","authToken","AuthToken","bearer_token","bearerToken","BearerToken","jwt","Jwt","authentication_token","authenticationToken","AuthenticationToken"];function $Of({tokenEndpoint:e,getTokenEndpointConfig:t,propertyResolver:r}){let n=new Map,i=t["authenticated-request-headers"]??[];if(i.length>0&&i.forEach(o=>{n.set(o["header-name"].toLowerCase(),{headerName:o["header-name"],responseProperty:r.resolveResponsePropertyOrThrow({file:e.file,endpoint:e.endpointId,propertyComponents:NB(o["response-property"])}),valuePrefix:o["value-prefix"]})}),!n.has("authorization")){let o=HOf({tokenEndpoint:e,propertyResolver:r});o&&n.set("authorization",{headerName:"Authorization",responseProperty:o,valuePrefix:"Bearer "})}return Array.from(n.values())}function HOf({tokenEndpoint:e,propertyResolver:t}){for(let r of WOf)try{let n=t.resolveResponseProperty({file:e.file,endpoint:e.endpointId,propertyComponents:[r]});if(n)return n}catch{}}var KOf=["expires_in","expiresIn","ExpiresIn","exp","Exp","expiry","Expiry","expires","Expires","expires_at","expiresAt","ExpiresAt","expiration","Expiration","valid_until","validUntil","ValidUntil"];function JOf({tokenEndpoint:e,getTokenEndpointConfig:t,propertyResolver:r}){if(t["expiry-response-property"])return r.resolveResponsePropertyOrThrow({file:e.file,endpoint:e.endpointId,propertyComponents:NB(t["expiry-response-property"])});for(let n of KOf)try{let i=r.resolveResponseProperty({file:e.file,endpoint:e.endpointId,propertyComponents:[n]});if(i)return i}catch{}}function X$a({file:e,rawApiFileSchema:t}){if(t.version!=null)return Fhe.header({header:YOf({file:e,header:t.version.header}),value:XOf({file:e,versionDeclaration:t.version})})}function YOf({file:e,header:t}){return typeof t=="string"?PU({file:e,headerKey:t,header:{type:"string"}}):PU({file:e,headerKey:t.value,header:{type:"string",name:t.name,env:t.env}})}function XOf({file:e,versionDeclaration:t}){return cDr({_enum:{default:t.default,enum:t.values},file:e})}jt();function Z$a({channel:e,typeResolver:t,exampleResolver:r,variableResolver:n,file:i,workspace:o}){let s=[];for(let[a,c]of Object.entries(e.messages??{}))s.push({type:a,availability:_N(c.availability),docs:c.docs,origin:c.origin,body:tPf({body:c.body,file:i}),displayName:c["display-name"],methodName:c["method-name"]});return{availability:_N(e.availability),path:ub(e.path),baseUrl:e.url,auth:e.auth,name:i.fernFilepath.file??i.casingsGenerator.generateName(e["display-name"]??e.path),displayName:e["display-name"],connectMethodName:e["connect-method-name"],headers:e.headers!=null?Object.entries(e.headers).map(([a,c])=>PU({headerKey:a,header:c,file:i})):[],docs:e.docs,pathParameters:e["path-parameters"]!=null?YYe({pathParameters:e["path-parameters"],location:Zt.PathParameterLocation.Endpoint,file:i,variableResolver:n}):[],queryParameters:e["query-parameters"]!=null?Object.entries(e["query-parameters"]).map(([a,c])=>{let{name:u}=bue({queryParameterKey:a,queryParameter:c}),l=i.parseTypeReference(c);return{...e_(c),name:i.casingsGenerator.generateNameAndWireValue({wireValue:a,name:u}),valueType:l,allowMultiple:typeof c!="string"&&c["allow-multiple"]!=null?c["allow-multiple"]:!1,clientDefault:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}},explode:void 0}}):[],messages:Object.values(s),examples:(e.examples??[]).map(a=>{let c=nPf({channel:e,example:a,typeResolver:t,exampleResolver:r,variableResolver:n,file:i,workspace:o});return{name:a.name!=null?i.casingsGenerator.generateName(a.name):void 0,docs:a.docs,url:oPf({channel:e,example:a,pathParams:c}),...c,...iPf({channel:e,example:a,typeResolver:t,exampleResolver:r,file:i,workspace:o}),queryParameters:a["query-parameters"]!=null?Object.entries(a["query-parameters"]).map(([u,l])=>{let p=e["query-parameters"]?.[u];if(p==null)throw new N({message:`Query parameter ${u} does not exist`,code:N.Code.ReferenceError});return{name:i.casingsGenerator.generateNameAndWireValue({name:bue({queryParameterKey:u,queryParameter:p}).name,wireValue:u}),value:vf({example:l,rawTypeBeingExemplified:typeof p=="string"?p:p.type,typeResolver:t,exampleResolver:r,fileContainingRawTypeReference:i,fileContainingExample:i,workspace:o}),shape:ZOf({queryParameter:p})}}):[],messages:a.messages.map(u=>{let l=e.messages?.[u.type];if(l==null)throw new N({message:`Message ${u.type} does not exist`,code:N.Code.ReferenceError});return{type:u.type,body:ePf({message:l,example:u.body,typeResolver:t,exampleResolver:r,file:i,workspace:o})}})}}),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}}}function ZOf({queryParameter:e}){return(typeof e!="string"&&e["allow-multiple"]!=null?e["allow-multiple"]:!1)?$w.exploded():$w.single()}function ePf({message:e,example:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){if(!sPf(e.body))return i6.reference(vf({example:t,rawTypeBeingExemplified:typeof e.body!="string"?e.body.type:e.body,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:i,fileContainingExample:i,workspace:o}));if(!Lo(t))throw new N({message:"Example must be an object",code:N.Code.ValidationError});let s=[];for(let[a,c]of Object.entries(t)){let u=e.body.properties?.[a];if(u!=null)s.push({name:i.casingsGenerator.generateNameAndWireValue({name:qC({propertyKey:a,property:u}).name,wireValue:a}),value:vf({example:c,rawTypeBeingExemplified:typeof u!="string"?u.type:u,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:i,fileContainingExample:i,workspace:o}),originalTypeDeclaration:void 0});else{let l=mkt({extends_:e.body.extends,wirePropertyKey:a,typeResolver:r,file:i});if(l==null)throw new N({message:"Could not find original type declaration for property: "+a,code:N.Code.ResolutionError});s.push({name:i.casingsGenerator.generateNameAndWireValue({name:qC({propertyKey:a,property:l.rawPropertyType}).name,wireValue:a}),value:vf({example:c,rawTypeBeingExemplified:typeof l.rawPropertyType=="string"?l.rawPropertyType:l.rawPropertyType.type,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:l.file,fileContainingExample:i,workspace:o}),originalTypeDeclaration:l.typeName})}}return i6.inlinedBody({jsonExample:n.resolveAllReferencesInExampleOrThrow({example:t,file:i}).resolvedExample,properties:s,extraProperties:void 0})}function tPf({body:e,file:t}){return typeof e=="string"||rPf(e)?eB.reference({docs:void 0,bodyType:t.parseTypeReference(e)}):eB.inlinedBody({name:t.casingsGenerator.generateName(e.name),extends:_7(e.extends??[]).map(r=>ZS({typeName:r,file:t})),properties:Object.entries(e.properties??{}).map(([r,n])=>({name:t.casingsGenerator.generateNameAndWireValue({name:qC({propertyKey:r,property:n}).name,wireValue:r}),value:t.parseTypeReference(n),valueType:t.parseTypeReference(n),availability:void 0,docs:void 0}))})}function rPf(e){return e.type!=null}function nPf({channel:e,example:t,typeResolver:r,exampleResolver:n,variableResolver:i,file:o,workspace:s}){let a=[],c=({name:u,pathParameterDeclaration:l,examplePathParameter:p})=>{let d=hkt({parameter:l,variableResolver:i,file:o});return{name:u,value:vf({example:p,rawTypeBeingExemplified:d.rawType,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:d.file,fileContainingExample:o,workspace:s})}};if(t["path-parameters"]!=null){let u=T7(e);for(let[l,p]of Object.entries(t["path-parameters"])){let d=u[l];if(d!=null)a.push(c({name:o.casingsGenerator.generateName(l),pathParameterDeclaration:d,examplePathParameter:p}));else throw new N({message:`Path parameter ${l} does not exist`,code:N.Code.ReferenceError})}}return{pathParameters:a}}function iPf({channel:e,example:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){let s=[];if(t.headers!=null)for(let[a,c]of Object.entries(t.headers)){let u=e.headers?.[a];u!=null&&s.push({name:i.casingsGenerator.generateNameAndWireValue({name:kY({headerKey:a,header:u}).name,wireValue:a}),value:vf({example:c,rawTypeBeingExemplified:typeof u=="string"?u:u.type,typeResolver:r,exampleResolver:n,fileContainingRawTypeReference:i,fileContainingExample:i,workspace:o})})}return{headers:s}}function oPf({channel:e,example:t,pathParams:r}){let n=e.path;if(t["path-parameters"]!=null)for(let i of[...r.pathParameters])n=n.replaceAll(`{${Mr(i.name)}}`,encodeURIComponent(`${i.value.jsonExample}`));return n}function sPf(e){return typeof e=="string"?!1:e.extends!=null||e.properties!=null}function eHa({errorName:e,errorDeclaration:t,file:r,typeResolver:n,exampleResolver:i,workspace:o}){let s=[];if(t.type!=null&&t.examples!=null)for(let a of t.examples)s.push({name:a.name!=null?r.casingsGenerator.generateName(a.name):void 0,docs:a.docs,jsonExample:i.resolveAllReferencesInExampleOrThrow({example:a.value,file:r}).resolvedExample,shape:vf({example:a.value,rawTypeBeingExemplified:t.type,fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:n,exampleResolver:i,workspace:o})});return{name:K0e({errorName:e,file:r}),discriminantValue:r.casingsGenerator.generateNameAndWireValue({wireValue:e,name:e}),docs:typeof t!="string"?t.docs:void 0,statusCode:t["status-code"],isWildcardStatusCode:void 0,type:t.type!=null?r.parseTypeReference(t.type):void 0,examples:s,v2Examples:void 0,displayName:void 0,headers:[]}}jt();var tHa="content";function rHa(e,t){if(e==null||e.strategy==="status-code")return n6.statusCode();if(e.strategy==="property")return n6.property({discriminant:t.casingsGenerator.generateNameAndWireValue({name:e["property-name"],wireValue:e["property-name"]}),contentProperty:t.casingsGenerator.generateNameAndWireValue({name:tHa,wireValue:tHa})});Ce(e)}var IDr=we(Sm(),1);function nHa({readme:e,services:t}){let r=new DYi(t);return{apiName:e.apiName,disabledFeatures:e.disabledSections?.map(n=>n.toUpperCase()),apiReferenceLink:e.apiReferenceLink,bannerLink:e.bannerLink,introduction:e.introduction,customSections:e.customSections,exampleStyle:e.exampleStyle,whiteLabel:!1,defaultEndpoint:e.defaultEndpoint!=null?r.getEndpointForReadmeOrThrow(e.defaultEndpoint).id:void 0,features:e.features!=null?Object.fromEntries(Object.entries(e.features).map(([n,i])=>[n,i.map(o=>r.getEndpointForReadmeOrThrow(o).id)])):void 0}}var DYi=class{endpoints={};constructor(t){this.endpoints=this.buildEndpoints(t)}getEndpointForReadme(t){let r=cPf({endpoint:t}),n=this.getEndpointKeyForReadmeEndpoint(r);return this.endpoints[n]}getEndpointForReadmeOrThrow(t){let r=this.getEndpointForReadme(t);if(r==null)throw new N({message:`Endpoint not found for ${JSON.stringify(t)}`,code:N.Code.ResolutionError});return r}buildEndpoints(t){let r={};for(let n of Object.values(t))for(let i of n.endpoints)r[this.getEndpointKeyForHttpEndpoint(i)]=i;return r}getEndpointKeyForReadmeEndpoint(t){return this.getEndpointKey({method:t.method,path:t.path,stream:t.stream??!1})}getEndpointKeyForHttpEndpoint(t){return this.getEndpointKey({method:t.method,path:aPf(t),stream:t.response?.body?.type==="streaming"})}getEndpointKey({method:t,path:r,stream:n}){return`${t}|${r}|${n}`}};function aPf(e){let t="";e.fullPath.head.length>0&&(t=(0,IDr.default)(t,e.fullPath.head));for(let r of e.fullPath.parts)t=(0,IDr.default)(t,"{"+r.pathParameter+"}"),r.tail.length>0&&(t=(0,IDr.default)(t,r.tail));return t.startsWith("/")?t:`/${t}`}function cPf({endpoint:e}){if(typeof e=="string"){let t=e.split(" ");if(t.length!==2||t[0]==null||t[1]==null)throw new N({message:`invalid endpoint string: ${e}`,code:N.Code.ParseError});return{method:t[0],path:t[1]}}return e}jt();function iHa({webhooks:e,file:t,typeResolver:r,exampleResolver:n,workspace:i,defaultSignature:o}){let s=[];for(let[a,c]of Object.entries(e))s.push({id:Jl.generateWebhookId(t.fernFilepath,a),availability:_N(c.availability),displayName:c["display-name"],docs:c.docs,method:c.method,name:t.casingsGenerator.generateName(a),headers:c.headers!=null?Object.entries(c.headers).map(([u,l])=>PU({headerKey:u,header:l,file:t})):[],payload:uPf({payload:c.payload,file:t}),signatureVerification:gPf({signature:c.signature??o,file:t}),fileUploadPayload:void 0,responses:fPf({webhook:c,file:t,typeResolver:r}),examples:c.examples!=null?pPf({webhook:c,examples:c.examples,file:t,typeResolver:r,exampleResolver:n,workspace:i}):void 0,v2Examples:void 0});return s}function uPf({payload:e,file:t}){return typeof e=="string"?hS.reference({docs:void 0,payloadType:t.parseTypeReference(e)}):qYe(e)?hS.reference({docs:void 0,payloadType:t.parseTypeReference(e.type)}):hS.inlinedPayload({name:t.casingsGenerator.generateName(e.name),extends:_7(e.extends).map(r=>ZS({typeName:r,file:t})),properties:e.properties!=null?Object.entries(e.properties).map(([r,n])=>lPf({propertyKey:r,propertyDefinition:n,docs:typeof n!="string"?n.docs:void 0,availability:typeof n!="string"?_N(n.availability):void 0,file:t})):[]})}function lPf({propertyKey:e,propertyDefinition:t,docs:r,availability:n,file:i}){return{docs:r,availability:n,name:i.casingsGenerator.generateNameAndWireValue({wireValue:e,name:qC({propertyKey:e,property:t}).name}),valueType:i.parseTypeReference(t)}}function pPf({webhook:e,examples:t,file:r,typeResolver:n,exampleResolver:i,workspace:o}){let s=typeof e.payload=="string"?e.payload:qYe(e.payload)?e.payload.type:void 0;if(s!=null)return t.map(a=>({docs:e.docs,name:a.name!=null?r.casingsGenerator.generateName(a.name):void 0,payload:vf({example:a.payload,rawTypeBeingExemplified:s,fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:n,exampleResolver:i,workspace:o})}));if(!Lo(e.payload))throw new N({message:`Example webhook payload is not an object. Got: ${JSON.stringify(e.payload)}`,code:N.Code.ValidationError});return t.map(a=>({docs:e.docs,name:a.name!=null?r.casingsGenerator.generateName(a.name):void 0,payload:vf({example:a.payload,rawTypeBeingExemplified:"map<string, unknown>",fileContainingRawTypeReference:r,fileContainingExample:r,typeResolver:n,exampleResolver:i,workspace:o})}))}function fPf({webhook:e,file:t,typeResolver:r}){let n=[];if(e.response!=null){let i=dPf({response:e.response,file:t,typeResolver:r}),o=typeof e.response!="string"?e.response["status-code"]:void 0,s=typeof e.response!="string"?e.response.docs:void 0;n.push({body:i,statusCode:o,isWildcardStatusCode:void 0,docs:s})}if(e["response-stream"]!=null){let i=mPf({responseStream:e["response-stream"],file:t,typeResolver:r});if(i!=null){let o=typeof e["response-stream"]!="string"?e["response-stream"].docs:void 0;n.push({body:Iu.streaming(i),statusCode:void 0,isWildcardStatusCode:void 0,docs:o})}}return n.length>0?n:void 0}function dPf({response:e,file:t,typeResolver:r}){let n=typeof e!="string"?e.docs:void 0,i=typeof e=="string"?e:e.type;if(i!=null)return Qk(i)!=null?Iu.fileDownload({docs:n,v2Examples:void 0}):SDe(i)!=null?Iu.text({docs:n,v2Examples:void 0}):I3(i)!=null?Iu.bytes({docs:n,v2Examples:void 0}):hPf(e,n,t,r)}function mPf({responseStream:e,file:t,typeResolver:r}){let n=typeof e!="string"?e.docs:void 0,i=typeof e=="string"?e:e.type,o=typeof e=="string"?"json":e.format??"json";return Phe(i)?tI.text({docs:n,v2Examples:void 0}):typeof e!="string"&&o==="sse"?tI.sse({docs:n,payload:t.parseTypeReference(i),terminator:typeof e!="string"?e.terminator:void 0,v2Examples:void 0}):tI.json({docs:n,payload:t.parseTypeReference(i),terminator:typeof e!="string"?e.terminator:void 0,v2Examples:void 0})}function hPf(e,t,r,n){let i=typeof e!="string"?e.type:e;if(i==null)return;let o=r.parseTypeReference(typeof e=="string"?e:{...e,type:i}),s=n.resolveTypeOrThrow({type:i,file:r}),a=typeof e!="string"?e.property:void 0;return a!=null?Iu.json(Yb.nestedPropertyAsResponse({docs:t,responseBodyType:o,responseProperty:ONe({typeResolver:n,file:r,resolvedType:s,property:a}),v2Examples:void 0})):Iu.json(Yb.response({docs:t,responseBodyType:o,v2Examples:void 0}))}function gPf({signature:e,file:t}){if(e!=null)switch(e.type){case"hmac":return IG.hmac(APf({hmac:e,file:t}));case"asymmetric":return IG.asymmetric(yPf({asymmetric:e,file:t}));default:return}}function APf({hmac:e,file:t}){return{signatureHeaderName:t.casingsGenerator.generateNameAndWireValue({wireValue:e.header,name:e.header}),algorithm:bPf(e.algorithm),encoding:oHa(e.encoding),signaturePrefix:e["signature-prefix"],payloadFormat:vPf(e["payload-format"]),timestamp:sHa({timestamp:e.timestamp,file:t})}}function yPf({asymmetric:e,file:t}){return{signatureHeaderName:t.casingsGenerator.generateNameAndWireValue({wireValue:e.header,name:e.header}),algorithm:EPf(e["asymmetric-algorithm"]),encoding:oHa(e.encoding),signaturePrefix:e["signature-prefix"],keySource:IPf({asymmetric:e,file:t}),timestamp:sHa({timestamp:e.timestamp,file:t})}}function bPf(e){switch(e){case"sha1":return EG.Sha1;case"sha384":return EG.Sha384;case"sha512":return EG.Sha512;case"sha256":case void 0:return EG.Sha256}}function oHa(e){switch(e){case"hex":return bDe.Hex;case"base64":case void 0:return bDe.Base64}}function EPf(e){switch(e){case"rsa-sha256":return Z1.RsaSha256;case"rsa-sha384":return Z1.RsaSha384;case"rsa-sha512":return Z1.RsaSha512;case"ecdsa-sha256":return Z1.EcdsaSha256;case"ecdsa-sha384":return Z1.EcdsaSha384;case"ecdsa-sha512":return Z1.EcdsaSha512;case"ed25519":return Z1.Ed25519}}function IPf({asymmetric:e,file:t}){return e["jwks-url"]!=null?bG.jwks({url:e["jwks-url"],keyIdHeader:e["key-id-header"]!=null?t.casingsGenerator.generateNameAndWireValue({wireValue:e["key-id-header"],name:e["key-id-header"]}):void 0}):bG.static({})}function vPf(e){return e==null?{components:[h3.Body],delimiter:"",bodySort:void 0}:{components:e.components.map(wPf),delimiter:e.delimiter??"",bodySort:CPf(e["body-sort"])}}function CPf(e){switch(e){case"alphabetical":return O_t.Alphabetical;case void 0:return}}function wPf(e){switch(e){case"body":return h3.Body;case"timestamp":return h3.Timestamp;case"notification-url":return h3.NotificationUrl;case"message-id":return h3.MessageId}}function sHa({timestamp:e,file:t}){if(e!=null)return{headerName:t.casingsGenerator.generateNameAndWireValue({wireValue:e.header,name:e.header}),format:xPf(e.format),tolerance:e.tolerance}}function xPf(e){switch(e){case"unix-millis":return Qse.UnixMillis;case"iso8601":return Qse.Iso8601;case"unix-seconds":case void 0:return Qse.UnixSeconds}}function aHa({name:e,source:t}){return Bp.userDefined({file:fDr({source:t}),name:fkt.generateName(e)})}function cHa({encoding:e}){if(e.proto!=null&&e.proto.type!=null){let t=SPf({type:e.proto.type});if(t!=null)return t}}function SPf({type:e}){switch(e){case"google.protobuf.Any":return Bp.wellKnown(mi.any());case"google.protobuf.Api":return Bp.wellKnown(mi.api());case"google.protobuf.BoolValue":return Bp.wellKnown(mi.boolValue());case"google.protobuf.BytesValue":return Bp.wellKnown(mi.bytesValue());case"google.protobuf.DoubleValue":return Bp.wellKnown(mi.doubleValue());case"google.protobuf.Duration":return Bp.wellKnown(mi.duration());case"google.protobuf.Empty":return Bp.wellKnown(mi.empty());case"google.protobuf.Enum":return Bp.wellKnown(mi.enum());case"google.protobuf.EnumValue":return Bp.wellKnown(mi.enumValue());case"google.protobuf.Field":return Bp.wellKnown(mi.field());case"google.protobuf.FieldCardinality":return Bp.wellKnown(mi.fieldCardinality());case"google.protobuf.FieldKind":return Bp.wellKnown(mi.fieldKind());case"google.protobuf.FieldMask":return Bp.wellKnown(mi.fieldMask());case"google.protobuf.FloatVlaue":return Bp.wellKnown(mi.floatValue());case"google.protobuf.Int32Value":return Bp.wellKnown(mi.int32Value());case"google.protobuf.Int64Value":return Bp.wellKnown(mi.int64Value());case"google.protobuf.ListValue":return Bp.wellKnown(mi.listValue());case"google.protobuf.Method":return Bp.wellKnown(mi.method());case"google.protobuf.Mixin":return Bp.wellKnown(mi.mixin());case"google.protobuf.NullValue":return Bp.wellKnown(mi.nullValue());case"google.protobuf.Option":return Bp.wellKnown(mi.option());case"google.protobuf.SourceContext":return Bp.wellKnown(mi.sourceContext());case"google.protobuf.StringValue":return Bp.wellKnown(mi.stringValue());case"google.protobuf.Struct":return Bp.wellKnown(mi.struct());case"google.protobuf.Syntax":return Bp.wellKnown(mi.syntax());case"google.protobuf.Timestamp":return Bp.wellKnown(mi.timestamp());case"google.protobuf.Type":return Bp.wellKnown(mi.type());case"google.protobuf.Uint32Value":return Bp.wellKnown(mi.uint32Value());case"google.protobuf.Uint64Value":return Bp.wellKnown(mi.uint64Value());case"google.protobuf.Value":return Bp.wellKnown(mi.value())}}jt();function _Pf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function XYe(e,t,r){if(t.length===0)return e;let n=new Map;for(let o=0;o<t.length;o++){let s=t[o],a=r[o];s!=null&&a!=null&&n.set(s,a)}if(n.size===0)return e;let i=Array.from(n.keys()).map(o=>`\\b${_Pf(o)}\\b`).join("|");return e.replace(new RegExp(i,"g"),o=>n.get(o)??o)}function uHa({generic:e,file:t,typeResolver:r}){let n=typeof e=="string"?e:e.type,i=Jb(n);if(i==null)throw new N({message:`Invalid generic type definition: ${n}`,code:N.Code.ValidationError});let o=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:n,file:t});if(i.arguments&&sf(o.declaration)){let s=Jb(o.typeName)?.arguments??[],a=Object.entries(o.declaration.properties??{}).map(([u,l])=>{let p=l;return typeof l=="string"?p=XYe(l,s,i.arguments):typeof l=="object"&&l!=null&&"type"in l&&(p={...l,type:XYe(l.type,s,i.arguments)}),[u,p]}),c=_7(o.declaration.extends).map(u=>{let l=XYe(u,s,i.arguments);return ZS({typeName:l,file:t})});return Cc.object({extends:c,properties:ckt({properties:Object.fromEntries(a)},t),extraProperties:o.declaration["extra-properties"]??!1,extendedProperties:void 0})}throw new N({message:`Generic type definition not supported: ${n}`,code:N.Code.ValidationError})}function lHa({alias:e,file:t,typeResolver:r}){let n=typeof e=="string"?e:e.type;return p3(n)?uHa({generic:n,file:t,typeResolver:r}):Cc.alias({aliasOf:t.parseTypeReference(e),resolvedType:BPf({aliasOf:n,file:t,typeResolver:r})})}function BPf({aliasOf:e,file:t,typeResolver:r}){let n=r.resolveTypeOrThrow({type:e,file:t});switch(n._type){case"primitive":return X1.primitive(n.originalTypeReference.primitive);case"container":return X1.container(n.originalTypeReference.container);case"unknown":return X1.unknown();case"named":{let i=sf(n.declaration)?yG.Object:v3(n.declaration)?yG.Union:wG(n.declaration)?yG.Enum:QGe(n.declaration)?yG.UndiscriminatedUnion:Ce(n.declaration);return X1.named({name:n.name,shape:i})}}}jt();function pHa({union:e,file:t}){let r=e.union.filter((n,i)=>{let o=typeof n=="string"?n:n.type;return e.union.findIndex(s=>(typeof s=="string"?s:s.type)===o)===i});return Cc.undiscriminatedUnion({baseProperties:e["base-properties"]!=null?Object.entries(e["base-properties"]).map(([n,i])=>({...e_(i),name:t.casingsGenerator.generateNameAndWireValue({wireValue:n,name:qC({propertyKey:n,property:i}).name}),valueType:t.parseTypeReference(i),propertyAccess:H0e({property:i}),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}}})):void 0,members:r.map(n=>{let i=t.parseTypeReference(typeof n=="string"?n:n.type);return{type:i.type==="named"?{...i,displayName:typeof n=="string"?_k(Mr(i.name)):n["display-name"]??_k(Mr(i.name))}:i,docs:typeof n=="string"?void 0:n.docs}})})}function fHa(e){let t=[];if(e.extends!=null){let r=typeof e.extends=="string"?[e.extends]:e.extends;t.push(...r)}return e.properties!=null&&t.push(...Object.values(e.properties).map(r=>typeof r=="string"?r:r.type)),t}function FYi({typeDeclaration:e,file:t,typeResolver:r,seenTypeNames:n=new RYi}){let i=nv(e,{alias:s=>{let a=typeof s=="string"?s:s.type,c=Jb(a);if(c!=null){let u=new Set(c.arguments??[]),l=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:a,file:t}),p=Jb(l.typeName)?.arguments;if(sf(l.declaration)){let d=fHa(l.declaration);p&&d.filter(f=>!p.includes(f)).map(f=>XYe(f,p,c.arguments)).forEach(f=>u.add(f))}return Array.from(u)}return[a]},object:s=>fHa(s),discriminatedUnion:s=>{let a=[];return s["base-properties"]!=null&&a.push(...Object.values(s["base-properties"]).map(c=>typeof c=="string"?c:c.type)),a.push(...Object.values(s.union).reduce((c,u)=>{let l=typeof u=="string"?u:u.type;return typeof l=="string"&&c.push(l),c},[])),a},undiscriminatedUnion:s=>{let a=[];return s["base-properties"]!=null&&a.push(...Object.values(s["base-properties"]).map(c=>typeof c=="string"?c:c.type)),a.push(...Object.values(s.union).reduce((c,u)=>{let l=typeof u=="string"?u:u.type;return typeof l=="string"&&c.push(l),c},[])),a},enum:()=>[]}),o=[];for(let s of i){let a=rv({type:s,_default:void 0,validation:void 0,visitor:{primitive:()=>[],map:({keyType:c,valueType:u})=>[...c,...u],list:c=>c,optional:c=>c,nullable:c=>c,set:c=>c,named:c=>[c],literal:()=>[],unknown:()=>[]}});for(let c of a){let u=ZS({typeName:c,file:t});if(!n.hasTypeNameBeenSeen(u)){n.addTypeName(u),o.push(u);let l=r.getDeclarationOfNamedTypeOrThrow({referenceToNamedType:c,file:t});if(p3(l.typeName))continue;o.push(...FYi({typeDeclaration:l.declaration,file:l.file,typeResolver:r,seenTypeNames:n}))}}}return o}var RYi=class{cache=new Set;addTypeName(t){this.cache.add(this.computeCacheKey(t))}hasTypeNameBeenSeen(t){return this.cache.has(this.computeCacheKey(t))}computeCacheKey(t){return t.fernFilepath.allParts.map(r=>Mr(r)).join("/")+":"+Mr(t.name)}};function dHa({typeName:e,typeDeclaration:t,file:r,typeResolver:n,exampleResolver:i,sourceResolver:o,workspace:s}){let a=e_(t),c=ZS({typeName:e,file:r}),u=FYi({typeDeclaration:t,file:r,typeResolver:n}),l={};sf(t)&&(l=_Ne(t.properties??{}));let p=OPf({file:r,typeDeclaration:t,typeName:e,sourceResolver:o});return{propertiesByAudience:l,typeDeclaration:{...a,inline:FPf(t),name:c,shape:TPf({typeDeclaration:t,file:r,typeResolver:n}),referencedTypes:new Set(u.map(d=>d.typeId)),encoding:PPf({typeDeclaration:t,source:p}),source:p,userProvidedExamples:typeof t!="string"&&t.examples!=null?t.examples.map(d=>({name:d.name!=null?r.casingsGenerator.generateName(d.name):void 0,docs:d.docs,jsonExample:i.resolveAllReferencesInExampleOrThrow({example:d.value,file:r}).resolvedExample,shape:SYi({typeName:c,example:d.value,typeResolver:n,exampleResolver:i,typeDeclaration:t,fileContainingType:r,fileContainingExample:r,workspace:s})})):[],autogeneratedExamples:[],v2Examples:void 0},descendantFilepaths:new Set(u.map(d=>d.fernFilepath))}}function TPf({typeDeclaration:e,file:t,typeResolver:r}){return nv(e,{alias:n=>lHa({alias:n,file:t,typeResolver:r}),object:n=>zWa({object:n,file:t}),discriminatedUnion:n=>e$a({union:n,file:t,typeResolver:r}),undiscriminatedUnion:n=>pHa({union:n,file:t}),enum:n=>Cc.enum(cDr({_enum:n,file:t}))})}function OPf({file:e,typeDeclaration:t,typeName:r,sourceResolver:n}){if(typeof t=="string"||t.source==null&&t.encoding==null)return;if(t.encoding!=null){let o=cHa({encoding:t.encoding});if(o!=null)return kse.proto(o)}if(t.source==null)return;let i=n.resolveSourceOrThrow({source:t.source,relativeFilepath:e.relativeFilepath});if(!(i==null||i.type!=="protobuf"))return kse.proto(aHa({source:i,name:r}))}function PPf({typeDeclaration:e,source:t}){return typeof e!="string"&&e.encoding!=null?DPf(e.encoding):RPf(t)}function DPf(e){return e.proto!=null?{json:void 0,proto:{}}:{json:{},proto:void 0}}function RPf(e){return e!=null&&e.type==="proto"?{json:void 0,proto:{}}:{json:{},proto:void 0}}function FPf(e){if(typeof e!="string"&&"inline"in e)return e.inline}function mHa(e,t){let r=t[e];if(r==null)throw N.internalError(`Failed to load type declaration for type ${e}`);return r}function hHa(e){e.types=Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,NPf({typeDeclaration:r,ir:e})])),e.services=Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(n=>kPf({endpoint:n,ir:e}))}]))}function kPf({endpoint:e,ir:t}){return e.requestBody?.type!=="inlinedRequestBody"?e:{...e,requestBody:{...e.requestBody,extendedProperties:e.requestBody.extends.flatMap(r=>gHa(r,t))}}}function NPf({typeDeclaration:e,ir:t}){return e.shape.type==="object"?{...e,shape:{...e.shape,extendedProperties:e.shape.extends.flatMap(r=>gHa(r,t))}}:e}function gHa(e,t){let r=kYi(e.typeId,t);return AHa({objectTypeDeclaration:r,ir:t})}function kYi(e,t){let r=mHa(e,t.types);switch(r.shape.type){case"object":return r.shape;case"alias":if(r.shape.resolvedType.type==="named")return kYi(r.shape.resolvedType.name.typeId,t)}throw N.internalError(`Unexpected error: ${e} is extended but has shape ${r.shape.type}`)}function AHa({objectTypeDeclaration:e,ir:t}){let r=e.extends.flatMap(n=>{let i=kYi(n.typeId,t);return AHa({objectTypeDeclaration:i,ir:t})});return[...e.properties,...r]}Xi();var vDr=class{subpackages={};rootPackage={docs:void 0,fernFilepath:{allParts:[],packagePath:[],file:void 0},websocket:void 0,service:void 0,types:[],errors:[],subpackages:[],webhooks:void 0,navigationConfig:void 0};addPackageRedirection({from:t,to:r}){let n=this.getPackageForFernFilepath(t);if(n.navigationConfig!=null)throw new N({message:"Found duplicate navigationConfig for package",code:N.Code.InternalError});n.navigationConfig={pointsTo:Jl.generateSubpackageId(r)}}addDocs(t,r){let n=this.getPackageForFernFilepath(t);if(n.docs!=null)throw new N({message:"Found duplicate docs for package",code:N.Code.InternalError});n.docs=r}addSubpackage(t){this.getPackageForFernFilepath(t)}addType(t,r){this.getPackageForFernFilepath(r.name.fernFilepath).types.push(t)}addError(t,r){this.getPackageForFernFilepath(r.name.fernFilepath).errors.push(t)}addService(t,r){let n=this.getPackageForFernFilepath(r.name.fernFilepath);if(n.service!=null)throw new N({message:"Found duplicate service for "+t,code:N.Code.InternalError});n.service=t}addWebhookGroup(t,r){let n=this.getPackageForFernFilepath(r);if(n.webhooks!=null)throw new N({message:"Found duplicate webhook group for "+t,code:N.Code.InternalError});n.webhooks=t}addWebSocketChannel(t,r){let n=this.getPackageForFernFilepath(r);if(n.webhooks!=null)throw new N({message:"Found duplicate webhook group for "+t,code:N.Code.InternalError});n.websocket=t}build(t){t!=null&&(Object.entries(this.subpackages).forEach(([n,i])=>{t.hasSubpackageId(n)?this.subpackages[n]={...i,types:i.types.filter(o=>t.hasTypeId(o)),errors:i.errors.filter(o=>t.hasErrorId(o)),service:i.service!=null&&t.hasServiceId(i.service)?i.service:void 0,websocket:i.websocket!=null&&t.hasChannel(i.websocket)?i.websocket:void 0,subpackages:i.subpackages.filter(o=>t.hasSubpackageId(o))}:delete this.subpackages[n]}),this.rootPackage={...this.rootPackage,types:this.rootPackage.types.filter(n=>t.hasTypeId(n)),errors:this.rootPackage.errors.filter(n=>t.hasErrorId(n)),service:this.rootPackage.service!=null&&t.hasServiceId(this.rootPackage.service)?this.rootPackage.service:void 0,subpackages:this.rootPackage.subpackages.filter(n=>t.hasSubpackageId(n)),webhooks:this.rootPackage.webhooks!=null?this.rootPackage.webhooks:void 0});let r=new Set(this.getAllChildrenWithEndpoints(this.rootPackage));return{subpackages:tp(this.subpackages,(n,i)=>({...n,hasEndpointsInTree:r.has(i)})),rootPackage:{...this.rootPackage,hasEndpointsInTree:r.size>0||this.rootPackage.service!=null}}}sortRootPackage(t){if(!yHa(this.rootPackage.subpackages,t))throw new N({message:"Sorted subpackages differ from unsorted packages in root",code:N.Code.InternalError});this.rootPackage.subpackages=t}sortSubpackage(t,r){let n=this.subpackages[t];if(n==null)throw new N({message:"Subpackage does not exist: "+t,code:N.Code.ResolutionError});if(!yHa(n.subpackages,r))throw new N({message:"Sorted subpackages differ from unsorted packages",code:N.Code.InternalError});n.subpackages=r}getAllSubpackagesWithEndpoints(t){let r=this.subpackages[t];if(r==null)throw new N({message:"Subpackage does not exist: "+t,code:N.Code.ResolutionError});let n=this.getAllChildrenWithEndpoints(r);return(n.length>0||r.service!=null)&&n.push(t),n}getAllChildrenWithEndpoints(t){return t.subpackages.flatMap(r=>[...this.getAllSubpackagesWithEndpoints(r)])}getPackageForFernFilepath(t,r=0,n=this.rootPackage){let i=t.allParts[r];if(i==null)return n;let o=n.subpackages.map(l=>{let p=this.subpackages[l];if(p==null)throw new N({message:"Subpackage ID is invalid: "+l,code:N.Code.InternalError});return p}),s=r+1,a={allParts:t.allParts.slice(0,s),packagePath:t.packagePath.slice(0,s),file:s===t.allParts.length?t.file:void 0},c=Mr(i),u=o.find(l=>Mr(l.name)===c);if(u==null){let l=Jl.generateSubpackageId(a),p={docs:void 0,fernFilepath:a,name:i,displayName:void 0,service:void 0,types:[],errors:[],subpackages:[],navigationConfig:void 0,webhooks:void 0,websocket:void 0};this.subpackages[l]=p,n.subpackages.push(l),u=p}return this.getPackageForFernFilepath(t,s,u)}};function yHa(e,t){if(e.length!==t.length)return!1;let r=new Set(e);for(let n of t)if(!r.has(n))return!1;return!0}function bHa({reference:e,referencedIn:t,imports:r}){let[n,i,...o]=e.split(".");if(n==null||o.length>0)return;if(i==null)return{endpointName:n,relativeFilepath:t};let a=r[n];if(a!=null)return{endpointName:i,relativeFilepath:$0e({referencedIn:t,importPath:a})}}var RNe=class{workspace;constructor(t){this.workspace=t}resolveEndpointOrThrow({endpoint:t,file:r}){let n=this.resolveEndpoint({endpoint:t,file:r});if(n==null)throw new N({message:"Cannot resolve endpoint: "+t+" in file "+r.relativeFilepath,code:N.Code.ResolutionError});return n}resolveEndpointByMethodAndPath({method:t,path:r,namespace:n,casingsGenerator:i}){let o;return uv(this.workspace,(s,a,c)=>{if(n!=null&&this.getNamespaceFromFilepath(s)!==n)return;let u=mu({relativeFilepath:s,definitionFile:a,casingsGenerator:i,rootApiFile:this.workspace.definition.rootApiFile.contents,defaultUrl:c.defaultUrl});for(let[l,p]of Object.entries(a.service?.endpoints??{}))p.method===t&&p.path===r&&(o={endpointId:l,endpoint:p,file:u})}),AFe(this.workspace,(s,a)=>{if(n!=null&&this.getNamespaceFromFilepath(s)!==n)return;let c=mu({relativeFilepath:s,definitionFile:a,casingsGenerator:i,rootApiFile:this.workspace.definition.rootApiFile.contents});for(let[u,l]of Object.entries(a.service?.endpoints??{}))l.method===t&&l.path===r&&(o={endpointId:u,endpoint:l,file:c})}),o}getNamespaceFromFilepath(t){let r=t.split("/");if(r.length>1)return r[0]}resolveEndpoint({endpoint:t,file:r}){let i=new Fse().tryParse(t);if(i!=null)return this.resolveEndpointByMethodAndPath({method:i.method,path:i.path,namespace:i.namespace,casingsGenerator:r.casingsGenerator});let o=this.getDeclarationOfEndpoint({referenceToEndpoint:t,file:r});if(o==null)return;let s=o.file.definitionFile.service?.endpoints?.[o.endpointName];if(s!=null)return{endpointId:o.endpointName,endpoint:s,file:o.file}}getDeclarationOfEndpoint({referenceToEndpoint:t,file:r}){let n=bHa({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(n==null)return;let i=Z3(this.workspace,n.relativeFilepath);if(!(i==null||i.service?.endpoints?.[n.endpointName]==null))return{endpointName:n.endpointName,file:mu({relativeFilepath:n.relativeFilepath,definitionFile:i,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}};var FNe=class{workspace;constructor(t){this.workspace=t}getDeclarationOrThrow(t,r){let n=this.getDeclaration(t,r);if(n==null)throw new N({message:"Error does not exist: "+t,code:N.Code.ResolutionError});return n}getDeclaration(t,r){let n=D6({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(n==null)return;let i=Z3(this.workspace,n.relativeFilepath);if(i==null)return;let o=i.errors?.[n.typeName];if(o!=null)return{declaration:o,file:mu({definitionFile:i,relativeFilepath:n.relativeFilepath,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}};jt();var R6=class{typeResolver;constructor(t){this.typeResolver=t}resolveAllReferencesInExample({example:t,file:r}){if(typeof t=="string"){let n=this.resolveExample({example:t,file:r});return n==null?n:typeof n.resolvedExample=="string"?(n.resolvedExample.startsWith(`\\${"$"}`)&&(n.resolvedExample=n.resolvedExample.slice(1)),n):this.resolveAllReferencesInExample({example:n.resolvedExample,file:n.file})}else if(Lo(t)){let n={};for(let[i,o]of Object.entries(t)){let s=this.resolveAllReferencesInExample({example:o,file:r});if(s==null)return;let a=i.startsWith(`\\${"$"}`)?i.slice(1):i;n[a]=s.resolvedExample}return{resolvedExample:n}}else if(Array.isArray(t)){let n=[];for(let i of t){let o=this.resolveAllReferencesInExample({example:i,file:r});if(o==null)return;n.push(o.resolvedExample)}return{resolvedExample:n}}return{resolvedExample:t}}resolveAllReferencesInExampleOrThrow({example:t,file:r}){let n=this.resolveAllReferencesInExample({example:t,file:r});if(n==null)throw new N({message:"Failed to resolve examples",code:N.Code.ResolutionError});return n}resolveExample({example:t,file:r}){return typeof t!="string"?{resolvedExample:t,file:r}:t.startsWith("$")?this.parseExampleReference(t)==null?{resolvedExample:t,file:r}:this.resolveExampleReference(t,r):{resolvedExample:t,file:r}}resolveExampleReference(t,r){let n=this.parseExampleReference(t);if(n==null)return;let i=this.typeResolver.getDeclarationOfNamedType({referenceToNamedType:n.rawTypeReference,file:r});if(i==null||typeof i.declaration=="string"||i.declaration.examples==null)return;let o=i.declaration.examples.find(s=>s.name===n.exampleName);if(o!=null)return this.resolveExample({example:o.value,file:i.file})}resolveExampleOrThrow({example:t,file:r}){let n=this.resolveExample({example:t,file:r});if(n==null)throw new N({message:"Cannot resolve example: "+t,code:N.Code.ResolutionError});return n}parseExampleReference(t){let[r,n,i,...o]=t.split(".");if(r==null||n==null||o.length>0)return;if(i==null){let a=r.slice("$".length);return NYi(a)?{rawTypeReference:a,exampleName:n}:void 0}let s=r.slice("$".length);if(!(!NYi(s)||!NYi(n)))return{rawTypeReference:`${s}.${n}`,exampleName:i}}};function NYi(e){if(e.length===0)return!1;let t=e.charAt(0);return t>="a"&&t<="z"||t>="A"&&t<="Z"}jt();var CDr=class{typeResolver;endpointResolver;constructor(t,r){this.typeResolver=t,this.endpointResolver=r,this.typeResolver=t,this.endpointResolver=r}resolveRequestPropertyOrThrow({file:t,endpoint:r,propertyComponents:n}){let i=this.resolveRequestProperty({file:t,endpoint:r,propertyComponents:n});if(i==null)throw new N({message:"Cannot resolve request property from endpoint: "+r+" in file "+t.relativeFilepath,code:N.Code.ResolutionError});return i}resolveRequestProperty({file:t,endpoint:r,propertyComponents:n}){let i=this.endpointResolver.resolveEndpointOrThrow({endpoint:r,file:t});if(i.endpoint.request==null)return;if(typeof i.endpoint.request!="string")return this.resolveRequestPropertyFromInlinedRequest({typeResolver:this.typeResolver,file:i.file,requestType:i.endpoint.request,propertyComponents:n});let o=this.typeResolver.resolveTypeOrThrow({type:i.endpoint.request,file:i.file}),s=this.resolveObjectProperty({file:i.file,resolvedType:o,propertyComponents:n});if(s!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:n,file:t,resolvedType:o}),property:Y1.body(s)}}resolveResponsePropertyOrThrow({file:t,endpoint:r,propertyComponents:n}){let i=this.resolveResponseProperty({file:t,endpoint:r,propertyComponents:n});if(i==null)throw new N({message:"Cannot resolve response property from endpoint: "+r+" in file "+t.relativeFilepath,code:N.Code.ResolutionError});return i}resolveResponseProperty({file:t,endpoint:r,propertyComponents:n}){let i=this.endpointResolver.resolveEndpointOrThrow({endpoint:r,file:t}),o=this.typeResolver.resolveTypeOrThrow({type:(typeof i.endpoint.response!="string"?i.endpoint.response?.type:i.endpoint.response)??"",file:i.file}),s=this.resolveObjectProperty({file:i.file,resolvedType:o,propertyComponents:n});if(s!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:n,resolvedType:o,file:t}),property:s}}resolveRequestPropertyFromInlinedRequest({typeResolver:t,file:r,requestType:n,propertyComponents:i}){if(i.length===1){let o=i[0]??"",s=n["query-parameters"]?.[o]??void 0;if(s!=null)return{property:Y1.query(uDr({file:r,queryParameterKey:o,queryParameter:s})),propertyPath:void 0}}return this.resolveRequestPropertyFromInlinedRequestBody({typeResolver:t,file:r,requestType:n,propertyComponents:i})}resolveRequestPropertyFromInlinedRequestBody({typeResolver:t,file:r,requestType:n,propertyComponents:i}){if(n.body==null)return;if(typeof n.body=="string"){let a=t.resolveTypeOrThrow({type:n.body,file:r}),c=this.resolveObjectProperty({file:r,resolvedType:a,propertyComponents:i});return c==null?void 0:{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:i,file:r,resolvedType:a}),property:Y1.body(c)}}if(gg(n.body)){let a=nDr({typeResolver:t,file:r,objectSchema:n.body,propertyComponents:i});return a==null?void 0:{propertyPath:this.propertyPathFromPropertyComponentsFromInlineRequestBody({propertyComponents:i,file:r,body:n.body}),property:Y1.body(a)}}let o=t.resolveTypeOrThrow({type:n.body.type,file:r}),s=rDr({typeResolver:t,file:GYe(o)??r,resolvedType:o,propertyComponents:i});if(s!=null)return{propertyPath:this.propertyPathFromPropertyComponents({propertyComponents:i,file:r,resolvedType:o}),property:Y1.body(s)}}resolveObjectProperty({file:t,resolvedType:r,propertyComponents:n}){return rDr({typeResolver:this.typeResolver,file:GYe(r)??t,resolvedType:r,propertyComponents:n})}propertyPathFromPropertyComponents({propertyComponents:t,file:r,resolvedType:n}){if(t.length<=1)return[];let i=kNe(n),o=n,s=[],a=[];for(let c of t.slice(0,-1))a.push(c),o=QPf({typeResolver:this.typeResolver,file:r,resolvedType:o,propertyName:c,breadcrumbs:a,rootTypeTitle:i}),s.push({name:r.casingsGenerator.generateName(c),type:o.originalTypeReference});return s}propertyPathFromPropertyComponentsFromInlineRequestBody({propertyComponents:t,file:r,body:n}){if(t.length<=1)return[];let i=[],o=[];for(let s of t.slice(0,-1)){o.push(s);let a=nDr({typeResolver:this.typeResolver,file:r,objectSchema:n,propertyComponents:o});if(!a)throw new N({message:`Cannot find property '${o.join(".")}' in inline request body in file ${r.relativeFilepath}`,code:N.Code.InternalError});i.push({name:r.casingsGenerator.generateName(s),type:a.valueType})}return i}};function QPf({typeResolver:e,file:t,resolvedType:r,propertyName:n,breadcrumbs:i,rootTypeTitle:o}){let s=ZYe({typeResolver:e,file:t,resolvedType:r,propertyName:n});if(!s)throw new N({message:`Cannot find property '${i.join(".")}' in ${o}`,code:N.Code.InternalError});return s}function ZYe({typeResolver:e,file:t,resolvedType:r,propertyName:n}){switch(r._type){case"container":switch(r.container._type){case"list":return;case"literal":return;case"map":return;case"nullable":{let i=ZYe({typeResolver:e,file:t,resolvedType:r.container.itemType,propertyName:n});return i||void 0}case"optional":{let i=ZYe({typeResolver:e,file:t,resolvedType:r.container.itemType,propertyName:n});return i||void 0}case"set":return;default:Ce(r.container)}break;case"primitive":return;case"unknown":return;case"named":{let i=r.declaration;if("properties"in i&&i.properties!=null){for(let[o,s]of Object.entries(i.properties))if(o===n)return e.resolveTypeOrThrow({type:typeof s=="string"?s:s.type,file:r.file})}if("base-properties"in i&&i["base-properties"]!=null){for(let[o,s]of Object.entries(i["base-properties"]))if(o===n)return e.resolveTypeOrThrow({type:typeof s=="string"?s:s.type,file:r.file})}if("extends"in i&&i.extends!=null){let o=Array.isArray(i.extends)?i.extends:[i.extends];for(let s of o){let a=e.resolveTypeOrThrow({type:s,file:r.file}),c=ZYe({file:"file"in a?a.file:t,typeResolver:e,resolvedType:a,propertyName:n});if(c)return c}}if("union"in i&&i.union!=null)if(Array.isArray(i.union))for(let o of i.union){let s=e.resolveTypeOrThrow({type:typeof o=="string"?o:o.type,file:r.file}),a=ZYe({file:"file"in s?s.file:t,typeResolver:e,resolvedType:s,propertyName:n});if(a)return a}else for(let[,o]of Object.entries(i.union)){let s=typeof o=="string"?o:o.type;if(!s)continue;let a=e.resolveTypeOrThrow({type:s,file:r.file}),c=ZYe({file:"file"in a?a.file:t,typeResolver:e,resolvedType:a,propertyName:n});if(c)return c}return}default:Ce(r)}}function kNe(e){switch(e._type){case"container":switch(e.container._type){case"list":return`list<${kNe(e.container.itemType)}>}`;case"literal":return`literal<${e.container.literal._visit({boolean:t=>t.toString(),string:t=>t,_other:t=>t.type})}>`;case"map":return`map<${kNe(e.container.keyType)}, ${kNe(e.container.valueType)}>}`;case"nullable":return`nullable<${kNe(e.container.itemType)}>}`;case"optional":return`optional<${kNe(e.container.itemType)}>}`;case"set":return`set<${kNe(e.container.itemType)}>}`;default:Ce(e.container)}break;case"named":return Mr(e.name.name);case"primitive":return e.primitive.v1;case"unknown":return"unknown";default:Ce(e)}}var af=class{workspace;constructor(t){this.workspace=t}resolveTypeOrThrow({type:t,file:r}){let n=this.resolveType({type:t,file:r});if(n==null)throw new N({message:"Cannot resolve type: "+t+" in file "+r.relativeFilepath,code:N.Code.ResolutionError});return n}getDeclarationOfNamedTypeOrThrow({referenceToNamedType:t,file:r}){let n=this.getDeclarationOfNamedType({referenceToNamedType:t,file:r});if(n==null)throw new N({message:"Cannot find declaration of type: "+t+" in file "+r.relativeFilepath,code:N.Code.ResolutionError});return n}getDeclarationOfNamedType({referenceToNamedType:t,file:r}){let n=D6({reference:t,referencedIn:r.relativeFilepath,imports:r.imports});if(n==null)return;let i=Z3(this.workspace,n.relativeFilepath);if(i==null)return;let o=i.types?.[n.typeName];if(o==null){let s=Jb(n.typeName);if(s!=null){for(let a of Object.keys(i.types??{})??[])if(s.name&&a.startsWith(s.name)&&a.endsWith(">")){let c=i.types?.[a];return c!=null?{typeName:a,declaration:c,file:mu({relativeFilepath:n.relativeFilepath,definitionFile:i,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}:void 0}}return}return{typeName:n.typeName,declaration:o,file:mu({relativeFilepath:n.relativeFilepath,definitionFile:i,casingsGenerator:r.casingsGenerator,rootApiFile:this.workspace.definition.rootApiFile.contents})}}resolveType({type:t,file:r,objectPath:n=[]}){return rv({type:t,_default:void 0,validation:void 0,visitor:{primitive:i=>({_type:"primitive",primitive:i,originalTypeReference:jr.primitive(i)}),unknown:()=>({_type:"unknown",originalTypeReference:jr.unknown()}),map:({keyType:i,valueType:o})=>i!=null&&o!=null?{_type:"container",container:{_type:"map",keyType:i,valueType:o},originalTypeReference:jr.container(js.map({keyType:i.originalTypeReference,valueType:o.originalTypeReference}))}:void 0,list:i=>i!=null?{_type:"container",container:{_type:"list",itemType:i},originalTypeReference:jr.container(js.list(i.originalTypeReference))}:void 0,optional:i=>i!=null?{_type:"container",container:{_type:"optional",itemType:i},originalTypeReference:jr.container(js.optional(i.originalTypeReference))}:void 0,nullable:i=>i!=null?{_type:"container",container:{_type:"nullable",itemType:i},originalTypeReference:jr.container(js.nullable(i.originalTypeReference))}:void 0,set:i=>i!=null?{_type:"container",container:{_type:"set",itemType:i},originalTypeReference:jr.container(js.set(i.originalTypeReference))}:void 0,literal:i=>({_type:"container",container:{_type:"literal",literal:i},originalTypeReference:jr.container(js.literal(i))}),named:i=>{let o=this.getDeclarationOfNamedType({referenceToNamedType:i,file:r});if(o==null)return;let s={typeName:o.typeName,file:o.file.relativeFilepath,reference:i};if(!n.some(a=>a.file===s.file&&a.typeName===s.typeName))return this.resolveNamedTypeFromDeclaration({referenceToNamedType:i,referencedIn:r,rawDeclaration:o,objectPath:[...n,s]})}}})}resolveNamedTypeOrThrow({referenceToNamedType:t,file:r}){let n=this.resolveNamedType({referenceToNamedType:t,file:r});if(n==null)throw new N({message:"Cannot resolve type: "+t,code:N.Code.ResolutionError});return n}resolveNamedType({referenceToNamedType:t,file:r}){let n=this.getDeclarationOfNamedType({referenceToNamedType:t,file:r});if(n!=null)return this.resolveNamedTypeFromDeclaration({referenceToNamedType:t,referencedIn:r,rawDeclaration:n})}resolveNamedTypeFromDeclaration({referenceToNamedType:t,referencedIn:r,rawDeclaration:n,objectPath:i=[]}){let{declaration:o,file:s}=n;if(Khe(o))return this.resolveType({type:typeof o=="string"?o:o.type,file:s,objectPath:i});let a=pkt({type:t,_default:void 0,validation:void 0,file:r});if(!(a.type!=="named"||Z3(this.workspace,s.relativeFilepath)==null))return{_type:"named",rawName:n.typeName,name:a,declaration:o,filepath:s.relativeFilepath,objectPath:i,originalTypeReference:a,file:s}}};var O7=class e{static VARIABLE_PREFIX="$";getDeclarationOrThrow(t,r){let n=this.getDeclaration(t,r);if(n==null)throw new N({message:"Variable does not exist: "+t,code:N.Code.ResolutionError});return n}getDeclaration(t,r){if(!t.startsWith(e.VARIABLE_PREFIX))return;let n=r.rootApiFile.variables?.[t.substring(1)];if(n!=null)return{declaration:n,file:yue({casingsGenerator:r.casingsGenerator,rootApiFile:r.rootApiFile})}}getVariableIdOrThrow(t){let r=this.getVariableId(t);if(r==null)throw new N({message:"Variable reference does not start with "+e.VARIABLE_PREFIX,code:N.Code.ResolutionError});return r}getVariableId(t){if(t.startsWith(e.VARIABLE_PREFIX))return t.substring(e.VARIABLE_PREFIX.length)}};function wDr(e,t){if(t){for(let[r,n]of Object.entries(t))if(typeof n!="string"&&r===e)return n.audiences}}var EHa={pathParameterOrder:Rn.PathParameterOrder.UrlOrder};function IHa({workspace:e}){let t=e.generatorsConfiguration?.api?.settings,r={...EHa};for(let n of Object.keys(EHa)){let i=t?.[n];i!==void 0&&(r[n]=i)}return r}function Sg({workspace:e,generationLanguage:t,keywords:r,smartCasing:n,exampleGeneration:i,audiences:o,readme:s,packageName:a,version:c,fdrApiDefinitionId:u,sourceResolver:l,disableDynamicExamples:p,dynamicGeneratorConfig:d,generationMetadata:f}){let m=IHa({workspace:e}),h=lx({generationLanguage:t,keywords:r,smartCasing:n}),A=new BNe(o),b=yue({casingsGenerator:h,rootApiFile:e.definition.rootApiFile.contents}),v=(e.definition.rootApiFile.contents.errors??[]).map(ht=>({error:K0e({errorName:ht,file:b}),docs:void 0})),w=new af(e),C=new RNe(e),x=new CDr(w,C),B=new FNe(e),O=new R6(w),F=new O7,L=rkt({casingsGenerator:h,rawApiFileSchema:e.definition.rootApiFile.contents})?.environmentsConfig,K={selfHosted:!1,fdrApiDefinitionId:u,apiVersion:X$a({file:b,rawApiFileSchema:e.definition.rootApiFile.contents}),apiName:h.generateName(e.definition.rootApiFile.contents.name),apiDisplayName:e.definition.rootApiFile.contents["display-name"],apiDocs:akt(e.definition.rootApiFile.contents.docs),auth:Y$a({rawApiFileSchema:e.definition.rootApiFile.contents,file:b,propertyResolver:x,endpointResolver:C,typeResolver:w}),headers:e.definition.rootApiFile.contents.headers!=null?Object.entries(e.definition.rootApiFile.contents.headers).map(([ht,Pt])=>PU({headerKey:ht,header:Pt,file:b})):[],idempotencyHeaders:e.definition.rootApiFile.contents["idempotency-headers"]!=null?Object.entries(e.definition.rootApiFile.contents["idempotency-headers"]).map(([ht,Pt])=>PU({headerKey:ht,header:Pt,file:b})):[],types:{},errors:{},services:{},constants:U$a(h),environments:L,errorDiscriminationStrategy:rHa(e.definition.rootApiFile.contents["error-discrimination"],b),basePath:e.definition.rootApiFile.contents["base-path"]!=null?ub(e.definition.rootApiFile.contents["base-path"]):void 0,pathParameters:YYe({pathParameters:e.definition.rootApiFile.contents["path-parameters"],file:b,location:Zt.PathParameterLocation.Root,variableResolver:F}),variables:e.definition.rootApiFile.contents.variables!=null?Object.entries(e.definition.rootApiFile.contents.variables).map(([ht,Pt])=>({docs:typeof Pt!="string"?Pt.docs:void 0,id:ht,name:b.casingsGenerator.generateName(ht),type:b.parseTypeReference(Pt)})):[],serviceTypeReferenceInfo:{typesReferencedOnlyByService:{},sharedTypes:[]},webhookGroups:{},websocketChannels:{},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,audiences:e.definition.rootApiFile.contents.audiences,generationMetadata:f,apiPlayground:!0,casingsConfig:{generationLanguage:t,keywords:r,smartCasing:n}},X=new vDr,Y=ht=>{X.addSubpackage(ht.fernFilepath),_p(ht.definitionFile,{imports:bt,docs:Pt=>{Pt!=null&&X.addDocs(ht.fernFilepath,Pt)},types:Pt=>{if(Pt!=null)for(let[Lt,Ut]of Object.entries(Pt)){if(p3(Lt))continue;let be=dHa({typeName:Lt,typeDeclaration:Ut,file:ht,typeResolver:w,exampleResolver:O,sourceResolver:l,workspace:e}),pe=be.typeDeclaration;i.disabled&&(pe.userProvidedExamples=[],pe.autogeneratedExamples=[]);let ze=be.descendantFilepaths,at=Jl.generateTypeId(pe.name);K.types[at]=pe,X.addType(at,pe),A.addType({declaredTypeName:pe.name,descendantTypeIds:pe.referencedTypes,descendantTypeIdsByAudience:{},propertiesByAudience:be.propertiesByAudience,descendantFilepaths:ze}),A.markTypeForAudiences(pe.name,UWa(Ut))}},errors:Pt=>{if(Pt==null)return;if(e.definition.rootApiFile.contents["error-discrimination"]==null)throw new N({message:"error-discrimination is missing in api.yml but there are declared errors.",code:N.Code.ConfigError});for(let[Ut,be]of Object.entries(Pt)){let pe=eHa({errorName:Ut,errorDeclaration:be,file:ht,typeResolver:w,exampleResolver:O,workspace:e}),ze=Jl.generateErrorId(pe.name);K.errors[ze]=pe,X.addError(ze,pe),A.addError(pe)}},service:Pt=>{if(Pt==null)return;let Lt=Q$a({rootDefaultUrl:ht.defaultUrl??e.definition.rootApiFile.contents["default-url"],rootPathParameters:K.pathParameters,serviceDefinition:Pt,file:ht,errorResolver:B,typeResolver:w,propertyResolver:x,exampleResolver:O,sourceResolver:l,globalErrors:v,variableResolver:F,workspace:e,auth:K.auth,irSettings:m}),Ut=Jl.generateServiceId(Lt.name);K.services[Ut]=Lt,X.addService(Ut,Lt);let be={};Lt.endpoints.forEach(pe=>{i.disabled&&(pe.autogeneratedExamples=[],pe.userSpecifiedExamples=[]);let ze=Mr(pe.name),at=Pt.endpoints[ze];A.addEndpoint(Lt,pe,at),be[ze]=pe}),Pt.audiences!=null&&A.markEndpointForAudience(Lt.name,Lt.endpoints,Pt.audiences),Object.entries(Pt.endpoints).map(([pe,ze])=>{let at=be[pe];at!=null&&ze.audiences!=null&&A.markEndpointForAudience(Lt.name,[at],ze.audiences)})},webhooks:Pt=>{if(Pt==null)return;let Lt=Jl.generateWebhookGroupId(ht.fernFilepath),Ut=iHa({webhooks:Pt,file:ht,typeResolver:w,exampleResolver:O,workspace:e,defaultSignature:ht.definitionFile["webhook-signature"]}),be={};for(let pe of Ut)be[Mr(pe.name)]=pe;Object.entries(Pt).forEach(([pe,ze])=>{let at=be[pe];at!=null&&(A.addWebhook(ht.fernFilepath,at,ze),ze.audiences!=null&&A.markWebhookForAudiences(ht.fernFilepath,at,ze.audiences))}),K.webhookGroups[Lt]=Ut,X.addWebhookGroup(Lt,ht.fernFilepath)},"webhook-signature":bt,channel:Pt=>{if(Pt==null)return;let Lt=Jl.generateWebSocketChannelId(ht.fernFilepath),Ut=Z$a({channel:Pt,file:ht,variableResolver:F,typeResolver:w,exampleResolver:O,workspace:e});A.addChannel(ht.fernFilepath,Lt,Ut,Pt),Pt.audiences!=null&&A.markChannelForAudiences(ht.fernFilepath,Lt,Pt.audiences),K.websocketChannels!=null&&(K.websocketChannels[Lt]=Ut,X.addWebSocketChannel(Lt,ht.fernFilepath))}})};uv(e,(ht,Pt,Lt)=>{Y(mu({relativeFilepath:ht,definitionFile:Pt,casingsGenerator:h,rootApiFile:e.definition.rootApiFile.contents,defaultUrl:Lt.defaultUrl}))}),AFe(e,(ht,Pt)=>{if(Pt.navigation!=null)if(typeof Pt.navigation=="string")X.addPackageRedirection({from:SN({relativeFilepath:ht,casingsGenerator:h}),to:SN({relativeFilepath:eI(e3(ht),$s.of(Pt.navigation)),casingsGenerator:h})});else{let Lt=Pt.navigation.map(Ut=>Jl.generateSubpackageId(SN({relativeFilepath:eI(e3(ht),$s.of(Ut)),casingsGenerator:h})));ht===Rf?X.sortRootPackage(Lt):X.sortSubpackage(Jl.generateSubpackageId(SN({relativeFilepath:ht,casingsGenerator:h})),Lt)}}),K.serviceTypeReferenceInfo=MPf(A),hHa(K);let de=i.disabled?K:okt({ir:K,exampleGeneration:i}),he=e.definition.rootApiFile.contents,ae=L?.environments._visit({singleBaseUrl:ht=>ht.environments.filter(Pt=>wDr(Pt.id,he.environments)!=null).length===0,multipleBaseUrls:ht=>ht.environments.filter(Pt=>wDr(Pt.id,he.environments)!=null).length===0,_other:()=>!1});L?.environments.environments.forEach(ht=>{A.markEnvironmentForAudiences(ht,wDr(ht.id,he.environments)??[],ae)});let me=A.hasNoAudiences()?void 0:A.build(),Re=yYi(de,me),Qe=e.definition.rootApiFile.contents.auth!=null&&Object.values(Re.services).every(ht=>ht.endpoints.every(Pt=>Pt.auth)),re=Object.values(Re.services).some(ht=>ht.endpoints.some(Pt=>Pt.response?.body?.type==="streaming")),ie=Object.values(Re.services).some(ht=>ht.endpoints.some(Pt=>Pt.pagination!=null)),Ee=Object.values(Re.services).some(ht=>ht.endpoints.some(Pt=>Pt.response?.body?.type==="fileDownload")),Ie={isAuthMandatory:Qe,hasStreamingEndpoints:re,hasPaginatedEndpoints:ie,hasFileDownloadEndpoints:Ee,platformHeaders:{language:"X-Fern-Language",sdkName:"X-Fern-SDK-Name",sdkVersion:"X-Fern-SDK-Version",userAgent:c!=null&&a!=null?{header:"User-Agent",value:`${a}/${c}`}:void 0}},Fe=s??e.generatorsConfiguration?.rawConfiguration.readme,Ue=Fe!=null?nHa({readme:Fe,services:K.services}):void 0,st=jPf({...Re,...X.build(me),sdkConfig:Ie,readmeConfig:Ue});return{...st,dynamic:DNe({ir:st,generatorConfig:d,disableExamples:p,generationLanguage:t,smartCasing:n})}}function jPf(e){let t=r=>{if(!r||typeof r!="object")return r;if(Array.isArray(r))return r.map(t);for(let n in r){let i=r[n];n==="docs"&&typeof i=="string"?r[n]=akt(i):i&&typeof i=="object"&&t(i)}return r};return t(e)}function MPf(e){let t={},r=[],n=e.getTypesReferencedByService();for(let[i,o]of Object.entries(n)){if(o.size===1){let s=o.values().next().value;if(s==null)break;t[s]===void 0&&(t[s]=[]),t[s]?.push(i);continue}r.push(i)}return{typesReferencedOnlyByService:t,sharedTypes:r}}var Jf=lx({generationLanguage:void 0,keywords:void 0,smartCasing:!1});var QYi={name:"exploded-form-data-is-array",create:({workspace:e})=>{let t=new af(e);return{definitionFile:{httpEndpoint:({endpoint:r},{relativeFilepath:n,contents:i})=>{if(r.request==null||typeof r.request=="string"||r.request?.body==null||typeof r.request.body=="string")return[];if(!LPf(r.request.body))return[];let o=[];for(let[s,a]of Object.entries(r.request.body.properties??{})){if(typeof a=="string"||a.style!=="exploded")continue;let c=mu({relativeFilepath:n,definitionFile:i,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),u=t.resolveType({type:a.type,file:c});if(u==null)return[];vHa(u)||o.push({message:`${s} is exploded and must be a list. Did you mean list<${a.type}>?`,severity:"error"})}return o}}}}};function vHa(e){return e._type!=="container"?!1:e.container._type==="list"?!0:e.container._type==="optional"||e.container._type==="nullable"?vHa(e.container.itemType):!1}function LPf(e){return e?.properties!=null}Xt();var jYi={name:"import-file-exists",create:({workspace:e})=>{let t=Object.keys(Dae(e.definition)),r=new Set;return t.forEach(n=>{let i=Ye(e.definition.absoluteFilePath,De.of(n));r.add(i)}),{definitionFile:{import:({importedAs:n,importPath:i},{relativeFilepath:o})=>{let s=[],a=Ye(e.definition.absoluteFilePath,Sn(o),De.of(i));return r.has(a)||s.push({severity:"fatal",message:`Import ${ve.bold(n)} points to non-existent path ${ve.bold(i)}.`}),s}}}}};function xDr(e){return e.definition.rootApiFile.contents.environments==null?[]:Object.values(e.definition.rootApiFile.contents.environments).reduce((t,r)=>{if(oO(r))for(let n of Object.keys(r.urls))t.includes(n)||t.push(n);return t},[])}var MYi={name:"matching-environment-urls",create:({workspace:e})=>{let t=xDr(e);return t.length===0?{}:{rootApiFile:{environment:({environmentId:r,environment:n})=>{let i=[],o=s=>{i.push({severity:"fatal",message:`Environment ${r} is missing URL for ${ve.bold(s)}`})};return CH(n,{singleBaseUrl:()=>{for(let s of t)o(s)},multipleBaseUrls:s=>{for(let a of t)s.urls[a]==null&&o(a)}}),i}}}}};jt();Xt();var LYi={name:"no-circular-imports",DISABLE_RULE:!0,create:({workspace:e})=>{let t=UPf(e.definition.namedDefinitionFiles);return{definitionFile:{import:({importPath:r},{relativeFilepath:n})=>{let i=t[n];if(i==null)return[];let o=$0e({referencedIn:n,importPath:De.of(r)});return i.filter(({chainWithoutStartingFilepath:a})=>a.length===0||a[0]===o).map(a=>({severity:"fatal",message:a.chainWithoutStartingFilepath.length===0?"A file cannot import itself":`Circular import detected: ${[a.startingFilepath,...a.chainWithoutStartingFilepath,a.startingFilepath].join(" -> ")}`}))}}}}};function UPf(e){let t={};for(let r of UT(e))t[r]=CHa(r,[r],e);return t}function CHa(e,t,r){let n=[],i=r[e];if(i==null)return[];if(i.contents.imports!=null)for(let o of Object.values(i.contents.imports)){let s=$0e({referencedIn:e,importPath:De.of(o)});t.includes(s)?t[0]===s&&t[0]===zPf(t)&&n.push({startingFilepath:s,chainWithoutStartingFilepath:t.slice(1)}):n.push(...CHa(s,[...t,s],r))}return n}function zPf(e){return e.reduce((t,r)=>r<t?r:t)}jt();var SDr=class{workspace;typeResolver;constructor(t){this.workspace=t,this.typeResolver=new af(t)}isTypeComplex(t,r){let n=mu({relativeFilepath:r.relativeFilepath,definitionFile:r.contents,casingsGenerator:Jf,rootApiFile:this.workspace.definition.rootApiFile.contents}),i=this.typeResolver.resolveType({type:t,file:n});if(i==null)return;let o=new Set;return this.isResolvedReferenceComplex({type:i,file:n,visited:o})}isResolvedReferenceComplex({type:t,file:r,visited:n}){switch(t._type){case"container":return this.isResolvedContainerComplex({type:t.container,file:r,visited:n});case"named":return this.isNamedTypeComplex({type:t,file:r,visited:n});case"primitive":return!1;case"unknown":return!1;default:Ce(t)}}isResolvedContainerComplex({type:t,file:r,visited:n}){switch(t._type){case"literal":return!1;case"map":return(this.isResolvedReferenceComplex({type:t.keyType,file:r,visited:n})||this.isResolvedReferenceComplex({type:t.valueType,file:r,visited:n}))&&!(t.keyType._type==="primitive"&&t.keyType.primitive.v1==="STRING"&&t.valueType._type==="unknown");case"optional":case"nullable":case"list":case"set":return this.isResolvedReferenceComplex({type:t.itemType,file:r,visited:n});default:Ce(t)}}isNamedTypeComplex({type:t,file:r,visited:n}){if(n.has(t.rawName))return!1;if(n.add(t.rawName),v3(t.declaration))return!0;if(wG(t.declaration))return!1;if(sf(t.declaration))return this.objectHasComplexProperties({typeName:t.rawName,objectDeclaration:t.declaration,file:r,visited:n});if(QGe(t.declaration)){for(let i of t.declaration.union){let o=typeof i=="string"?i:i.type,s=this.isTypeComplex(o,{contents:r.definitionFile,relativeFilepath:r.relativeFilepath});if(s!=null&&s)return!0}return!1}Ce(t.declaration)}objectHasComplexProperties({typeName:t,objectDeclaration:r,file:n,visited:i}){return OU({typeName:t,objectDeclaration:r,typeResolver:this.typeResolver,definitionFile:n.definitionFile,workspace:this.workspace,filepathOfDeclaration:n.relativeFilepath,smartCasing:!1}).some(s=>this.isComplex({type:s.resolvedPropertyType,file:n,visited:i}))}isComplex({type:t,file:r,visited:n}){switch(t._type){case"named":return this.isNamedTypeComplex({type:t,file:r,visited:n});case"primitive":case"unknown":return!1;case"container":return this.isComplexContainer({type:t.container,file:r,visited:n});default:Ce(t)}}isComplexContainer({type:t,file:r,visited:n}){switch(t._type){case"literal":return!1;case"map":return this.isComplex({type:t.keyType,file:r,visited:n})||this.isComplex({type:t.valueType,file:r,visited:n});case"optional":case"nullable":case"list":case"set":return this.isComplex({type:t.itemType,file:r,visited:n});default:Ce(t)}}};var UYi={name:"no-complex-query-params",create:({workspace:e})=>{let t=new SDr(e);return{definitionFile:{queryParameter:({queryParameter:r},n)=>{let i=typeof r=="string"?r:r.type,o=t.isTypeComplex(i,n);return o!=null&&o?[{severity:"fatal",message:`${i} is not a valid type for a query parameter`}]:[]}}}}};var zYi={name:"no-conflicting-endpoint-parameters",create:()=>({definitionFile:{pathParameter:({pathParameterKey:e})=>e===iDr?[{severity:"fatal",message:`Path parameter ${ve.bold(e)} is not suitable for code generation, because it can conflict with the request body parameter.`}]:[]}})};function Akt({service:e,endpoint:t}){return e["base-path"]+t.path}var _Dr=class{root=new VYi;registerEndpoint(t){this.root.insert(this.getPathPartsForEndpoint(t),t)}getConflictingEndpoints(t){return this.root.getMatchingEndpoints(this.getPathPartsForEndpoint(t)).filter(r=>!(r.relativeFilepath===t.relativeFilepath&&r.endpointId===t.endpointId)&&r.endpoint.method===t.endpoint.method)}getPathPartsForEndpoint(t){return Akt({service:t.service,endpoint:t.endpoint}).split("/").filter(r=>r.length>0)}},VYi=class e{childPaths={};childPathParam;endpointsThatEndWithThisNode=[];insert(t,r){let[n,...i]=t;if(n==null){this.endpointsThatEndWithThisNode.push(r);return}(this.isPathParam(n)?this.childPathParam??=new e:this.childPaths[n]??=new e).insert(i,r)}getMatchingEndpoints(t){let[r,...n]=t;if(r==null)return this.endpointsThatEndWithThisNode;let i=[];if(this.isPathParam(r))i.push(...Object.values(this.childPaths).flatMap(o=>o.getMatchingEndpoints(n)));else{let o=this.childPaths[r];o!=null&&i.push(...o.getMatchingEndpoints(n))}return this.childPathParam!=null&&i.push(...this.childPathParam.getMatchingEndpoints(n)),i}isPathParam(t){return t.startsWith("{")&&t.endsWith("}")}};var qYi={name:"no-conflicting-endpoint-paths",create:({workspace:e})=>{let t=new _Dr;return uv(e,(r,n)=>{nB(n,{httpEndpoint:({service:i,endpointId:o,endpoint:s})=>{t.registerEndpoint({service:i,endpointId:o,endpoint:s,relativeFilepath:r})}})}),{definitionFile:{httpEndpoint:({service:r,endpoint:n,endpointId:i},{relativeFilepath:o})=>{let s=t.getConflictingEndpoints({service:r,endpointId:i,endpoint:n,relativeFilepath:o});return s.length===0?[]:[{severity:"warning",message:[`Endpoint path ${Akt({service:r,endpoint:n})} conflicts with other endpoints:`,...s.map(a=>` - ${a.relativeFilepath} -> ${a.endpointId} ${ve.dim(Akt({service:a.service,endpoint:a.endpoint}))}`)].join(`
|
|
2541
2541
|
`)}]}}}}};jt();Xi();var GYi={name:"no-conflicting-request-wrapper-properties",create:({workspace:e})=>({definitionFile:{httpEndpoint:({endpoint:t,service:r},{contents:n,relativeFilepath:i})=>{let o=VPf({endpoint:t,service:r,relativeFilepath:i,definitionFile:n,workspace:e}),s=[];for(let[c,u]of Object.entries(o))u.length<=1||s.push({severity:"fatal",message:`Multiple request properties have the name ${ve.bold(c)}. This is not suitable for code generation. Use the "name" property to deconflict.
|
|
2542
2542
|
`+u.map(l=>` - ${wHa(l)}`).join(`
|
|
2543
2543
|
`)});let a=qPf(o);return s.push(...a),s}}})};function VPf({endpoint:e,service:t,relativeFilepath:r,definitionFile:n,workspace:i}){let o={},s=(a,c)=>{(o[a]??=[]).push(c)};if(e.request!=null&&typeof e.request!="string"&&e.request.body!=null&&!gg(e.request.body)&&oDr({request:e.request,file:mu({relativeFilepath:r,definitionFile:n,casingsGenerator:Jf,rootApiFile:i.definition.rootApiFile.contents}),typeResolver:new af(i)})&&s(ukt,{type:"referenced-body",propertyName:ukt}),t.headers!=null)for(let[a,c]of Object.entries(t.headers))s(kY({headerKey:a,header:c}).name,{type:"service-header",headerKey:a,header:c});if(e.request!=null&&typeof e.request!="string"){if(e.request.headers!=null)for(let[a,c]of Object.entries(e.request.headers))s(kY({headerKey:a,header:c}).name,{type:"endpoint-header",headerKey:a,header:c});if(e.request["query-parameters"]!=null)for(let[a,c]of Object.entries(e.request["query-parameters"]))s(bue({queryParameterKey:a,queryParameter:c}).name,{type:"endpoint-query-parameter",queryParameterKey:a,queryParameter:c});if(e.request.body!=null&&gg(e.request.body)){let a=OU({typeName:void 0,objectDeclaration:{extends:e.request.body.extends,properties:e.request.body.properties??{}},filepathOfDeclaration:r,definitionFile:n,workspace:i,typeResolver:new af(i),smartCasing:!1});for(let c of a)s(c.name,{type:"inlined-body",property:c})}}return o}function wHa(e){switch(e.type){case"service-header":return`Service header "${e.headerKey}"`;case"endpoint-header":return`Endpoint header "${e.headerKey}"`;case"endpoint-query-parameter":return`Query Parameter "${e.queryParameterKey}"`;case"inlined-body":return`Body property: ${dkt({property:e.property,prefixBreadcrumbs:["<Request Body>"]})}`;case"referenced-body":return`Body property "${e.propertyName}"`;default:Ce(e)}}function qPf(e){let t={};for(let[n,i]of Object.entries(e))for(let o of i){let s=ei(n);(t[s]??=[]).push({rawName:n,property:o})}let r=[];for(let[n,i]of Object.entries(t))i.length<=1||new Set(i.map(s=>s.rawName)).size<=1||r.push({severity:"fatal",message:`Multiple request properties resolve to the same generated name ${ve.bold(n)} after camelCase normalization. This causes broken generated code. Use the "name" property to disambiguate.
|
|
2544
2544
|
`+i.map(s=>` - ${wHa(s.property)} (name: "${s.rawName}")`).join(`
|
|
2545
2545
|
`)});return r}var WYi=we(require("path"),1);var $Yi={name:"no-duplicate-declarations",create:({workspace:e,logger:t})=>{let r=GPf(e),n={},i=({declaredName:o,relativeFilepath:s})=>{let a=WYi.default.dirname(s),c=r[a]?.[o];if(c==null)return t.error(`Could not find declarations for name: ${o}. This is an error in the Fern validator.`),[];let u=n[a]??=new Set;if(!u.has(o))return u.add(o),[];let l=c.indexOf(s);return c.filter((d,f)=>f!==l).map(d=>({severity:"fatal",message:`${o} is already declared in ${d===s?"this file":d}`}))};return{definitionFile:{typeName:(o,{relativeFilepath:s})=>i({declaredName:o,relativeFilepath:s}),errorDeclaration:({errorName:o},{relativeFilepath:s})=>i({declaredName:o,relativeFilepath:s}),httpEndpoint:({endpoint:o},{relativeFilepath:s})=>typeof o.request!="string"&&o.request?.name!=null?i({declaredName:o.request.name,relativeFilepath:s}):[]}}}};function GPf(e){let t={};return uv(e,(r,n)=>{let i=WYi.default.dirname(r),o=t[i]??={},s=a=>{(o[a]??=[]).push(r)};nB(n,{typeName:a=>{s(a)},errorDeclaration:({errorName:a})=>{s(a)},httpEndpoint:({endpoint:a})=>{typeof a.request!="string"&&a.request?.name!=null&&s(a.request.name)}})}),t}function ykt(e){let t=new Set,r=new Set,n=[];for(let i of e)t.has(i)&&!r.has(i)&&(r.add(i),n.push(i)),t.add(i);return n}var HYi={name:"no-duplicate-enum-values",create:()=>({definitionFile:{typeDeclaration:({declaration:e})=>wG(e)?ykt(e.enum.map(r=>typeof r=="string"?r:r.value)).map(r=>({severity:"fatal",message:`Duplicated enum value: ${ve.bold(r)}.`})):[]}})};jt();var KYi={name:"no-duplicate-example-names",create:()=>({definitionFile:{typeDeclaration:({declaration:e})=>{if(typeof e=="string"||e.examples==null)return[];let t=e.examples.map(r=>r.name).filter(Fa);return ykt(t).map(r=>({severity:"fatal",message:`Duplicate example name: ${r}`}))},httpEndpoint:({endpoint:e})=>{if(e.examples==null)return[];let t=e.examples.map(r=>r.name).filter(Fa);return ykt(t).map(r=>({severity:"fatal",message:`Duplicate example name: ${r}`}))}}})};Xi();jt();function xHa(e){if(!e.isInlined)return e.name;if(e.location==="inlinedRequest")return"<Inlined Request>";Ce(e.location)}var JYi={name:"no-duplicate-field-names",create:({workspace:e})=>{let t=new af(e);return{definitionFile:{typeDeclaration:({typeName:r,declaration:n},{relativeFilepath:i,contents:o})=>{let s=[];return nv(n,{alias:wk,enum:a=>{let c=SHa(a.enum,u=>JYe(u).name);for(let u of c)s.push({severity:"fatal",message:`Name "${u}" is used by multiple values.`})},object:a=>{let c=xHa(r),u=OU({typeName:c,objectDeclaration:a,filepathOfDeclaration:i,definitionFile:o,workspace:e,typeResolver:t,smartCasing:!1}),l=JAi(u,p=>p.name);for(let[p,d]of Object.entries(l))if(d.length>1){let f=[`Object has multiple properties named "${p}":`,...d.map(m=>` - ${dkt({property:m,prefixBreadcrumbs:[c]})}`)].join(`
|
|
2546
|
-
`);s.push({severity:"fatal",message:f})}},undiscriminatedUnion:()=>[],discriminatedUnion:a=>{let c=SHa(Object.entries(a.union),([u,l])=>$Ye({unionKey:u,rawSingleUnionType:l}).name);for(let u of c)s.push({severity:"fatal",message:`Name ${u} is used by multiple subtypes of this union.`})}}),s}}}}};function SHa(e,t){let r={};for(let n of e){let i=r[t(n)]??0;r[t(n)]=i+1}return Object.entries(r).reduce((n,[i,o])=>(o>1&&n.push(i),n),[])}Xi();var YYi={name:"no-error-status-code-conflict",create:({workspace:e})=>{if(e.definition.rootApiFile.contents["error-discrimination"]?.strategy!=="status-code")return{};let t=WPf(e);return{definitionFile:{httpEndpoint:({endpoint:r})=>{if(r.errors==null)return[];let n={};for(let o of r.errors){let s=typeof o=="string"?o:o.error,a=t[s];if(a==null)continue;let c=a["status-code"];c in n?n[c]?.push(s):n[c]=[s]}let i=[];for(let[o,s]of Object.entries(n))s.length>1&&i.push({severity:"fatal",message:`Multiple errors have status-code ${o}: ${s.join(", ")}`});return i}}}}};function WPf(e){let t={};return uv(e,(r,n)=>{nB(n,{typeName:wk,errorDeclaration:({errorName:i,declaration:o})=>{t[i]=o},httpService:wk})}),t}var XYi={name:"no-extensions-with-file-upload",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>e.request==null?[]:xDe(e.request)?.extends==null?[]:[{severity:"fatal",message:"Request body extensions are not supported for file-upload requests."}]}})};var ZYi={name:"no-get-request-body",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{let t=e.method;return(t==="GET"||t==="HEAD")&&JEi(e)!=null?[{severity:"fatal",message:`Endpoint is a ${t}, so it cannot have a request body.`}]:[]}}})};var eXi={name:"no-missing-auth",create:e=>{let t=e.workspace.definition.rootApiFile.contents.auth!=null;return{definitionFile:{httpService:r=>r.auth&&!t?[{severity:"fatal",message:"Service requires auth, but no auth is defined."}]:[],httpEndpoint:({endpoint:r})=>r.auth!=null&&r.auth&&!t?[{severity:"fatal",message:"Endpoint requires auth, but no auth is defined."}]:[]}}}};Xi();var tXi={name:"no-missing-error-discriminant",create:({workspace:e})=>$Pf(e)?{rootApiFile:{errorDiscrimination:t=>t!=null?[]:[{severity:"fatal",message:"error-discrimination is required because this API has declared errors."}]}}:{}};function $Pf(e){for(let t of Object.values(TAe(e.definition)))if(t.contents.errors!=null&&!YAi(t.contents.errors))return!0;return!1}Xi();var rXi={name:"no-missing-request-name",create:()=>({definitionFile:{httpEndpoint:({endpoint:e,service:t})=>{if(typeof e.request!="string"&&e.request?.name!=null)return[];if(e.request!=null&&typeof e.request!="string"){if(e.request.body!=null&&gg(e.request.body))return[{severity:"fatal",message:"Request name is required because request body is defined inline"}];if(e.request["query-parameters"]!=null&&lh(e.request["query-parameters"])>0)return[{severity:"fatal",message:"Request name is required because request has query parameters"}];if(lh(e.request.headers)>0)return[{severity:"fatal",message:"Request name is required because request has headers"}]}return lh(t.headers)>0?[{severity:"fatal",message:"Request name is required because service has headers"}]:[]}}})};var nXi={name:"no-object-single-property-key",create:({workspace:e})=>{let t=new af(e);return{definitionFile:{typeDeclaration:({declaration:r},{relativeFilepath:n,contents:i})=>{let o=[];if(!v3(r))return o;let s=({discriminantValue:a,singleUnionType:c})=>{let u=typeof c!="string"&&c.key!=null,l=typeof c=="string"?c:c.type;return typeof l!="string"||u?typeof l!="string"&&u?[{severity:"fatal",message:`Union variant ${a} has no type, so "key" cannot be defined`}]:[]:t.resolveType({type:l,file:mu({relativeFilepath:n,definitionFile:i,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents})})==null?[]:[]};for(let[a,c]of Object.entries(r.union))o.push(...s({discriminantValue:a,singleUnionType:c}));return o}}}}};jt();var iXi={name:"no-response-property",create:({workspace:e})=>{let t=new af(e);return{definitionFile:{httpEndpoint:({endpoint:r},{relativeFilepath:n,contents:i})=>{let{response:o}=r;if(o==null)return[];let s=typeof o=="string"?o:o.type;if(s==null)return[];if(Qk(s)!=null)return[];if(SDe(s)!=null)return[];let a=typeof o!="string"?o.property:void 0;if(a==null)return[];let c=mu({relativeFilepath:n,definitionFile:i,rootApiFile:e.definition.rootApiFile.contents,casingsGenerator:Jf}),u=typeof o!="string"?o.type:o;if(u==null)return[];let l=t.resolveTypeOrThrow({type:u,file:c}),p=_Ha(l,a,c,t);return HPf(p,a)}}}}},NY;(function(e){e[e.ContainsProperty=0]="ContainsProperty",e[e.DoesNotContainProperty=1]="DoesNotContainProperty",e[e.IsNotObject=2]="IsNotObject"})(NY||(NY={}));function HPf(e,t){switch(e){case NY.ContainsProperty:return[];case NY.DoesNotContainProperty:return[{severity:"fatal",message:`Response does not have a property named ${t}.`}];case NY.IsNotObject:return[{severity:"fatal",message:"Response must be an object in order to return a property as a response."}]}}function _Ha(e,t,r,n){switch(e._type){case"container":return e.container._type!=="optional"&&e.container._type!=="nullable"?NY.IsNotObject:_Ha(e.container.itemType,t,r,n);case"named":return THa(e.declaration)?KPf(e.declaration,t,r,n)?NY.ContainsProperty:NY.DoesNotContainProperty:NY.IsNotObject;case"primitive":case"unknown":return NY.IsNotObject;default:Ce(e)}}function KPf(e,t,r,n){return BHa(e,r,n).has(t)}function BHa(e,t,r){let n=[];typeof e.extends=="string"?n=[e.extends]:Array.isArray(e.extends)&&(n=e.extends);let i=new Set;for(let o of n)for(let s of JPf(o,t,r))i.add(s);for(let o of Object.keys(e.properties??{}))i.add(o);return i}function JPf(e,t,r){let n=r.resolveNamedTypeOrThrow({referenceToNamedType:e,file:t});return n._type==="named"&&THa(n.declaration)?BHa(n.declaration,t,r):new Set}function THa(e){return e.extends!=null||e.properties!=null}Xt();Xi();var oXi={name:"no-undefined-error-reference",create:({workspace:e})=>{let t=YPf(e);function r(i,o){let s=t[o];return s==null?!1:s.has(i)}let n=(i,o,s)=>{let a=D6({reference:i,referencedIn:o,imports:tp(s.imports??{},De.of)});return a!=null&&r(a.typeName,a.relativeFilepath)?[]:[{severity:"fatal",message:"Error is not defined."}]};return{rootApiFile:{errorReference:(i,{relativeFilepath:o,contents:s})=>n(i,o,s)},definitionFile:{errorReference:(i,{relativeFilepath:o,contents:s})=>n(i,o,s)}}}};function YPf(e){let t={};return uv(e,(r,n)=>{let i=new Set;t[r]=i,nB(n,{errorDeclaration:({errorName:o})=>{i.add(o)}})}),t}var sXi={name:"no-undefined-example-reference",create:({workspace:e})=>{let t=new R6(new af(e));return{definitionFile:{exampleTypeReference:(r,{relativeFilepath:n,contents:i})=>t.parseExampleReference(r)==null?[{severity:"fatal",message:`Example ${ve.bold(r)} is malformed. Examples should be formatted like ${ve.bold("$YourType.ExampleName")}`}]:t.resolveExample({example:r,file:mu({relativeFilepath:n,definitionFile:i,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents})})!=null?[]:[{severity:"fatal",message:`Example ${ve.bold(r)} is not defined.`}]}}}};TAi();var PHa=we(Sm(),1),cXi={name:"no-undefined-path-parameters",create:()=>({rootApiFile:{file:e=>e["base-path"]==null?[]:aXi({path:e["base-path"],pathParameters:e["path-parameters"]??{},pathType:"file"})},definitionFile:{httpService:e=>aXi({path:e["base-path"],pathParameters:e["path-parameters"]??{},pathType:"service"}),httpEndpoint:({endpoint:e})=>aXi({path:e["base-path"]!=null?(0,PHa.default)(e["base-path"],e.path):e.path,pathParameters:T7(e),pathType:"endpoint"})}})};function aXi({path:e,pathParameters:t,pathType:r}){let n=[],i=new Set;ub(e).parts.forEach(u=>{i.has(u.pathParameter)&&n.push({severity:"fatal",message:`${tSt(r)} has duplicate path parameter: ${ve.bold(u.pathParameter)}.`}),i.add(u.pathParameter)});let s=new Set(Object.keys(t));return OHa(i,s).forEach(u=>{n.push({severity:"fatal",message:`${tSt(r)} has missing path-parameter: ${ve.bold(u)}.`})}),OHa(s,i).forEach(u=>{n.push({severity:"fatal",message:`Path parameter is unreferenced in ${r}: ${ve.bold(u)}.`})}),n}function OHa(e,t){return new Set([...e].filter(r=>!t.has(r)))}Xt();Xi();var uXi={name:"no-undefined-type-reference",create:({workspace:e})=>{let t=XPf(e);function r(i){if(i.parsed==null)return!1;let o=t[i.parsed.relativeFilepath];if(o==null)return!1;let s=Jb(i.parsed.typeName);return s!=null?s.name?o.has(s.name):!1:o.has(i.parsed.typeName)}function n(i,o){if(o!=null){let s=[...o];for(;s.length>0;){let a=s.pop(),c=a?typeof a=="string"?Jb(a):Jb(a.key):void 0;if(c!=null)return i.parsed?.typeName&&c.arguments?.includes(i.parsed?.typeName)}}return!1}return{definitionFile:{typeReference:({typeReference:i,location:o,nodePath:s},{relativeFilepath:a,contents:c})=>{let u=Qk(i);if(u!=null){if(o===uS.InlinedRequestProperty)return[];if(o===uS.Response)return u.isOptional?[{severity:"fatal",message:"File response cannot be optional"}]:[]}return I3(i)!=null?o===uS.RequestReference||o===uS.Response?[]:[{severity:"fatal",message:"The bytes type can only be used as a request"}]:Phe(i)?o===uS.StreamingResponse?[]:o===uS.Response?[]:[{severity:"fatal",message:"The text type can only be used as a response or response-stream."}]:ZPf({type:i,relativeFilepath:a,imports:tp(c.imports??{},De.of)}).reduce((d,f)=>(f.parsed?.typeName!=null&&Qk(f.parsed.typeName)!=null?d.push({severity:"fatal",message:"The file type can only be used as properties in inlined requests."}):f.parsed?.typeName!=null&&Phe(f.parsed.typeName)?d.push({severity:"fatal",message:"The text type can only be used as a response-stream or response."}):!r(f)&&!n(f,s)&&d.push({severity:"fatal",message:`Type ${ve.bold(f.parsed?.typeName??f.fullyQualifiedName)} is not defined.`}),d),[])}}}}};function XPf(e){let t={};return uv(e,(r,n)=>{let i=new Set;t[r]=i,nB(n,{typeDeclaration:({typeName:o})=>{if(!o.isInlined){let s=Jb(o.name);s!=null&&s.name&&i.add(s.name),i.add(o.name)}}})}),t}function ZPf({type:e,relativeFilepath:t,imports:r}){return rv({type:e,_default:void 0,validation:void 0,visitor:{primitive:()=>[],unknown:()=>[],map:({keyType:n,valueType:i})=>[...n,...i],list:n=>n,set:n=>n,optional:n=>n,nullable:n=>n,literal:()=>[],named:n=>{let i=D6({reference:n,referencedIn:t,imports:r});return[{fullyQualifiedName:n,parsed:i!=null?{typeName:i.typeName,relativeFilepath:i.relativeFilepath}:void 0}]}}})}var lXi={name:"no-undefined-variable-reference",create:({workspace:e})=>{let t=new O7,r=(n,i)=>n.startsWith(O7.VARIABLE_PREFIX)?t.getDeclaration(n,i)?[]:[{severity:"fatal",message:`Variable ${n} is not defined.`}]:[{severity:"fatal",message:`Variable reference must start with ${O7.VARIABLE_PREFIX}`}];return{rootApiFile:{variableReference:n=>r(n,yue({casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}))},definitionFile:{variableReference:(n,{relativeFilepath:i,contents:o})=>r(n,mu({casingsGenerator:Jf,relativeFilepath:i,definitionFile:o,rootApiFile:e.definition.rootApiFile.contents}))}}}};var pXi={name:"no-unused-generic",create:({workspace:e})=>{let t=new Set;return uv(e,(r,n)=>{nB(n,{typeDeclaration:i=>{nv(i.declaration,{alias:o=>{let s=Jb(typeof o=="string"?o:o.type);if(s!=null&&s.name){let[a,c,...u]=s.name.split("."),l=c??a;l&&t.add(l)}},enum:()=>{},object:()=>{},discriminatedUnion:()=>{},undiscriminatedUnion:()=>{}})}})}),{definitionFile:{typeName:r=>{let n=Jb(r);return n==null?[]:n.name&&t.has(n.name)?[]:[{severity:"fatal",message:`Generic "${r}" is declared but never used.`}]}}}}};var fXi={name:"only-object-extensions",create:({workspace:e})=>{let t=new af(e);return{definitionFile:{extension:(r,{relativeFilepath:n,contents:i})=>{let o=t.resolveNamedType({referenceToNamedType:r,file:mu({relativeFilepath:n,definitionFile:i,rootApiFile:e.definition.rootApiFile.contents,casingsGenerator:Jf})});return o==null?[]:o._type==="named"&&sf(o.declaration)?[]:[{severity:"fatal",message:`Objects can only extend other objects, and ${r} is not an object.`}]}}}}};var dXi={name:"valid-base-path",create:()=>({rootApiFile:{file:e=>e["base-path"]!=null?DHa(e["base-path"]):[]},definitionFile:{httpService:e=>DHa(e["base-path"])}})};function DHa(e){if(e==="/"||e.length===0)return[];let t=[];return e.startsWith("/")||t.push({severity:"fatal",message:"base-path must be empty or start with a slash."}),t}var mXi={name:"valid-default-environment",create:({workspace:e})=>{let t=e.definition.rootApiFile.contents.environments;return{rootApiFile:{defaultEnvironment:r=>r!=null&&(t==null||!Object.keys(t).includes(r))?[{severity:"fatal",message:`The default-environment ${r} is not listed as an environment`}]:[]}}}};var hXi={name:"valid-endpoint-path",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.path==="")return[];let t=[];return e.path.startsWith("/")||t.push({severity:"fatal",message:"Path must start with a slash."}),t}}})};function BDr({allDeclarations:e={},examples:t,parameterDisplayName:r,typeResolver:n,exampleResolver:i,workspace:o,getRawType:s,isAllowMultiple:a,breadcrumbs:c}){let u=[],l=Object.entries(e).reduce((p,[d,f])=>{let m=s(f);if(m!=null){let h=n.resolveType({type:m.rawType,file:m.file});h!=null&&h._type==="container"&&(h.container._type==="optional"||h.container._type==="nullable")||h?._type==="unknown"||p.push(d)}return p},[]);for(let p of l)t?.[p]==null&&u.push({severity:"fatal",message:`Example is missing required ${r} "${p}"`});if(t!=null)for(let[p,d]of Object.entries(t)){let f=e[p];if(f==null)u.push({severity:"fatal",message:`Unexpected ${r} "${p}"`});else{let m=s(f);if(m!=null){let h=a?.(f)&&Array.isArray(d)?d:[d];for(let A of h)u.push(...ZO.validateTypeReferenceExample({rawTypeReference:m.rawType,example:A,file:m.file,workspace:o,typeResolver:n,exampleResolver:i,breadcrumbs:c,depth:0}).map(b=>({severity:b.severity??"fatal",message:b.message})))}}}return u}function RHa({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){let s=[],a=typeof t.request!="string"?t.request?.body:t.request;return a==null?e!=null&&s.push({severity:"fatal",message:"Unexpected request in example."}):gg(a)?s.push(...ZO.validateObjectExample({typeName:void 0,typeNameForBreadcrumb:"<Inlined Request>",rawObject:{"extra-properties":a["extra-properties"],extends:a.extends,properties:a.properties??{}},file:i,typeResolver:r,exampleResolver:n,workspace:o,example:e,breadcrumbs:["request"],depth:0}).map(c=>({severity:c.severity??"fatal",message:c.message}))):s.push(...ZO.validateTypeReferenceExample({rawTypeReference:typeof a=="string"?a:a.type,example:e,file:i,workspace:o,typeResolver:r,exampleResolver:n,breadcrumbs:["response","body"],depth:0}).map(c=>({severity:c.severity??"fatal",message:c.message}))),s}jt();function kHa({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o,errorResolver:s}){return e==null?FHa({example:{},endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o,errorResolver:s}):_De(t,e,{body:a=>FHa({example:a,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o,errorResolver:s}),stream:a=>eDf({example:a,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}),events:a=>tDf({example:a,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o})})}function FHa({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o,errorResolver:s}){let a=[];if(e.error==null)if(t.response!=null){let c=typeof t.response!="string"?t.response.type:t.response;if(c==null)return a;a.push(...ZO.validateTypeReferenceExample({rawTypeReference:c,example:e.body,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:["response","body"],depth:0}).map(u=>({severity:u.severity??"fatal",message:u.message})))}else e.body!=null&&a.push({severity:"fatal",message:`Unexpected response in example. If you're adding an example of an error response, set the "error" property to the error's name`});else{let c=s.getDeclaration(e.error,i);c!=null&&(t.errors!=null&&t.errors.some(l=>(typeof l!="string"?l.error:l)===e.error)||a.push({severity:"fatal",message:`${ve.bold(e.error)} is not specified as an allowed error for this endpoint. Add ${ve.bold(e.error)} to the endpoint's "errors" list.`}),c.declaration.type!=null?a.push(...ZO.validateTypeReferenceExample({rawTypeReference:c.declaration.type,example:e.body,typeResolver:r,exampleResolver:n,file:c.file,workspace:o,breadcrumbs:["response","body"],depth:0}).map(l=>({severity:l.severity??"fatal",message:l.message}))):e.body!=null&&a.push({severity:"fatal",message:`Unexpected response in example. ${ve.bold(e.error)} does not have a body.`}))}return a}function eDf({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){let s=[];if(t["response-stream"]==null)s.push({severity:"fatal",message:"Unexpected streaming response in example. Endpoint's schema is missing `response-stream` key."});else if(typeof t["response-stream"]=="string"||t["response-stream"].format==null||t["response-stream"].format==="json")for(let a of e.stream)s.push(...ZO.validateTypeReferenceExample({rawTypeReference:typeof t["response-stream"]!="string"?t["response-stream"].type:t["response-stream"],example:a,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:["response","body"],depth:0}).map(c=>({severity:c.severity??"fatal",message:c.message})));else s.push({severity:"fatal",message:"Endpoint response expects server-sent events (`response-stream.format: sse`), but the provided example is a regular stream. Use the `events` key to provide an list of server-sent event examples."});return s}function tDf({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){let s=[];if(t["response-stream"]==null)s.push({severity:"fatal",message:"Unexpected streaming response in example. Endpoint's schema is missing `response-stream` key."});else if(typeof t["response-stream"]!="string"&&t["response-stream"].format==="sse"){let a=typeof t["response-stream"]!="string"?t["response-stream"].type:t["response-stream"],c=!1,u,l=r.resolveType({type:a,file:i});if(l?._type==="named"&&v3(l.declaration)){let p=l.declaration.discriminant;typeof p=="object"&&p.context==="protocol"&&(c=!0,u=p.value)}for(let p of e.stream){let d=c&&u!=null&&Lo(p.data)?{[u]:p.event,...p.data}:p.data;s.push(...ZO.validateTypeReferenceExample({rawTypeReference:a,example:d,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:["response","body"],depth:0}).map(f=>({severity:f.severity??"fatal",message:f.message})))}}else s.push({severity:"fatal",message:"Endpoint response expects a regular stream, but the provided example is a server-sent event. Use the `stream` key to provide a list of stream examples."});return s}var gXi={name:"valid-example-endpoint-call",create:({workspace:e})=>{let t=new af(e),r=new FNe(e),n=new R6(t),i=new O7;return{definitionFile:{exampleHeaders:({service:o,endpoint:s,examples:a},{relativeFilepath:c,contents:u})=>BDr({allDeclarations:{...e.definition.rootApiFile.contents.headers,...o.headers,...typeof s.request!="string"?s.request?.headers:void 0},examples:a,parameterDisplayName:"header",typeResolver:t,exampleResolver:n,workspace:e,getRawType:l=>({file:mu({relativeFilepath:c,definitionFile:u,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),rawType:typeof l=="string"?l:l.type}),breadcrumbs:["headers"]}),examplePathParameters:({service:o,endpoint:s,examples:a},{relativeFilepath:c,contents:u})=>BDr({allDeclarations:rDf({workspace:e,service:o,endpoint:s}),examples:a,parameterDisplayName:"path parameter",typeResolver:t,exampleResolver:n,workspace:e,getRawType:l=>mDr({parameter:l,variableResolver:i,file:mu({relativeFilepath:c,definitionFile:u,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents})}),breadcrumbs:["path-parameters"]}),exampleQueryParameters:({endpoint:o,examples:s},{relativeFilepath:a,contents:c})=>BDr({allDeclarations:typeof o.request!="string"?o.request?.["query-parameters"]:void 0,examples:s,parameterDisplayName:"query parameter",typeResolver:t,exampleResolver:n,workspace:e,getRawType:u=>({file:mu({relativeFilepath:a,definitionFile:c,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),rawType:typeof u=="string"?u:u.type}),isAllowMultiple:u=>typeof u!="string"&&u["allow-multiple"]===!0,breadcrumbs:["query-parameters"]}),exampleRequest:({endpoint:o,example:s},{relativeFilepath:a,contents:c})=>RHa({example:s,endpoint:o,typeResolver:t,exampleResolver:n,file:mu({relativeFilepath:a,definitionFile:c,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),workspace:e}),exampleResponse:({endpoint:o,example:s},{relativeFilepath:a,contents:c})=>kHa({example:s,endpoint:o,typeResolver:t,exampleResolver:n,file:mu({relativeFilepath:a,definitionFile:c,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),workspace:e,errorResolver:r})}}}};function rDf({workspace:e,service:t,endpoint:r}){let n=T7(r);return r["base-path"]!=null?{...n}:{...e.definition.rootApiFile.contents["path-parameters"],...t["path-parameters"],...n}}var AXi={name:"valid-example-error",create:({workspace:e})=>{let t=new af(e),r=new R6(t);return{definitionFile:{exampleError:({errorName:n,declaration:i,example:o},{relativeFilepath:s,contents:a})=>i.type==null?[]:ZO.validateTypeReferenceExample({rawTypeReference:i.type,example:o.value,file:mu({relativeFilepath:s,definitionFile:a,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),workspace:e,typeResolver:t,exampleResolver:r,breadcrumbs:["response","body"],depth:0}).map(u=>({severity:"fatal",message:u.message}))}}}};var yXi={name:"valid-example-type",create:({workspace:e})=>{let t=new af(e),r=new R6(t);return{definitionFile:{exampleType:({typeName:n,typeDeclaration:i,example:o},{relativeFilepath:s,contents:a})=>ZO.validateTypeExample({typeName:n,typeDeclaration:i,example:o.value,file:mu({relativeFilepath:s,definitionFile:a,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),typeResolver:t,exampleResolver:r,workspace:e,breadcrumbs:[],depth:0}).map(u=>({severity:"fatal",message:u.message}))}}}};var nDf="https://buildwithfern.com/learn/api-definitions/openapi/extensions/enum-descriptions-and-names";function iDf(e){return typeof e=="string"?e:e.value}function NHa(e,t={hasOpenAPISource:!1}){let r=[];return e.enum.forEach(n=>{let i=JYe(n),o=iDf(n);if(ilr.test(i.name))return;let s=t.hasOpenAPISource?` If your API is defined using OpenAPI, you can use the x-fern-enum extension to specify a valid name: ${nDf}`:"";i.wasExplicitlySet?r.push({severity:"fatal",message:`Enum name ${ve.bold(i.name)} for value ${ve.bold(o)} is not suitable for code generation. It must start with a letter and only contain letters, numbers, and underscores.${s}`}):r.push({severity:"fatal",message:`Enum value ${ve.bold(i.name)} is not suitable for code generation. Add a "name" property that starts with a letter and contains only letters, numbers, and underscores.${s}`})}),r}function QHa(e){let t=[],r=WYe(e);return ilr.test(r.name)||(r.wasExplicitlySet?t.push({severity:"fatal",message:`Discriminant name ${ve.bold(r.name)} is not suitable for code generation. It must start with a letter and only contain letters, numbers, and underscores.`}):t.push({severity:"fatal",message:`Discriminant value ${ve.bold(r.name)} is not suitable for code generation. Add a "name" property that starts with a letter and contains only letters, numbers, and underscores.`})),t}var bXi={name:"valid-field-names",create:e=>{let t=e.workspace.sources.some(r=>r.type==="openapi");return{definitionFile:{typeDeclaration:({declaration:r})=>nv(r,{alias:()=>[],enum:n=>NHa(n,{hasOpenAPISource:t}),object:()=>[],undiscriminatedUnion:()=>[],discriminatedUnion:QHa})}}}};var EXi={name:"valid-generic",create:({workspace:e})=>{let t=oDf(e),r={object:[],discriminatedUnion:[]};return{definitionFile:{typeDeclaration:({typeName:n,declaration:i,nodePath:o})=>{let s=[];return n.isInlined||Jb(n.name)!=null&&(nv(i,{alias:()=>!1,enum:()=>!1,object:()=>!0,discriminatedUnion:()=>!1,undiscriminatedUnion:()=>!1})||s.push({severity:"fatal",message:"Generics are only supported for object declarations"})),nv(i,{alias:a=>{let c=typeof a=="string"?a:a.type,u=Jb(c);if(u!=null){let[l,p,...d]=u.name.split("."),f=p??l;f&&f in t&&t[f]!==u.arguments.length&&s.push({severity:"fatal",message:`Generic ${f} expects ${t[f]} arguments, but received ${u.arguments.length} <${u.arguments.join(",")}>`})}else c in t&&s.push({severity:"fatal",message:`Generic ${c} expects ${t[c]} arguments, but received none`})},enum:a=>{typeof a!="string"&&a.enum.forEach(c=>{let u=typeof c=="string"?c:c.value;p3(u)&&s.push({severity:"fatal",message:`Cannot reference generic ${u} from enum`})})},object:a=>{Object.entries(a?.properties??{}).forEach(([c,u])=>{if(p3(typeof u=="string"?u:u.type))if(o)(r.object??=[]).push({key:c,nodePath:o});else{let l=typeof u=="string"?u:JSON.stringify(u);s.push({severity:"fatal",message:`Cannot reference generic ${l} from object property ${c}`})}})},discriminatedUnion:a=>{Object.entries(a.union).forEach(([c,u])=>{let l=typeof u=="string"?u:typeof u.type=="string"?u.type:void 0;if(l&&p3(l))if(o)(r.discriminatedUnion??=[]).push({key:c,nodePath:o});else{let p=typeof u=="string"?u:JSON.stringify(u);s.push({severity:"fatal",message:`Cannot reference generic ${p} from union property ${c}`})}})},undiscriminatedUnion:a=>{a.union.forEach(c=>{let u=typeof c=="string"?c:c.type;p3(u)&&s.push({severity:"fatal",message:`Cannot reference generic ${u} from union`})})}}),s},typeReference:({typeReference:n,nodePath:i})=>{let o=[];if(i)for(let s of Object.keys(r))for(let{key:a,nodePath:c}of r[s])c.length>0&&i.join(",").startsWith(c.join(","))&&i.includes(a)&&o.push({severity:"fatal",message:`Cannot reference generic ${n} from ${s.toLowerCase().includes("union")?"union":s}`});return o}}}}};function oDf(e){let t={};return uv(e,(r,n)=>{nB(n,{typeDeclaration:({typeName:i,declaration:o})=>{if(!i.isInlined){let s=Jb(i.name);s!=null&&nv(o,{alias:()=>{},enum:()=>{},object:()=>{s.name&&s.arguments&&(t[s.name]=s.arguments.length)},discriminatedUnion:()=>{},undiscriminatedUnion:()=>{}})}}})}),t}jt();Xt();var jHa=we(require("path"),1),IXi={name:"valid-navigation",create:({workspace:e})=>{let t=UT(Dae(e.definition)),n=UT(TAe(e.definition)).reduce((i,o)=>((i[Sn(o)]??=new Set).add(jHa.default.basename(o)),i),{});return{packageMarker:{navigation:(i,{relativeFilepath:o})=>{if(i==null)return[];if(typeof i=="string"){let u=Hs(e.definition.absoluteFilePath,Ye(e.definition.absoluteFilePath,Sn(o),De.of(i)));return t.some(l=>l.startsWith(u))?[]:[{severity:"fatal",message:`${i} does not exist.`}]}let s=n[Sn(o)];if(s==null)throw new N({message:`Could not find expected contents of ${o}`,code:N.Code.InternalError});let a=[],c=new Set;for(let u of i)u===Rf?a.push({severity:"fatal",message:`${Rf} cannot be specified in navigation.`}):s.has(u)?c.has(u)&&a.push({severity:"fatal",message:`${u} is specified more than once.`}):a.push({severity:"fatal",message:`Unexpected item: ${u}`}),c.add(u);for(let u of s)c.has(u)||a.push({severity:"fatal",message:`Missing ${u}`});return a}}}}};var bkt="$request.",vXi="$response.";function eXe({typeResolver:e,file:t,endpoint:r,propertyComponents:n,validate:i}){if(r.request==null)return!1;if(typeof r.request=="string"){let o=e.resolveType({type:r.request,file:t});return sF({typeResolver:e,file:ly(o)??t,resolvedType:o,propertyComponents:n,validate:i})}return sDf({typeResolver:e,file:t,requestType:r.request,propertyComponents:n,validate:i})}function sDf({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}){if(aDf({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}))return!0;if(r.body==null)return!1;if(typeof r.body=="string"){let s=e.resolveType({type:r.body,file:t});return sF({typeResolver:e,file:ly(s)??t,resolvedType:s,propertyComponents:n,validate:i})}if(gg(r.body))return MHa({typeResolver:e,file:t,objectSchema:r.body,propertyComponents:n,validate:i});let o=e.resolveType({type:r.body.type,file:t});return sF({typeResolver:e,file:ly(o)??t,resolvedType:e.resolveType({type:r.body.type,file:t}),propertyComponents:n,validate:i})}function aDf({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}){if(n.length!==1||typeof r=="string"||r["query-parameters"]==null)return!1;let o=r["query-parameters"][n[0]??""];if(o==null)return!1;let s=e.resolveType({type:typeof o!="string"?o.type:o,file:t});return i({resolvedType:s})}function sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:i}){if(n.length===0)return i({resolvedType:r});let o=UHa(r);return o==null?!1:MHa({typeResolver:e,file:t,objectSchema:o,propertyComponents:n,validate:i})}function TN({endpoint:e,typeResolver:t,file:r}){let n=typeof e.response!="string"?e.response?.type:e.response;if(n!=null)return t.resolveType({type:n,file:r})}function aF(e){if(e?._type==="primitive")return e.primitive.v1;if(e?._type==="container"&&(e.container._type==="optional"||e.container._type==="nullable"))return aF(e.container.itemType)}function ly(e){if(e!=null){if(e._type==="named")return e.file;if(e._type==="container"&&(e.container._type==="optional"||e.container._type==="nullable"))return ly(e.container.itemType)}}function tXe(e){return zHa(e,bkt)?.split(".")}function TDr(e){return zHa(e,vXi)?.split(".")}function MHa({typeResolver:e,file:t,objectSchema:r,propertyComponents:n,validate:i}){let o=cDf({typeResolver:e,file:t,objectSchema:r,property:n[0]??""});if(o==null)return!1;let s=e.resolveType({type:o,file:t});return sF({typeResolver:e,file:ly(s)??t,resolvedType:s,propertyComponents:n.slice(1),validate:i})}function cDf({typeResolver:e,file:t,objectSchema:r,property:n}){return LHa({typeResolver:e,file:t,objectSchema:r})[n]}function LHa({typeResolver:e,file:t,objectSchema:r}){let n=[];typeof r.extends=="string"?n=[r.extends]:Array.isArray(r.extends)&&(n=r.extends);let i={};for(let o of n){let s=uDf({typeResolver:e,file:t,extendedType:o});Object.entries(s).map(([a,c])=>{i[a]=c})}return r.properties!=null&&Object.entries(r.properties).map(([o,s])=>{i[o]=typeof s=="string"?s:s.type}),i}function uDf({typeResolver:e,file:t,extendedType:r}){let n=e.resolveNamedTypeOrThrow({referenceToNamedType:r,file:t});return n._type==="named"&&sf(n.declaration)?LHa({typeResolver:e,file:ly(n)??t,objectSchema:n.declaration}):{}}function UHa(e){if(e!=null){if(e._type==="named"&&sf(e.declaration))return e.declaration;if(e._type==="container"&&(e.container._type==="optional"||e.container._type==="nullable"))return UHa(e.container.itemType)}}function zHa(e,t){return e.startsWith(t)?e.substring(t.length):null}var CXi=`${bkt}client_id`,wXi=`${bkt}client_secret`,rXe=`${vXi}access_token`,xXi=`${bkt}refresh_token`;function SXi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:i}){return DDr({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"client-id",validate:Ekt}})}function _Xi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:i}){return DDr({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"client-secret",validate:Ekt}})}function VHa({endpointId:e,endpoint:t,typeResolver:r,file:n,scopesProperty:i}){return DDr({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"scopes",validate:Ekt}})}function BXi({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:i}){return DDr({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"refresh-token",validate:Ekt}})}function nXe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,accessTokenProperty:i}){return TXi({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"access-token",validate:qHa}})}function ODr({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,refreshTokenProperty:i}){return TXi({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"refresh-token",validate:qHa}})}function PDr({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,expiresInProperty:i}){return TXi({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"expires-in",validate:lDf}})}function lDf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:pDf})}function qHa({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:Ekt})}function DDr({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:o}){let s=[],a=tXe(i);return a==null?(s.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} must define a dot-delimited '${o.propertyID}' property starting with $request (e.g. $request.${o.propertyID}).`}),s):a.length>1?(s.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} cannot reference nested $request properties like '${i}'; expected '$request.${o.propertyID}' instead.`}),s):(eXe({typeResolver:r,file:n,endpoint:t,propertyComponents:a,validate:o.validate})||s.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} specifies '${o.propertyID}' ${i}, which is not a valid '${o.propertyID}' type.`}),s)}function TXi({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:o}){let s=[],a=TDr(i);return a==null&&s.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} must define a dot-delimited '${o.propertyID}' property starting with $response (e.g. $response.${o.propertyID}).`}),a!=null&&!o.validate({typeResolver:t,file:r,resolvedType:n,propertyComponents:a})&&s.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} specifies '${o.propertyID}' ${i}, which is not a valid '${o.propertyID}' type.`}),s}function pDf({resolvedType:e}){return aF(e)==="INTEGER"}function Ekt({resolvedType:e}){return aF(e)==="STRING"}function GHa({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshEndpoint:i}){let o=[],s=i["request-properties"]?.["refresh-token"];s!=null?o.push(...BXi({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:s})):BXi({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:xXi}).length>0&&o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} is missing a valid refresh-token, such as '${xXi}'.`});let a=TN({endpoint:t,typeResolver:r,file:n});if(a==null)return o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} must define a response type.`}),o;let c=i["response-properties"]?.["access-token"];c!=null?o.push(...nXe({endpointId:e,typeResolver:r,file:n,resolvedResponseType:a,accessTokenProperty:c})):nXe({endpointId:e,typeResolver:r,file:n,resolvedResponseType:a,accessTokenProperty:rXe}).length>0&&o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} is missing a valid access-token, such as '${rXe}'.`});let u=i?.["response-properties"]?.["expires-in"];u!=null&&o.push(...PDr({endpointId:e,typeResolver:r,file:ly(a)??n,resolvedResponseType:a,expiresInProperty:u}));let l=i?.["response-properties"]?.["refresh-token"];return l!=null&&o.push(...ODr({endpointId:e,typeResolver:r,file:ly(a)??n,resolvedResponseType:a,refreshTokenProperty:l})),o}function WHa({endpointId:e,endpoint:t,typeResolver:r,file:n,tokenEndpoint:i}){let o=[],s=i["request-properties"]?.["client-id"];s!=null?o.push(...SXi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:s})):SXi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:CXi}).length>0&&o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} is missing a valid client-id, such as '${CXi}'.`});let a=i["request-properties"]?.["client-secret"];a!=null?o.push(..._Xi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:a})):_Xi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:wXi}).length>0&&o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} is missing a valid client-secret, such as '${wXi}'.`});let c=i?.["request-properties"]?.scopes;c!=null&&o.push(...VHa({endpointId:e,endpoint:t,typeResolver:r,file:n,scopesProperty:c}));let u=TN({endpoint:t,typeResolver:r,file:n});if(u==null)return o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} must define a response type.`}),o;let l=i["response-properties"]?.["access-token"];l!=null?o.push(...nXe({endpointId:e,typeResolver:r,file:n,resolvedResponseType:u,accessTokenProperty:l})):nXe({endpointId:e,typeResolver:r,file:n,resolvedResponseType:u,accessTokenProperty:rXe}).length>0&&o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} is missing a valid access-token, such as '${rXe}'.`});let p=i?.["response-properties"]?.["expires-in"];p!=null&&o.push(...PDr({endpointId:e,typeResolver:r,file:ly(u)??n,resolvedResponseType:u,expiresInProperty:p}));let d=i?.["response-properties"]?.["refresh-token"];return d!=null&&o.push(...ODr({endpointId:e,typeResolver:r,file:ly(u)??n,resolvedResponseType:u,refreshTokenProperty:d})),o}var OXi={name:"valid-oauth",create:({workspace:e})=>{let t=new af(e),r=new RNe(e),n=yue({casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents});return{rootApiFile:{oauth:({name:i,oauth:o},{relativeFilepath:s})=>{let a=[],c=o["get-token"].endpoint,u=r.resolveEndpoint({endpoint:c,file:n});u==null?a.push({severity:"fatal",message:`Failed to resolve endpoint ${c}`}):a.push(...WHa({endpointId:u.endpointId,endpoint:u.endpoint,typeResolver:t,file:u.file,tokenEndpoint:o["get-token"]}));let l=o["refresh-token"]?.endpoint;if(o["refresh-token"]!=null&&l!=null){let p=r.resolveEndpoint({endpoint:l,file:n});p==null?a.push({severity:"fatal",message:`Failed to resolve endpoint ${c}`}):a.push(...GHa({endpointId:p.endpointId,endpoint:p.endpoint,typeResolver:t,file:p.file,refreshEndpoint:o["refresh-token"]}))}return a}}}}};function QY({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,resultsProperty:i}){return NNe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"results",validate:fDf}})}function Ikt({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:o}){let s=[],a=tXe(i);return a==null?(s.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a dot-delimited '${o.propertyID}' property starting with $request (e.g. $request.${o.propertyID}).`}),s):(eXe({typeResolver:r,file:n,endpoint:t,propertyComponents:a,validate:o.validate})||s.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} specifies '${o.propertyID}' ${i}, which is not a valid '${o.propertyID}' type.`}),s)}function NNe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:o}){let s=[],a=TDr(i);return a==null&&s.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a dot-delimited '${o.propertyID}' property starting with $response (e.g. $response.${o.propertyID}).`}),a!=null&&!o.validate({typeResolver:t,file:r,resolvedType:n,propertyComponents:a})&&s.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} specifies '${o.propertyID}' ${i}, which is not a valid '${o.propertyID}' type.`}),s}function fDf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:dDf})}function dDf({resolvedType:e}){return!0}function $Ha({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}){let o=[];o.push(...mDf({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}));let s=TN({endpoint:t,typeResolver:r,file:n});return s==null?(o.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a response type.`}),o):(o.push(...hDf({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,nextProperty:i.next_cursor})),o.push(...QY({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,resultsProperty:i.results})),o)}function mDf({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}){return Ikt({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.cursor,propertyValidator:{propertyID:"cursor",validate:HHa}})}function hDf({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,nextProperty:i}){return NNe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"next_cursor",validate:gDf}})}function gDf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:HHa})}function HHa({resolvedType:e}){let t=aF(e);return t==null?!1:t!=="BOOLEAN"}function KHa({endpointId:e,endpoint:t,typeResolver:r,file:n,customPagination:i}){let o=[],s=TN({endpoint:t,typeResolver:r,file:n});return s==null?(o.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a response type.`}),o):(o.push(...QY({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,resultsProperty:i.results})),o)}function JHa(e){return e.split(".").slice(1)}function YHa({path:e,typeResolver:t,file:r,resolvedType:n,validate:i}){let o=n;for(let s of e){if(o==null)return i({resolvedType:void 0});let a=eKa(o);if(a==null)return i({resolvedType:void 0});let u=XHa({typeResolver:t,file:r,objectSchema:a})[s];if(u==null)return i({resolvedType:void 0});o=t.resolveType({type:u,file:r})}return i({resolvedType:o})}function XHa({typeResolver:e,file:t,objectSchema:r}){let n=[];typeof r.extends=="string"?n=[r.extends]:Array.isArray(r.extends)&&(n=r.extends);let i={};for(let o of n){let s=ADf({typeResolver:e,file:t,extendedType:o});Object.entries(s).map(([a,c])=>{i[a]=c})}return r.properties!=null&&Object.entries(r.properties).map(([o,s])=>{i[o]=typeof s=="string"?s:s.type}),i}function ADf({typeResolver:e,file:t,extendedType:r}){let n=e.resolveNamedTypeOrThrow({referenceToNamedType:r,file:t});return n._type==="named"&&sf(n.declaration)?XHa({typeResolver:e,file:ZHa(n)??t,objectSchema:n.declaration}):{}}function ZHa(e){if(e!=null){if(e._type==="named")return e.file;if(e._type==="container"&&(e.container._type==="optional"||e.container._type==="nullable"))return ZHa(e.container.itemType)}}function eKa(e){if(e!=null){if(e._type==="named"&&sf(e.declaration))return e.declaration;if(e._type==="container"&&(e.container._type==="optional"||e.container._type==="nullable"))return eKa(e.container.itemType)}}function tKa({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){let o=[];o.push(...yDf({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i})),o.push(...bDf({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}));let s=TN({endpoint:t,typeResolver:r,file:n});return s==null?(o.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a response type.`}),o):(o.push(...QY({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,resultsProperty:i.results})),o.push(...EDf({endpointId:e,resolvedResponseType:s,typeResolver:r,file:ly(s)??n,offsetPagination:i})),o)}function yDf({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){return Ikt({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.offset,propertyValidator:{propertyID:"offset",validate:rKa}})}function bDf({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){return i.step==null?[]:Ikt({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.step,propertyValidator:{propertyID:"step",validate:rKa}})}function rKa({resolvedType:e}){let t=aF(e);return t==null?!1:t==="INTEGER"||t==="LONG"||t==="DOUBLE"}function EDf({resolvedResponseType:e,typeResolver:t,file:r,offsetPagination:n}){return n["has-next-page"]==null?[]:YHa({typeResolver:t,file:r,path:JHa(n["has-next-page"]),resolvedType:e,validate:({resolvedType:i})=>aF(i)!=="BOOLEAN"?[{message:`"has-next-page" selector, ${n["has-next-page"]}, does not point to a boolean property`,severity:"fatal"}]:[]})}function nKa({endpointId:e,endpoint:t,typeResolver:r,file:n,pathPagination:i}){let o=[],s=TN({endpoint:t,typeResolver:r,file:n});return s==null?(o.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a response type.`}),o):(o.push(...IDf({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,nextProperty:i.next_path})),o.push(...QY({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,resultsProperty:i.results})),o)}function IDf({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,nextProperty:i}){return NNe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"next_path",validate:vDf}})}function vDf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:CDf})}function CDf({resolvedType:e}){return aF(e)==="STRING"}function iKa({endpointId:e,endpoint:t,typeResolver:r,file:n,uriPagination:i}){let o=[],s=TN({endpoint:t,typeResolver:r,file:n});return s==null?(o.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a response type.`}),o):(o.push(...wDf({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,nextProperty:i.next_uri})),o.push(...QY({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,resultsProperty:i.results})),o)}function wDf({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,nextProperty:i}){return NNe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"next_uri",validate:xDf}})}function xDf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:SDf})}function SDf({resolvedType:e}){return aF(e)==="STRING"}var PXi={name:"valid-pagination",create:({workspace:e})=>{let t=new af(e),r=e.definition.rootApiFile.contents.pagination;return{definitionFile:{httpEndpoint:({endpointId:n,endpoint:i},{relativeFilepath:o,contents:s})=>{let a=typeof i.pagination=="boolean"?r:i.pagination;if(!a)return[];let c=mu({relativeFilepath:o,definitionFile:s,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents});if(BDf(a))return $Ha({endpointId:n,endpoint:i,typeResolver:t,file:c,cursorPagination:a});if(_Df(a))return tKa({endpointId:n,endpoint:i,typeResolver:t,file:c,offsetPagination:a});if(TDf(a))return KHa({endpointId:n,endpoint:i,typeResolver:t,file:c,customPagination:a});if(lDr(a))return iKa({endpointId:n,endpoint:i,typeResolver:t,file:c,uriPagination:a});if(pDr(a))return nKa({endpointId:n,endpoint:i,typeResolver:t,file:c,pathPagination:a});throw new N({message:"Invalid pagination schema",code:N.Code.ValidationError})}}}}};function _Df(e){return e.offset!=null}function BDf(e){return e.cursor!=null&&e.next_cursor!=null&&e.results!=null}function TDf(e){return"type"in e&&e.type==="custom"}var DXi={name:"valid-path-parameters-configuration",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>e["path-parameters"]!=null&&typeof e.request!="string"&&e?.request?.["path-parameters"]!=null?[{severity:"fatal",message:"path-parameters cannot be defined in both endpoint and request."}]:[]}})};var RXi={name:"valid-service-urls",create:({workspace:e})=>{let t=xDr(e),r=n=>t.includes(n)?[]:t.length===0&&e.definition.rootApiFile.contents?.["default-url"]!=null?[]:t.length===0?[{severity:"fatal",message:`"url" cannot be configured unless you specify multiple URLs for each environment in ${nI}`}]:[{severity:"fatal",message:[`URL ${ve.bold(n)} is not recognized. Please add it to your environments in ${nI} or specify one of the configured environment URLs:`,...t.map(i=>` - ${i}`)].join(`
|
|
2546
|
+
`);s.push({severity:"fatal",message:f})}},undiscriminatedUnion:()=>[],discriminatedUnion:a=>{let c=SHa(Object.entries(a.union),([u,l])=>$Ye({unionKey:u,rawSingleUnionType:l}).name);for(let u of c)s.push({severity:"fatal",message:`Name ${u} is used by multiple subtypes of this union.`})}}),s}}}}};function SHa(e,t){let r={};for(let n of e){let i=r[t(n)]??0;r[t(n)]=i+1}return Object.entries(r).reduce((n,[i,o])=>(o>1&&n.push(i),n),[])}Xi();var YYi={name:"no-error-status-code-conflict",create:({workspace:e})=>{if(e.definition.rootApiFile.contents["error-discrimination"]?.strategy!=="status-code")return{};let t=WPf(e);return{definitionFile:{httpEndpoint:({endpoint:r})=>{if(r.errors==null)return[];let n={};for(let o of r.errors){let s=typeof o=="string"?o:o.error,a=t[s];if(a==null)continue;let c=a["status-code"];c in n?n[c]?.push(s):n[c]=[s]}let i=[];for(let[o,s]of Object.entries(n))s.length>1&&i.push({severity:"fatal",message:`Multiple errors have status-code ${o}: ${s.join(", ")}`});return i}}}}};function WPf(e){let t={};return uv(e,(r,n)=>{nB(n,{typeName:wk,errorDeclaration:({errorName:i,declaration:o})=>{t[i]=o},httpService:wk})}),t}var XYi={name:"no-extensions-with-file-upload",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>e.request==null?[]:xDe(e.request)?.extends==null?[]:[{severity:"fatal",message:"Request body extensions are not supported for file-upload requests."}]}})};var ZYi={name:"no-get-request-body",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{let t=e.method;return(t==="GET"||t==="HEAD")&&JEi(e)!=null?[{severity:"fatal",message:`Endpoint is a ${t}, so it cannot have a request body.`}]:[]}}})};var eXi={name:"no-missing-auth",create:e=>{let t=e.workspace.definition.rootApiFile.contents.auth!=null;return{definitionFile:{httpService:r=>(r.auth??t)&&!t?[{severity:"fatal",message:"Service requires auth, but no auth is defined."}]:[],httpEndpoint:({endpoint:r})=>r.auth!=null&&r.auth&&!t?[{severity:"fatal",message:"Endpoint requires auth, but no auth is defined."}]:[]}}}};Xi();var tXi={name:"no-missing-error-discriminant",create:({workspace:e})=>$Pf(e)?{rootApiFile:{errorDiscrimination:t=>t!=null?[]:[{severity:"fatal",message:"error-discrimination is required because this API has declared errors."}]}}:{}};function $Pf(e){for(let t of Object.values(TAe(e.definition)))if(t.contents.errors!=null&&!YAi(t.contents.errors))return!0;return!1}Xi();var rXi={name:"no-missing-request-name",create:()=>({definitionFile:{httpEndpoint:({endpoint:e,service:t})=>{if(typeof e.request!="string"&&e.request?.name!=null)return[];if(e.request!=null&&typeof e.request!="string"){if(e.request.body!=null&&gg(e.request.body))return[{severity:"fatal",message:"Request name is required because request body is defined inline"}];if(e.request["query-parameters"]!=null&&lh(e.request["query-parameters"])>0)return[{severity:"fatal",message:"Request name is required because request has query parameters"}];if(lh(e.request.headers)>0)return[{severity:"fatal",message:"Request name is required because request has headers"}]}return lh(t.headers)>0?[{severity:"fatal",message:"Request name is required because service has headers"}]:[]}}})};var nXi={name:"no-object-single-property-key",create:({workspace:e})=>{let t=new af(e);return{definitionFile:{typeDeclaration:({declaration:r},{relativeFilepath:n,contents:i})=>{let o=[];if(!v3(r))return o;let s=({discriminantValue:a,singleUnionType:c})=>{let u=typeof c!="string"&&c.key!=null,l=typeof c=="string"?c:c.type;return typeof l!="string"||u?typeof l!="string"&&u?[{severity:"fatal",message:`Union variant ${a} has no type, so "key" cannot be defined`}]:[]:t.resolveType({type:l,file:mu({relativeFilepath:n,definitionFile:i,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents})})==null?[]:[]};for(let[a,c]of Object.entries(r.union))o.push(...s({discriminantValue:a,singleUnionType:c}));return o}}}}};jt();var iXi={name:"no-response-property",create:({workspace:e})=>{let t=new af(e);return{definitionFile:{httpEndpoint:({endpoint:r},{relativeFilepath:n,contents:i})=>{let{response:o}=r;if(o==null)return[];let s=typeof o=="string"?o:o.type;if(s==null)return[];if(Qk(s)!=null)return[];if(SDe(s)!=null)return[];let a=typeof o!="string"?o.property:void 0;if(a==null)return[];let c=mu({relativeFilepath:n,definitionFile:i,rootApiFile:e.definition.rootApiFile.contents,casingsGenerator:Jf}),u=typeof o!="string"?o.type:o;if(u==null)return[];let l=t.resolveTypeOrThrow({type:u,file:c}),p=_Ha(l,a,c,t);return HPf(p,a)}}}}},NY;(function(e){e[e.ContainsProperty=0]="ContainsProperty",e[e.DoesNotContainProperty=1]="DoesNotContainProperty",e[e.IsNotObject=2]="IsNotObject"})(NY||(NY={}));function HPf(e,t){switch(e){case NY.ContainsProperty:return[];case NY.DoesNotContainProperty:return[{severity:"fatal",message:`Response does not have a property named ${t}.`}];case NY.IsNotObject:return[{severity:"fatal",message:"Response must be an object in order to return a property as a response."}]}}function _Ha(e,t,r,n){switch(e._type){case"container":return e.container._type!=="optional"&&e.container._type!=="nullable"?NY.IsNotObject:_Ha(e.container.itemType,t,r,n);case"named":return THa(e.declaration)?KPf(e.declaration,t,r,n)?NY.ContainsProperty:NY.DoesNotContainProperty:NY.IsNotObject;case"primitive":case"unknown":return NY.IsNotObject;default:Ce(e)}}function KPf(e,t,r,n){return BHa(e,r,n).has(t)}function BHa(e,t,r){let n=[];typeof e.extends=="string"?n=[e.extends]:Array.isArray(e.extends)&&(n=e.extends);let i=new Set;for(let o of n)for(let s of JPf(o,t,r))i.add(s);for(let o of Object.keys(e.properties??{}))i.add(o);return i}function JPf(e,t,r){let n=r.resolveNamedTypeOrThrow({referenceToNamedType:e,file:t});return n._type==="named"&&THa(n.declaration)?BHa(n.declaration,t,r):new Set}function THa(e){return e.extends!=null||e.properties!=null}Xt();Xi();var oXi={name:"no-undefined-error-reference",create:({workspace:e})=>{let t=YPf(e);function r(i,o){let s=t[o];return s==null?!1:s.has(i)}let n=(i,o,s)=>{let a=D6({reference:i,referencedIn:o,imports:tp(s.imports??{},De.of)});return a!=null&&r(a.typeName,a.relativeFilepath)?[]:[{severity:"fatal",message:"Error is not defined."}]};return{rootApiFile:{errorReference:(i,{relativeFilepath:o,contents:s})=>n(i,o,s)},definitionFile:{errorReference:(i,{relativeFilepath:o,contents:s})=>n(i,o,s)}}}};function YPf(e){let t={};return uv(e,(r,n)=>{let i=new Set;t[r]=i,nB(n,{errorDeclaration:({errorName:o})=>{i.add(o)}})}),t}var sXi={name:"no-undefined-example-reference",create:({workspace:e})=>{let t=new R6(new af(e));return{definitionFile:{exampleTypeReference:(r,{relativeFilepath:n,contents:i})=>t.parseExampleReference(r)==null?[{severity:"fatal",message:`Example ${ve.bold(r)} is malformed. Examples should be formatted like ${ve.bold("$YourType.ExampleName")}`}]:t.resolveExample({example:r,file:mu({relativeFilepath:n,definitionFile:i,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents})})!=null?[]:[{severity:"fatal",message:`Example ${ve.bold(r)} is not defined.`}]}}}};TAi();var PHa=we(Sm(),1),cXi={name:"no-undefined-path-parameters",create:()=>({rootApiFile:{file:e=>e["base-path"]==null?[]:aXi({path:e["base-path"],pathParameters:e["path-parameters"]??{},pathType:"file"})},definitionFile:{httpService:e=>aXi({path:e["base-path"],pathParameters:e["path-parameters"]??{},pathType:"service"}),httpEndpoint:({endpoint:e})=>aXi({path:e["base-path"]!=null?(0,PHa.default)(e["base-path"],e.path):e.path,pathParameters:T7(e),pathType:"endpoint"})}})};function aXi({path:e,pathParameters:t,pathType:r}){let n=[],i=new Set;ub(e).parts.forEach(u=>{i.has(u.pathParameter)&&n.push({severity:"fatal",message:`${tSt(r)} has duplicate path parameter: ${ve.bold(u.pathParameter)}.`}),i.add(u.pathParameter)});let s=new Set(Object.keys(t));return OHa(i,s).forEach(u=>{n.push({severity:"fatal",message:`${tSt(r)} has missing path-parameter: ${ve.bold(u)}.`})}),OHa(s,i).forEach(u=>{n.push({severity:"fatal",message:`Path parameter is unreferenced in ${r}: ${ve.bold(u)}.`})}),n}function OHa(e,t){return new Set([...e].filter(r=>!t.has(r)))}Xt();Xi();var uXi={name:"no-undefined-type-reference",create:({workspace:e})=>{let t=XPf(e);function r(i){if(i.parsed==null)return!1;let o=t[i.parsed.relativeFilepath];if(o==null)return!1;let s=Jb(i.parsed.typeName);return s!=null?s.name?o.has(s.name):!1:o.has(i.parsed.typeName)}function n(i,o){if(o!=null){let s=[...o];for(;s.length>0;){let a=s.pop(),c=a?typeof a=="string"?Jb(a):Jb(a.key):void 0;if(c!=null)return i.parsed?.typeName&&c.arguments?.includes(i.parsed?.typeName)}}return!1}return{definitionFile:{typeReference:({typeReference:i,location:o,nodePath:s},{relativeFilepath:a,contents:c})=>{let u=Qk(i);if(u!=null){if(o===uS.InlinedRequestProperty)return[];if(o===uS.Response)return u.isOptional?[{severity:"fatal",message:"File response cannot be optional"}]:[]}return I3(i)!=null?o===uS.RequestReference||o===uS.Response?[]:[{severity:"fatal",message:"The bytes type can only be used as a request"}]:Phe(i)?o===uS.StreamingResponse?[]:o===uS.Response?[]:[{severity:"fatal",message:"The text type can only be used as a response or response-stream."}]:ZPf({type:i,relativeFilepath:a,imports:tp(c.imports??{},De.of)}).reduce((d,f)=>(f.parsed?.typeName!=null&&Qk(f.parsed.typeName)!=null?d.push({severity:"fatal",message:"The file type can only be used as properties in inlined requests."}):f.parsed?.typeName!=null&&Phe(f.parsed.typeName)?d.push({severity:"fatal",message:"The text type can only be used as a response-stream or response."}):!r(f)&&!n(f,s)&&d.push({severity:"fatal",message:`Type ${ve.bold(f.parsed?.typeName??f.fullyQualifiedName)} is not defined.`}),d),[])}}}}};function XPf(e){let t={};return uv(e,(r,n)=>{let i=new Set;t[r]=i,nB(n,{typeDeclaration:({typeName:o})=>{if(!o.isInlined){let s=Jb(o.name);s!=null&&s.name&&i.add(s.name),i.add(o.name)}}})}),t}function ZPf({type:e,relativeFilepath:t,imports:r}){return rv({type:e,_default:void 0,validation:void 0,visitor:{primitive:()=>[],unknown:()=>[],map:({keyType:n,valueType:i})=>[...n,...i],list:n=>n,set:n=>n,optional:n=>n,nullable:n=>n,literal:()=>[],named:n=>{let i=D6({reference:n,referencedIn:t,imports:r});return[{fullyQualifiedName:n,parsed:i!=null?{typeName:i.typeName,relativeFilepath:i.relativeFilepath}:void 0}]}}})}var lXi={name:"no-undefined-variable-reference",create:({workspace:e})=>{let t=new O7,r=(n,i)=>n.startsWith(O7.VARIABLE_PREFIX)?t.getDeclaration(n,i)?[]:[{severity:"fatal",message:`Variable ${n} is not defined.`}]:[{severity:"fatal",message:`Variable reference must start with ${O7.VARIABLE_PREFIX}`}];return{rootApiFile:{variableReference:n=>r(n,yue({casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}))},definitionFile:{variableReference:(n,{relativeFilepath:i,contents:o})=>r(n,mu({casingsGenerator:Jf,relativeFilepath:i,definitionFile:o,rootApiFile:e.definition.rootApiFile.contents}))}}}};var pXi={name:"no-unused-generic",create:({workspace:e})=>{let t=new Set;return uv(e,(r,n)=>{nB(n,{typeDeclaration:i=>{nv(i.declaration,{alias:o=>{let s=Jb(typeof o=="string"?o:o.type);if(s!=null&&s.name){let[a,c,...u]=s.name.split("."),l=c??a;l&&t.add(l)}},enum:()=>{},object:()=>{},discriminatedUnion:()=>{},undiscriminatedUnion:()=>{}})}})}),{definitionFile:{typeName:r=>{let n=Jb(r);return n==null?[]:n.name&&t.has(n.name)?[]:[{severity:"fatal",message:`Generic "${r}" is declared but never used.`}]}}}}};var fXi={name:"only-object-extensions",create:({workspace:e})=>{let t=new af(e);return{definitionFile:{extension:(r,{relativeFilepath:n,contents:i})=>{let o=t.resolveNamedType({referenceToNamedType:r,file:mu({relativeFilepath:n,definitionFile:i,rootApiFile:e.definition.rootApiFile.contents,casingsGenerator:Jf})});return o==null?[]:o._type==="named"&&sf(o.declaration)?[]:[{severity:"fatal",message:`Objects can only extend other objects, and ${r} is not an object.`}]}}}}};var dXi={name:"valid-base-path",create:()=>({rootApiFile:{file:e=>e["base-path"]!=null?DHa(e["base-path"]):[]},definitionFile:{httpService:e=>DHa(e["base-path"])}})};function DHa(e){if(e==="/"||e.length===0)return[];let t=[];return e.startsWith("/")||t.push({severity:"fatal",message:"base-path must be empty or start with a slash."}),t}var mXi={name:"valid-default-environment",create:({workspace:e})=>{let t=e.definition.rootApiFile.contents.environments;return{rootApiFile:{defaultEnvironment:r=>r!=null&&(t==null||!Object.keys(t).includes(r))?[{severity:"fatal",message:`The default-environment ${r} is not listed as an environment`}]:[]}}}};var hXi={name:"valid-endpoint-path",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.path==="")return[];let t=[];return e.path.startsWith("/")||t.push({severity:"fatal",message:"Path must start with a slash."}),t}}})};function BDr({allDeclarations:e={},examples:t,parameterDisplayName:r,typeResolver:n,exampleResolver:i,workspace:o,getRawType:s,isAllowMultiple:a,breadcrumbs:c}){let u=[],l=Object.entries(e).reduce((p,[d,f])=>{let m=s(f);if(m!=null){let h=n.resolveType({type:m.rawType,file:m.file});h!=null&&h._type==="container"&&(h.container._type==="optional"||h.container._type==="nullable")||h?._type==="unknown"||p.push(d)}return p},[]);for(let p of l)t?.[p]==null&&u.push({severity:"fatal",message:`Example is missing required ${r} "${p}"`});if(t!=null)for(let[p,d]of Object.entries(t)){let f=e[p];if(f==null)u.push({severity:"fatal",message:`Unexpected ${r} "${p}"`});else{let m=s(f);if(m!=null){let h=a?.(f)&&Array.isArray(d)?d:[d];for(let A of h)u.push(...ZO.validateTypeReferenceExample({rawTypeReference:m.rawType,example:A,file:m.file,workspace:o,typeResolver:n,exampleResolver:i,breadcrumbs:c,depth:0}).map(b=>({severity:b.severity??"fatal",message:b.message})))}}}return u}function RHa({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){let s=[],a=typeof t.request!="string"?t.request?.body:t.request;return a==null?e!=null&&s.push({severity:"fatal",message:"Unexpected request in example."}):gg(a)?s.push(...ZO.validateObjectExample({typeName:void 0,typeNameForBreadcrumb:"<Inlined Request>",rawObject:{"extra-properties":a["extra-properties"],extends:a.extends,properties:a.properties??{}},file:i,typeResolver:r,exampleResolver:n,workspace:o,example:e,breadcrumbs:["request"],depth:0}).map(c=>({severity:c.severity??"fatal",message:c.message}))):s.push(...ZO.validateTypeReferenceExample({rawTypeReference:typeof a=="string"?a:a.type,example:e,file:i,workspace:o,typeResolver:r,exampleResolver:n,breadcrumbs:["response","body"],depth:0}).map(c=>({severity:c.severity??"fatal",message:c.message}))),s}jt();function kHa({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o,errorResolver:s}){return e==null?FHa({example:{},endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o,errorResolver:s}):_De(t,e,{body:a=>FHa({example:a,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o,errorResolver:s}),stream:a=>eDf({example:a,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}),events:a=>tDf({example:a,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o})})}function FHa({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o,errorResolver:s}){let a=[];if(e.error==null)if(t.response!=null){let c=typeof t.response!="string"?t.response.type:t.response;if(c==null)return a;a.push(...ZO.validateTypeReferenceExample({rawTypeReference:c,example:e.body,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:["response","body"],depth:0}).map(u=>({severity:u.severity??"fatal",message:u.message})))}else e.body!=null&&a.push({severity:"fatal",message:`Unexpected response in example. If you're adding an example of an error response, set the "error" property to the error's name`});else{let c=s.getDeclaration(e.error,i);c!=null&&(t.errors!=null&&t.errors.some(l=>(typeof l!="string"?l.error:l)===e.error)||a.push({severity:"fatal",message:`${ve.bold(e.error)} is not specified as an allowed error for this endpoint. Add ${ve.bold(e.error)} to the endpoint's "errors" list.`}),c.declaration.type!=null?a.push(...ZO.validateTypeReferenceExample({rawTypeReference:c.declaration.type,example:e.body,typeResolver:r,exampleResolver:n,file:c.file,workspace:o,breadcrumbs:["response","body"],depth:0}).map(l=>({severity:l.severity??"fatal",message:l.message}))):e.body!=null&&a.push({severity:"fatal",message:`Unexpected response in example. ${ve.bold(e.error)} does not have a body.`}))}return a}function eDf({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){let s=[];if(t["response-stream"]==null)s.push({severity:"fatal",message:"Unexpected streaming response in example. Endpoint's schema is missing `response-stream` key."});else if(typeof t["response-stream"]=="string"||t["response-stream"].format==null||t["response-stream"].format==="json")for(let a of e.stream)s.push(...ZO.validateTypeReferenceExample({rawTypeReference:typeof t["response-stream"]!="string"?t["response-stream"].type:t["response-stream"],example:a,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:["response","body"],depth:0}).map(c=>({severity:c.severity??"fatal",message:c.message})));else s.push({severity:"fatal",message:"Endpoint response expects server-sent events (`response-stream.format: sse`), but the provided example is a regular stream. Use the `events` key to provide an list of server-sent event examples."});return s}function tDf({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:o}){let s=[];if(t["response-stream"]==null)s.push({severity:"fatal",message:"Unexpected streaming response in example. Endpoint's schema is missing `response-stream` key."});else if(typeof t["response-stream"]!="string"&&t["response-stream"].format==="sse"){let a=typeof t["response-stream"]!="string"?t["response-stream"].type:t["response-stream"],c=!1,u,l=r.resolveType({type:a,file:i});if(l?._type==="named"&&v3(l.declaration)){let p=l.declaration.discriminant;typeof p=="object"&&p.context==="protocol"&&(c=!0,u=p.value)}for(let p of e.stream){let d=c&&u!=null&&Lo(p.data)?{[u]:p.event,...p.data}:p.data;s.push(...ZO.validateTypeReferenceExample({rawTypeReference:a,example:d,typeResolver:r,exampleResolver:n,file:i,workspace:o,breadcrumbs:["response","body"],depth:0}).map(f=>({severity:f.severity??"fatal",message:f.message})))}}else s.push({severity:"fatal",message:"Endpoint response expects a regular stream, but the provided example is a server-sent event. Use the `stream` key to provide a list of stream examples."});return s}var gXi={name:"valid-example-endpoint-call",create:({workspace:e})=>{let t=new af(e),r=new FNe(e),n=new R6(t),i=new O7;return{definitionFile:{exampleHeaders:({service:o,endpoint:s,examples:a},{relativeFilepath:c,contents:u})=>BDr({allDeclarations:{...e.definition.rootApiFile.contents.headers,...o.headers,...typeof s.request!="string"?s.request?.headers:void 0},examples:a,parameterDisplayName:"header",typeResolver:t,exampleResolver:n,workspace:e,getRawType:l=>({file:mu({relativeFilepath:c,definitionFile:u,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),rawType:typeof l=="string"?l:l.type}),breadcrumbs:["headers"]}),examplePathParameters:({service:o,endpoint:s,examples:a},{relativeFilepath:c,contents:u})=>BDr({allDeclarations:rDf({workspace:e,service:o,endpoint:s}),examples:a,parameterDisplayName:"path parameter",typeResolver:t,exampleResolver:n,workspace:e,getRawType:l=>mDr({parameter:l,variableResolver:i,file:mu({relativeFilepath:c,definitionFile:u,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents})}),breadcrumbs:["path-parameters"]}),exampleQueryParameters:({endpoint:o,examples:s},{relativeFilepath:a,contents:c})=>BDr({allDeclarations:typeof o.request!="string"?o.request?.["query-parameters"]:void 0,examples:s,parameterDisplayName:"query parameter",typeResolver:t,exampleResolver:n,workspace:e,getRawType:u=>({file:mu({relativeFilepath:a,definitionFile:c,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),rawType:typeof u=="string"?u:u.type}),isAllowMultiple:u=>typeof u!="string"&&u["allow-multiple"]===!0,breadcrumbs:["query-parameters"]}),exampleRequest:({endpoint:o,example:s},{relativeFilepath:a,contents:c})=>RHa({example:s,endpoint:o,typeResolver:t,exampleResolver:n,file:mu({relativeFilepath:a,definitionFile:c,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),workspace:e}),exampleResponse:({endpoint:o,example:s},{relativeFilepath:a,contents:c})=>kHa({example:s,endpoint:o,typeResolver:t,exampleResolver:n,file:mu({relativeFilepath:a,definitionFile:c,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),workspace:e,errorResolver:r})}}}};function rDf({workspace:e,service:t,endpoint:r}){let n=T7(r);return r["base-path"]!=null?{...n}:{...e.definition.rootApiFile.contents["path-parameters"],...t["path-parameters"],...n}}var AXi={name:"valid-example-error",create:({workspace:e})=>{let t=new af(e),r=new R6(t);return{definitionFile:{exampleError:({errorName:n,declaration:i,example:o},{relativeFilepath:s,contents:a})=>i.type==null?[]:ZO.validateTypeReferenceExample({rawTypeReference:i.type,example:o.value,file:mu({relativeFilepath:s,definitionFile:a,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),workspace:e,typeResolver:t,exampleResolver:r,breadcrumbs:["response","body"],depth:0}).map(u=>({severity:"fatal",message:u.message}))}}}};var yXi={name:"valid-example-type",create:({workspace:e})=>{let t=new af(e),r=new R6(t);return{definitionFile:{exampleType:({typeName:n,typeDeclaration:i,example:o},{relativeFilepath:s,contents:a})=>ZO.validateTypeExample({typeName:n,typeDeclaration:i,example:o.value,file:mu({relativeFilepath:s,definitionFile:a,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),typeResolver:t,exampleResolver:r,workspace:e,breadcrumbs:[],depth:0}).map(u=>({severity:"fatal",message:u.message}))}}}};var nDf="https://buildwithfern.com/learn/api-definitions/openapi/extensions/enum-descriptions-and-names";function iDf(e){return typeof e=="string"?e:e.value}function NHa(e,t={hasOpenAPISource:!1}){let r=[];return e.enum.forEach(n=>{let i=JYe(n),o=iDf(n);if(ilr.test(i.name))return;let s=t.hasOpenAPISource?` If your API is defined using OpenAPI, you can use the x-fern-enum extension to specify a valid name: ${nDf}`:"";i.wasExplicitlySet?r.push({severity:"fatal",message:`Enum name ${ve.bold(i.name)} for value ${ve.bold(o)} is not suitable for code generation. It must start with a letter and only contain letters, numbers, and underscores.${s}`}):r.push({severity:"fatal",message:`Enum value ${ve.bold(i.name)} is not suitable for code generation. Add a "name" property that starts with a letter and contains only letters, numbers, and underscores.${s}`})}),r}function QHa(e){let t=[],r=WYe(e);return ilr.test(r.name)||(r.wasExplicitlySet?t.push({severity:"fatal",message:`Discriminant name ${ve.bold(r.name)} is not suitable for code generation. It must start with a letter and only contain letters, numbers, and underscores.`}):t.push({severity:"fatal",message:`Discriminant value ${ve.bold(r.name)} is not suitable for code generation. Add a "name" property that starts with a letter and contains only letters, numbers, and underscores.`})),t}var bXi={name:"valid-field-names",create:e=>{let t=e.workspace.sources.some(r=>r.type==="openapi");return{definitionFile:{typeDeclaration:({declaration:r})=>nv(r,{alias:()=>[],enum:n=>NHa(n,{hasOpenAPISource:t}),object:()=>[],undiscriminatedUnion:()=>[],discriminatedUnion:QHa})}}}};var EXi={name:"valid-generic",create:({workspace:e})=>{let t=oDf(e),r={object:[],discriminatedUnion:[]};return{definitionFile:{typeDeclaration:({typeName:n,declaration:i,nodePath:o})=>{let s=[];return n.isInlined||Jb(n.name)!=null&&(nv(i,{alias:()=>!1,enum:()=>!1,object:()=>!0,discriminatedUnion:()=>!1,undiscriminatedUnion:()=>!1})||s.push({severity:"fatal",message:"Generics are only supported for object declarations"})),nv(i,{alias:a=>{let c=typeof a=="string"?a:a.type,u=Jb(c);if(u!=null){let[l,p,...d]=u.name.split("."),f=p??l;f&&f in t&&t[f]!==u.arguments.length&&s.push({severity:"fatal",message:`Generic ${f} expects ${t[f]} arguments, but received ${u.arguments.length} <${u.arguments.join(",")}>`})}else c in t&&s.push({severity:"fatal",message:`Generic ${c} expects ${t[c]} arguments, but received none`})},enum:a=>{typeof a!="string"&&a.enum.forEach(c=>{let u=typeof c=="string"?c:c.value;p3(u)&&s.push({severity:"fatal",message:`Cannot reference generic ${u} from enum`})})},object:a=>{Object.entries(a?.properties??{}).forEach(([c,u])=>{if(p3(typeof u=="string"?u:u.type))if(o)(r.object??=[]).push({key:c,nodePath:o});else{let l=typeof u=="string"?u:JSON.stringify(u);s.push({severity:"fatal",message:`Cannot reference generic ${l} from object property ${c}`})}})},discriminatedUnion:a=>{Object.entries(a.union).forEach(([c,u])=>{let l=typeof u=="string"?u:typeof u.type=="string"?u.type:void 0;if(l&&p3(l))if(o)(r.discriminatedUnion??=[]).push({key:c,nodePath:o});else{let p=typeof u=="string"?u:JSON.stringify(u);s.push({severity:"fatal",message:`Cannot reference generic ${p} from union property ${c}`})}})},undiscriminatedUnion:a=>{a.union.forEach(c=>{let u=typeof c=="string"?c:c.type;p3(u)&&s.push({severity:"fatal",message:`Cannot reference generic ${u} from union`})})}}),s},typeReference:({typeReference:n,nodePath:i})=>{let o=[];if(i)for(let s of Object.keys(r))for(let{key:a,nodePath:c}of r[s])c.length>0&&i.join(",").startsWith(c.join(","))&&i.includes(a)&&o.push({severity:"fatal",message:`Cannot reference generic ${n} from ${s.toLowerCase().includes("union")?"union":s}`});return o}}}}};function oDf(e){let t={};return uv(e,(r,n)=>{nB(n,{typeDeclaration:({typeName:i,declaration:o})=>{if(!i.isInlined){let s=Jb(i.name);s!=null&&nv(o,{alias:()=>{},enum:()=>{},object:()=>{s.name&&s.arguments&&(t[s.name]=s.arguments.length)},discriminatedUnion:()=>{},undiscriminatedUnion:()=>{}})}}})}),t}jt();Xt();var jHa=we(require("path"),1),IXi={name:"valid-navigation",create:({workspace:e})=>{let t=UT(Dae(e.definition)),n=UT(TAe(e.definition)).reduce((i,o)=>((i[Sn(o)]??=new Set).add(jHa.default.basename(o)),i),{});return{packageMarker:{navigation:(i,{relativeFilepath:o})=>{if(i==null)return[];if(typeof i=="string"){let u=Hs(e.definition.absoluteFilePath,Ye(e.definition.absoluteFilePath,Sn(o),De.of(i)));return t.some(l=>l.startsWith(u))?[]:[{severity:"fatal",message:`${i} does not exist.`}]}let s=n[Sn(o)];if(s==null)throw new N({message:`Could not find expected contents of ${o}`,code:N.Code.InternalError});let a=[],c=new Set;for(let u of i)u===Rf?a.push({severity:"fatal",message:`${Rf} cannot be specified in navigation.`}):s.has(u)?c.has(u)&&a.push({severity:"fatal",message:`${u} is specified more than once.`}):a.push({severity:"fatal",message:`Unexpected item: ${u}`}),c.add(u);for(let u of s)c.has(u)||a.push({severity:"fatal",message:`Missing ${u}`});return a}}}}};var bkt="$request.",vXi="$response.";function eXe({typeResolver:e,file:t,endpoint:r,propertyComponents:n,validate:i}){if(r.request==null)return!1;if(typeof r.request=="string"){let o=e.resolveType({type:r.request,file:t});return sF({typeResolver:e,file:ly(o)??t,resolvedType:o,propertyComponents:n,validate:i})}return sDf({typeResolver:e,file:t,requestType:r.request,propertyComponents:n,validate:i})}function sDf({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}){if(aDf({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}))return!0;if(r.body==null)return!1;if(typeof r.body=="string"){let s=e.resolveType({type:r.body,file:t});return sF({typeResolver:e,file:ly(s)??t,resolvedType:s,propertyComponents:n,validate:i})}if(gg(r.body))return MHa({typeResolver:e,file:t,objectSchema:r.body,propertyComponents:n,validate:i});let o=e.resolveType({type:r.body.type,file:t});return sF({typeResolver:e,file:ly(o)??t,resolvedType:e.resolveType({type:r.body.type,file:t}),propertyComponents:n,validate:i})}function aDf({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}){if(n.length!==1||typeof r=="string"||r["query-parameters"]==null)return!1;let o=r["query-parameters"][n[0]??""];if(o==null)return!1;let s=e.resolveType({type:typeof o!="string"?o.type:o,file:t});return i({resolvedType:s})}function sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:i}){if(n.length===0)return i({resolvedType:r});let o=UHa(r);return o==null?!1:MHa({typeResolver:e,file:t,objectSchema:o,propertyComponents:n,validate:i})}function TN({endpoint:e,typeResolver:t,file:r}){let n=typeof e.response!="string"?e.response?.type:e.response;if(n!=null)return t.resolveType({type:n,file:r})}function aF(e){if(e?._type==="primitive")return e.primitive.v1;if(e?._type==="container"&&(e.container._type==="optional"||e.container._type==="nullable"))return aF(e.container.itemType)}function ly(e){if(e!=null){if(e._type==="named")return e.file;if(e._type==="container"&&(e.container._type==="optional"||e.container._type==="nullable"))return ly(e.container.itemType)}}function tXe(e){return zHa(e,bkt)?.split(".")}function TDr(e){return zHa(e,vXi)?.split(".")}function MHa({typeResolver:e,file:t,objectSchema:r,propertyComponents:n,validate:i}){let o=cDf({typeResolver:e,file:t,objectSchema:r,property:n[0]??""});if(o==null)return!1;let s=e.resolveType({type:o,file:t});return sF({typeResolver:e,file:ly(s)??t,resolvedType:s,propertyComponents:n.slice(1),validate:i})}function cDf({typeResolver:e,file:t,objectSchema:r,property:n}){return LHa({typeResolver:e,file:t,objectSchema:r})[n]}function LHa({typeResolver:e,file:t,objectSchema:r}){let n=[];typeof r.extends=="string"?n=[r.extends]:Array.isArray(r.extends)&&(n=r.extends);let i={};for(let o of n){let s=uDf({typeResolver:e,file:t,extendedType:o});Object.entries(s).map(([a,c])=>{i[a]=c})}return r.properties!=null&&Object.entries(r.properties).map(([o,s])=>{i[o]=typeof s=="string"?s:s.type}),i}function uDf({typeResolver:e,file:t,extendedType:r}){let n=e.resolveNamedTypeOrThrow({referenceToNamedType:r,file:t});return n._type==="named"&&sf(n.declaration)?LHa({typeResolver:e,file:ly(n)??t,objectSchema:n.declaration}):{}}function UHa(e){if(e!=null){if(e._type==="named"&&sf(e.declaration))return e.declaration;if(e._type==="container"&&(e.container._type==="optional"||e.container._type==="nullable"))return UHa(e.container.itemType)}}function zHa(e,t){return e.startsWith(t)?e.substring(t.length):null}var CXi=`${bkt}client_id`,wXi=`${bkt}client_secret`,rXe=`${vXi}access_token`,xXi=`${bkt}refresh_token`;function SXi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:i}){return DDr({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"client-id",validate:Ekt}})}function _Xi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:i}){return DDr({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"client-secret",validate:Ekt}})}function VHa({endpointId:e,endpoint:t,typeResolver:r,file:n,scopesProperty:i}){return DDr({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"scopes",validate:Ekt}})}function BXi({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:i}){return DDr({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"refresh-token",validate:Ekt}})}function nXe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,accessTokenProperty:i}){return TXi({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"access-token",validate:qHa}})}function ODr({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,refreshTokenProperty:i}){return TXi({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"refresh-token",validate:qHa}})}function PDr({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,expiresInProperty:i}){return TXi({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"expires-in",validate:lDf}})}function lDf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:pDf})}function qHa({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:Ekt})}function DDr({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:o}){let s=[],a=tXe(i);return a==null?(s.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} must define a dot-delimited '${o.propertyID}' property starting with $request (e.g. $request.${o.propertyID}).`}),s):a.length>1?(s.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} cannot reference nested $request properties like '${i}'; expected '$request.${o.propertyID}' instead.`}),s):(eXe({typeResolver:r,file:n,endpoint:t,propertyComponents:a,validate:o.validate})||s.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} specifies '${o.propertyID}' ${i}, which is not a valid '${o.propertyID}' type.`}),s)}function TXi({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:o}){let s=[],a=TDr(i);return a==null&&s.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} must define a dot-delimited '${o.propertyID}' property starting with $response (e.g. $response.${o.propertyID}).`}),a!=null&&!o.validate({typeResolver:t,file:r,resolvedType:n,propertyComponents:a})&&s.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} specifies '${o.propertyID}' ${i}, which is not a valid '${o.propertyID}' type.`}),s}function pDf({resolvedType:e}){return aF(e)==="INTEGER"}function Ekt({resolvedType:e}){return aF(e)==="STRING"}function GHa({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshEndpoint:i}){let o=[],s=i["request-properties"]?.["refresh-token"];s!=null?o.push(...BXi({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:s})):BXi({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:xXi}).length>0&&o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} is missing a valid refresh-token, such as '${xXi}'.`});let a=TN({endpoint:t,typeResolver:r,file:n});if(a==null)return o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} must define a response type.`}),o;let c=i["response-properties"]?.["access-token"];c!=null?o.push(...nXe({endpointId:e,typeResolver:r,file:n,resolvedResponseType:a,accessTokenProperty:c})):nXe({endpointId:e,typeResolver:r,file:n,resolvedResponseType:a,accessTokenProperty:rXe}).length>0&&o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} is missing a valid access-token, such as '${rXe}'.`});let u=i?.["response-properties"]?.["expires-in"];u!=null&&o.push(...PDr({endpointId:e,typeResolver:r,file:ly(a)??n,resolvedResponseType:a,expiresInProperty:u}));let l=i?.["response-properties"]?.["refresh-token"];return l!=null&&o.push(...ODr({endpointId:e,typeResolver:r,file:ly(a)??n,resolvedResponseType:a,refreshTokenProperty:l})),o}function WHa({endpointId:e,endpoint:t,typeResolver:r,file:n,tokenEndpoint:i}){let o=[],s=i["request-properties"]?.["client-id"];s!=null?o.push(...SXi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:s})):SXi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:CXi}).length>0&&o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} is missing a valid client-id, such as '${CXi}'.`});let a=i["request-properties"]?.["client-secret"];a!=null?o.push(..._Xi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:a})):_Xi({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:wXi}).length>0&&o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} is missing a valid client-secret, such as '${wXi}'.`});let c=i?.["request-properties"]?.scopes;c!=null&&o.push(...VHa({endpointId:e,endpoint:t,typeResolver:r,file:n,scopesProperty:c}));let u=TN({endpoint:t,typeResolver:r,file:n});if(u==null)return o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} must define a response type.`}),o;let l=i["response-properties"]?.["access-token"];l!=null?o.push(...nXe({endpointId:e,typeResolver:r,file:n,resolvedResponseType:u,accessTokenProperty:l})):nXe({endpointId:e,typeResolver:r,file:n,resolvedResponseType:u,accessTokenProperty:rXe}).length>0&&o.push({severity:"fatal",message:`OAuth configuration for endpoint ${ve.bold(e)} is missing a valid access-token, such as '${rXe}'.`});let p=i?.["response-properties"]?.["expires-in"];p!=null&&o.push(...PDr({endpointId:e,typeResolver:r,file:ly(u)??n,resolvedResponseType:u,expiresInProperty:p}));let d=i?.["response-properties"]?.["refresh-token"];return d!=null&&o.push(...ODr({endpointId:e,typeResolver:r,file:ly(u)??n,resolvedResponseType:u,refreshTokenProperty:d})),o}var OXi={name:"valid-oauth",create:({workspace:e})=>{let t=new af(e),r=new RNe(e),n=yue({casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents});return{rootApiFile:{oauth:({name:i,oauth:o},{relativeFilepath:s})=>{let a=[],c=o["get-token"].endpoint,u=r.resolveEndpoint({endpoint:c,file:n});u==null?a.push({severity:"fatal",message:`Failed to resolve endpoint ${c}`}):a.push(...WHa({endpointId:u.endpointId,endpoint:u.endpoint,typeResolver:t,file:u.file,tokenEndpoint:o["get-token"]}));let l=o["refresh-token"]?.endpoint;if(o["refresh-token"]!=null&&l!=null){let p=r.resolveEndpoint({endpoint:l,file:n});p==null?a.push({severity:"fatal",message:`Failed to resolve endpoint ${c}`}):a.push(...GHa({endpointId:p.endpointId,endpoint:p.endpoint,typeResolver:t,file:p.file,refreshEndpoint:o["refresh-token"]}))}return a}}}}};function QY({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,resultsProperty:i}){return NNe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"results",validate:fDf}})}function Ikt({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:o}){let s=[],a=tXe(i);return a==null?(s.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a dot-delimited '${o.propertyID}' property starting with $request (e.g. $request.${o.propertyID}).`}),s):(eXe({typeResolver:r,file:n,endpoint:t,propertyComponents:a,validate:o.validate})||s.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} specifies '${o.propertyID}' ${i}, which is not a valid '${o.propertyID}' type.`}),s)}function NNe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:o}){let s=[],a=TDr(i);return a==null&&s.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a dot-delimited '${o.propertyID}' property starting with $response (e.g. $response.${o.propertyID}).`}),a!=null&&!o.validate({typeResolver:t,file:r,resolvedType:n,propertyComponents:a})&&s.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} specifies '${o.propertyID}' ${i}, which is not a valid '${o.propertyID}' type.`}),s}function fDf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:dDf})}function dDf({resolvedType:e}){return!0}function $Ha({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}){let o=[];o.push(...mDf({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}));let s=TN({endpoint:t,typeResolver:r,file:n});return s==null?(o.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a response type.`}),o):(o.push(...hDf({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,nextProperty:i.next_cursor})),o.push(...QY({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,resultsProperty:i.results})),o)}function mDf({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}){return Ikt({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.cursor,propertyValidator:{propertyID:"cursor",validate:HHa}})}function hDf({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,nextProperty:i}){return NNe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"next_cursor",validate:gDf}})}function gDf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:HHa})}function HHa({resolvedType:e}){let t=aF(e);return t==null?!1:t!=="BOOLEAN"}function KHa({endpointId:e,endpoint:t,typeResolver:r,file:n,customPagination:i}){let o=[],s=TN({endpoint:t,typeResolver:r,file:n});return s==null?(o.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a response type.`}),o):(o.push(...QY({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,resultsProperty:i.results})),o)}function JHa(e){return e.split(".").slice(1)}function YHa({path:e,typeResolver:t,file:r,resolvedType:n,validate:i}){let o=n;for(let s of e){if(o==null)return i({resolvedType:void 0});let a=eKa(o);if(a==null)return i({resolvedType:void 0});let u=XHa({typeResolver:t,file:r,objectSchema:a})[s];if(u==null)return i({resolvedType:void 0});o=t.resolveType({type:u,file:r})}return i({resolvedType:o})}function XHa({typeResolver:e,file:t,objectSchema:r}){let n=[];typeof r.extends=="string"?n=[r.extends]:Array.isArray(r.extends)&&(n=r.extends);let i={};for(let o of n){let s=ADf({typeResolver:e,file:t,extendedType:o});Object.entries(s).map(([a,c])=>{i[a]=c})}return r.properties!=null&&Object.entries(r.properties).map(([o,s])=>{i[o]=typeof s=="string"?s:s.type}),i}function ADf({typeResolver:e,file:t,extendedType:r}){let n=e.resolveNamedTypeOrThrow({referenceToNamedType:r,file:t});return n._type==="named"&&sf(n.declaration)?XHa({typeResolver:e,file:ZHa(n)??t,objectSchema:n.declaration}):{}}function ZHa(e){if(e!=null){if(e._type==="named")return e.file;if(e._type==="container"&&(e.container._type==="optional"||e.container._type==="nullable"))return ZHa(e.container.itemType)}}function eKa(e){if(e!=null){if(e._type==="named"&&sf(e.declaration))return e.declaration;if(e._type==="container"&&(e.container._type==="optional"||e.container._type==="nullable"))return eKa(e.container.itemType)}}function tKa({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){let o=[];o.push(...yDf({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i})),o.push(...bDf({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}));let s=TN({endpoint:t,typeResolver:r,file:n});return s==null?(o.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a response type.`}),o):(o.push(...QY({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,resultsProperty:i.results})),o.push(...EDf({endpointId:e,resolvedResponseType:s,typeResolver:r,file:ly(s)??n,offsetPagination:i})),o)}function yDf({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){return Ikt({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.offset,propertyValidator:{propertyID:"offset",validate:rKa}})}function bDf({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){return i.step==null?[]:Ikt({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.step,propertyValidator:{propertyID:"step",validate:rKa}})}function rKa({resolvedType:e}){let t=aF(e);return t==null?!1:t==="INTEGER"||t==="LONG"||t==="DOUBLE"}function EDf({resolvedResponseType:e,typeResolver:t,file:r,offsetPagination:n}){return n["has-next-page"]==null?[]:YHa({typeResolver:t,file:r,path:JHa(n["has-next-page"]),resolvedType:e,validate:({resolvedType:i})=>aF(i)!=="BOOLEAN"?[{message:`"has-next-page" selector, ${n["has-next-page"]}, does not point to a boolean property`,severity:"fatal"}]:[]})}function nKa({endpointId:e,endpoint:t,typeResolver:r,file:n,pathPagination:i}){let o=[],s=TN({endpoint:t,typeResolver:r,file:n});return s==null?(o.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a response type.`}),o):(o.push(...IDf({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,nextProperty:i.next_path})),o.push(...QY({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,resultsProperty:i.results})),o)}function IDf({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,nextProperty:i}){return NNe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"next_path",validate:vDf}})}function vDf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:CDf})}function CDf({resolvedType:e}){return aF(e)==="STRING"}function iKa({endpointId:e,endpoint:t,typeResolver:r,file:n,uriPagination:i}){let o=[],s=TN({endpoint:t,typeResolver:r,file:n});return s==null?(o.push({severity:"fatal",message:`Pagination configuration for endpoint ${ve.bold(e)} must define a response type.`}),o):(o.push(...wDf({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,nextProperty:i.next_uri})),o.push(...QY({endpointId:e,typeResolver:r,file:ly(s)??n,resolvedResponseType:s,resultsProperty:i.results})),o)}function wDf({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,nextProperty:i}){return NNe({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"next_uri",validate:xDf}})}function xDf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return sF({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:SDf})}function SDf({resolvedType:e}){return aF(e)==="STRING"}var PXi={name:"valid-pagination",create:({workspace:e})=>{let t=new af(e),r=e.definition.rootApiFile.contents.pagination;return{definitionFile:{httpEndpoint:({endpointId:n,endpoint:i},{relativeFilepath:o,contents:s})=>{let a=typeof i.pagination=="boolean"?r:i.pagination;if(!a)return[];let c=mu({relativeFilepath:o,definitionFile:s,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents});if(BDf(a))return $Ha({endpointId:n,endpoint:i,typeResolver:t,file:c,cursorPagination:a});if(_Df(a))return tKa({endpointId:n,endpoint:i,typeResolver:t,file:c,offsetPagination:a});if(TDf(a))return KHa({endpointId:n,endpoint:i,typeResolver:t,file:c,customPagination:a});if(lDr(a))return iKa({endpointId:n,endpoint:i,typeResolver:t,file:c,uriPagination:a});if(pDr(a))return nKa({endpointId:n,endpoint:i,typeResolver:t,file:c,pathPagination:a});throw new N({message:"Invalid pagination schema",code:N.Code.ValidationError})}}}}};function _Df(e){return e.offset!=null}function BDf(e){return e.cursor!=null&&e.next_cursor!=null&&e.results!=null}function TDf(e){return"type"in e&&e.type==="custom"}var DXi={name:"valid-path-parameters-configuration",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>e["path-parameters"]!=null&&typeof e.request!="string"&&e?.request?.["path-parameters"]!=null?[{severity:"fatal",message:"path-parameters cannot be defined in both endpoint and request."}]:[]}})};var RXi={name:"valid-service-urls",create:({workspace:e})=>{let t=xDr(e),r=n=>t.includes(n)?[]:t.length===0&&e.definition.rootApiFile.contents?.["default-url"]!=null?[]:t.length===0?[{severity:"fatal",message:`"url" cannot be configured unless you specify multiple URLs for each environment in ${nI}`}]:[{severity:"fatal",message:[`URL ${ve.bold(n)} is not recognized. Please add it to your environments in ${nI} or specify one of the configured environment URLs:`,...t.map(i=>` - ${i}`)].join(`
|
|
2547
2547
|
`)}];return{definitionFile:{serviceBaseUrl:n=>n==null?[]:r(n),endpointBaseUrl:({baseUrl:n,service:i})=>e.definition.rootApiFile.contents?.["default-url"]?[]:n==null?t.length===0||i.url!=null?[]:[{severity:"fatal",message:['"url" is missing. Please specify one of the configured environment URLs:',...t.map(o=>` - ${o}`)].join(`
|
|
2548
2548
|
`)}]:r(n)}}}};var FXi={name:"valid-stream-condition",create:({workspace:e})=>({definitionFile:{streamCondition:({endpoint:t,streamCondition:r},{relativeFilepath:n,contents:i})=>{let o=new af(e),s=mu({relativeFilepath:n,definitionFile:i,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents});return t.response==null||t["response-stream"]==null?r==null?[]:[{severity:"fatal",message:"stream-condition can only be used if both response and response-stream are specified."}]:r==null?[{severity:"fatal",message:"stream-condition must be specified when both response and response-stream are specified."}]:PDf({endpoint:t,typeResolver:o,file:s,requestProperty:r,propertyValidator:{propertyID:"stream-condition",validate:ODf}})}}})};function ODf({resolvedType:e}){let t=aF(e);return t==null?!1:t==="BOOLEAN"}function PDf({endpoint:e,typeResolver:t,file:r,requestProperty:n,propertyValidator:i}){let o=[],s=tXe(n);return s==null?[{severity:"fatal",message:"Please specify path to a valid property (e.g. $request.stream)"}]:eXe({typeResolver:t,file:r,endpoint:e,propertyComponents:s,validate:i.validate})?o:[{severity:"fatal",message:`Property "${n}" does not exist on the request.`}]}var DDf=/^[a-z]/i,kXi={name:"valid-type-name",create:()=>({definitionFile:{typeDeclaration:({typeName:e})=>!e.isInlined&&!DDf.test(e.name)?[{severity:"fatal",message:"Type name must begin with a letter"}]:[]}})};var QXi={name:"valid-type-reference-with-default-and-validation",create:({workspace:e})=>{let t=new af(e);return{definitionFile:{typeDeclaration:({declaration:r})=>{if(!wG(r))return[];let n=new Set(r.enum.map(i=>typeof i=="string"?i:i.value));return r.default!=null&&!n.has(r.default)?[{message:`Default value '${r.default}' is not a valid enum value`,severity:"fatal"}]:[]},typeReference:({typeReference:r,_default:n,validation:i,location:o},{relativeFilepath:s,contents:a})=>{let c=mu({relativeFilepath:s,definitionFile:a,casingsGenerator:Jf,rootApiFile:e.definition.rootApiFile.contents}),u=t.resolveType({type:r,file:c});return u==null?[]:oKa({resolvedType:u,_default:n,validation:i})}}}}};function oKa({resolvedType:e,_default:t,validation:r}){let n=[];if(t==null&&r==null)return[];if(e._type==="container"&&(e.container._type==="optional"||e.container._type==="nullable"))return oKa({resolvedType:e.container.itemType,_default:t,validation:r});let i=e._type;if(e._type==="primitive")switch(e.primitive.v1){case"STRING":return FDf({_default:t,validation:r});case"DOUBLE":return kDf({_default:t,validation:r});case"INTEGER":return NDf({_default:t,validation:r});case"BOOLEAN":return QDf({_default:t,validation:r});case"LONG":return jDf({_default:t,validation:r});case"BIG_INTEGER":return MDf({_default:t,validation:r});case"DATE_TIME":i="datetime";break;case"UUID":i="uuid";break;case"BASE_64":i="base64";break;case"UINT":i="uint";break;case"UINT_64":i="uint64";break}return e._type==="named"&&wG(e.declaration)?RDf({declaration:e.declaration,_default:t}):(t!=null&&n.push({message:`Default values are not supported for the ${i} type`,severity:"fatal"}),r!=null&&n.push({message:`Validation rules are not supported for the ${i} type`,severity:"fatal"}),n)}function RDf({declaration:e,_default:t}){if(t==null)return[];let r=new Set(e.enum.map(i=>typeof i=="string"?i:i.value)),n=[];return r.has(t)||n.push({message:`Default value '${t}' is not a valid enum value`,severity:"fatal"}),n}function FDf({_default:e,validation:t}){let r=[];return e!=null&&typeof e!="string"&&r.push({message:`Default value '${e}' is not a valid string`,severity:"fatal"}),t!=null&&!LDf(t)&&r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the string type`,severity:"fatal"}),r}function kDf({_default:e,validation:t}){let r=[];return e!=null&&typeof e!="number"&&r.push({message:`Default value '${e}' is not a valid double`,severity:"fatal"}),t!=null&&!sKa(t)&&r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the double type`,severity:"fatal"}),r}function NDf({_default:e,validation:t}){let r=[];return e!=null&&!Number.isInteger(e)&&r.push({message:`Default value '${e}' is not a valid integer`,severity:"fatal"}),t!=null&&(sKa(t)?r.push(...NXi({name:"min",value:t.min}),...NXi({name:"max",value:t.max}),...NXi({name:"multipleOf",value:t.multipleOf})):r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the integer type`,severity:"fatal"})),r}function QDf({_default:e,validation:t}){let r=[];return e!=null&&typeof e!="boolean"&&r.push({message:`Default value '${e}' is not a valid boolean`,severity:"fatal"}),t!=null&&r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the boolean type`,severity:"fatal"}),r}function jDf({_default:e,validation:t}){let r=[];return e!=null&&typeof e!="number"&&r.push({message:`Default value '${e}' is not a valid long`,severity:"fatal"}),t!=null&&r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the long type`,severity:"fatal"}),r}function MDf({_default:e,validation:t}){let r=[];if(e!=null)if(typeof e!="string")r.push({message:`Default value '${e}' is not a valid bigint`,severity:"fatal"});else try{BigInt(e)}catch{r.push({message:`Default value '${e}' is not a valid bigint`,severity:"fatal"})}return t!=null&&r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the bigint type`,severity:"fatal"}),r}function NXi({name:e,value:t}){return t!=null&&!Number.isInteger(t)?[{message:`Validation for '${e}' must be an integer, but found '${t}'`,severity:"fatal"}]:[]}function sKa(e){let t=e;return t.min!=null||t.max!=null||t.exclusiveMin!=null||t.exclusiveMax!=null||t.multipleOf!=null}function LDf(e){let t=e;return t.minLength!=null||t.maxLength!=null||t.pattern!=null||t.format!=null}var jXi={name:"valid-version",create:({workspace:e})=>{let t=new af(e);return{rootApiFile:{file:r=>UDf({root:r,typeResolver:t})}}}};function UDf({root:e,typeResolver:t}){let r=[];return e.version==null||e.version.default==null?[]:(new Set(e.version.values.map(i=>typeof i=="string"?i:i.value)).has(e.version.default)||r.push({severity:"fatal",message:`Default version "${e.version.default}" not found in version values`}),r)}var aKa=new Set(Object.values(ph.WebhookSignatureAlgorithmSchema)),cKa=new Set(Object.values(ph.AsymmetricAlgorithmSchema)),uKa=new Set(Object.values(ph.WebhookSignatureEncodingSchema)),lKa=new Set(Object.values(ph.WebhookTimestampFormatSchema)),MXi={name:"valid-webhook-signature",create:()=>({definitionFile:{webhookSignature:e=>zDf(e)}})};function zDf(e){let t=[];switch((e.header==null||e.header.length===0)&&t.push({severity:"error",message:"webhook-signature must specify a header"}),e.encoding!=null&&!uKa.has(e.encoding)&&t.push({severity:"error",message:`Invalid encoding "${e.encoding}". Must be one of: ${[...uKa].join(", ")}`}),e.timestamp!=null&&GDf(e.timestamp,t),e.type){case"hmac":VDf(e,t);break;case"asymmetric":qDf(e,t);break}return t}function VDf(e,t){if(e.algorithm!=null&&!aKa.has(e.algorithm)&&t.push({severity:"error",message:`Invalid HMAC algorithm "${e.algorithm}". Must be one of: ${[...aKa].join(", ")}`}),e["payload-format"]!=null){let r=e["payload-format"];if(r.components!=null){let n=new Set(Object.values(ph.WebhookPayloadComponentSchema));for(let i of r.components)n.has(i)||t.push({severity:"error",message:`Invalid payload-format component "${i}". Must be one of: ${[...n].join(", ")}`})}}}function qDf(e,t){cKa.has(e["asymmetric-algorithm"])||t.push({severity:"error",message:`Invalid asymmetric algorithm "${e["asymmetric-algorithm"]}". Must be one of: ${[...cKa].join(", ")}`}),e["key-id-header"]!=null&&e["jwks-url"]==null&&t.push({severity:"warning",message:"key-id-header is specified without jwks-url and will be ignored"})}function GDf(e,t){(e.header==null||e.header.length===0)&&t.push({severity:"error",message:"webhook-signature timestamp must specify a header"}),e.format!=null&&!lKa.has(e.format)&&t.push({severity:"error",message:`Invalid timestamp format "${e.format}". Must be one of: ${[...lKa].join(", ")}`}),e.tolerance!=null&&e.tolerance<=0&&t.push({severity:"error",message:"webhook-signature timestamp tolerance must be a positive number"})}function WDf(){return[uXi,HYi,cXi,jYi,$Yi,oXi,LYi,bXi,JYi,nXi,ZYi,UYi,mXi,tXi,yXi,YYi,eXi,rXi,zYi,GYi,gXi,KYi,sXi,MYi,RXi,dXi,hXi,qYi,kXi,XYi,IXi,lXi,fXi,iXi,OXi,PXi,AXi,QXi,FXi,jXi,pXi,EXi,nYi,DXi,QYi,MXi]}function pKa(){return WDf().filter(({DISABLE_RULE:e=!1})=>!e)}function QNe(e,t){return $Df({workspace:e,rules:pKa(),logger:t})}function $Df({workspace:e,rules:t,logger:r}){let n=[],i=t.map(s=>({name:s.name,visitors:s.create({workspace:e,logger:r})})),o=KDf({contents:e.definition.rootApiFile.contents,allRuleVisitors:i});return n.push(...o),uv(e,(s,a)=>{let c=HDf({relativeFilepath:s,contents:a,allRuleVisitors:i});n.push(...c)}),AFe(e,(s,a)=>{let c=JDf({relativeFilepath:s,contents:a,allRuleVisitors:i});n.push(...c)}),n}function HDf({relativeFilepath:e,contents:t,allRuleVisitors:r}){let n=[],i=CWa({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:o=>{n.push(...o)}});return nB(t,i),n}function KDf({contents:e,allRuleVisitors:t}){let r=[],n=xWa({relativeFilepath:De.of(nI),contents:e,allRuleVisitors:t,addViolations:i=>{r.push(...i)}});return tvi(e,n),r}function JDf({relativeFilepath:e,contents:t,allRuleVisitors:r}){let n=[],i=wWa({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:o=>{n.push(...o)}});return evi(t,i),n}Xt();var fKa={None:"none",Header:"header"};var tRr={};ne(tRr,{ConjureAliasDeclaration:()=>WDr,ConjureArgument:()=>VDr,ConjureArgumentWithParamType:()=>zDr,ConjureAuthDefinition:()=>aXe,ConjureAuthDefinitionType:()=>jDr,ConjureDefinitions:()=>ZDr,ConjureEndpointDefinition:()=>qDr,ConjureEnumDeclaration:()=>KDr,ConjureEnumVariant:()=>HDr,ConjureEnumWithDocs:()=>$Dr,ConjureObjectDeclaration:()=>JDr,ConjureParamType:()=>UDr,ConjurePrimitive:()=>MDr,ConjureService:()=>GDr,ConjureServiceName:()=>QDr,ConjureType:()=>J0e,ConjureTypeDeclaration:()=>XDr,ConjureTypeReference:()=>Y0e,ConjureTypeWithDocs:()=>LDr,ConjureTypes:()=>eRr,ConjureUnionDeclaration:()=>YDr,DefinitionFile:()=>LKa,WithDocs:()=>jY,commons:()=>GXi,conjure:()=>WXi,services:()=>$Xi,types:()=>HXi});var GXi={};ne(GXi,{WithDocs:()=>jY});var go={};ne(go,{JsonError:()=>iXe,ParseError:()=>oXe,any:()=>SKa,bigint:()=>mKa,boolean:()=>_Ka,booleanLiteral:()=>wKa,date:()=>hKa,discriminant:()=>QKa,enum_:()=>FDr,getObjectLikeUtils:()=>P7,getObjectUtils:()=>jNe,getSchemaUtils:()=>Rm,isProperty:()=>Iue,lazy:()=>gKa,lazyObject:()=>vKa,list:()=>NDr,never:()=>BKa,number:()=>TKa,object:()=>kDr,objectWithoutOptionalProperties:()=>IKa,optional:()=>LXi,property:()=>yKa,record:()=>RKa,set:()=>FKa,string:()=>OKa,stringLiteral:()=>xKa,transform:()=>UXi,undiscriminatedUnion:()=>NKa,union:()=>MKa,unknown:()=>PKa,withParsedProperties:()=>qXi});var Ju={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function $d(e,t){return`Expected ${t}. Received ${YDf(e)}.`}function YDf(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function r_(e){return{...e,json:dKa(e.json),parse:dKa(e.parse)}}function dKa(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
2549
2549
|
`)),{ok:!0,value:t}):n}}function RDr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var iXe=class extends Error{errors;constructor(t){super(t.map(RDr).join("; ")),this.errors=t,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};var oXe=class extends Error{errors;constructor(t){super(t.map(RDr).join("; ")),this.errors=t,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};function Rm(e){return{nullable:()=>XDf(e),optional:()=>LXi(e),optionalNullable:()=>ZDf(e),transform:t=>UXi(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new oXe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new iXe(n.errors)}}}function XDf(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Ju.NULLABLE};return{...t,...Rm(t)}}function LXi(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Ju.OPTIONAL};return{...t,...Rm(t)}}function ZDf(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>Ju.OPTIONAL_NULLABLE};return{...t,...Rm(t)}}function UXi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...Rm(r)}}function mKa(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:$d(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:$d(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Ju.BIGINT};return{...r_(e),...Rm(e)}}var eRf=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function hKa(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:$d(t,"string")}]}:eRf.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:$d(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:$d(t,"Date object")}]},getType:()=>Ju.DATE};return{...r_(e),...Rm(e)}}function n_(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...r_(r),...Rm(r)}}}function FDr(e){let t=new Set(e);return n_(Ju.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:$d(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:$d(n,"enum")}]}:{ok:!0,value:n})()}function gKa(e){let t=zXi(e);return{...t,...Rm(t)}}function zXi(e){return{parse:(t,r)=>sXe(e).parse(t,r),json:(t,r)=>sXe(e).json(t,r),getType:()=>sXe(e).getType()}}function sXe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function VXi(e){return Object.entries(e)}function vkt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function Eue(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function Ckt(e){return Object.keys(e)}function AKa(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var tRf=Object.prototype.hasOwnProperty;function P7(e){return{withParsedProperties:t=>qXi(e,t)}}function qXi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(tRf.call(t,a)){let c=t[a];s[a]=typeof c=="function"?c(o.value):c}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Eue(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:$d(n,"object")}]};let o=new Set(Object.keys(t)),s=vkt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...Rm(r),...P7(r)}}function yKa(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Iue(e){return e.isProperty}var rRf=Object.prototype.hasOwnProperty;function kDr(e){let t;function r(){if(t==null){t={};for(let[d,f]of VXi(e)){let m=Iue(f)?f.rawKey:d,h=Iue(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of VXi(e)){let m=Iue(f)?f.rawKey:d,h=Iue(f)?f.valueSchema:f;nRf(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function c(){return i==null&&a(),i}function u(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>Iue(f)?f.rawKey:d),_getParsedProperties:()=>Ckt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return bKa({value:d,requiredKeys:a(),requiredKeysSet:u(),getProperty:h=>{let A=r()[h];if(A!=null)return{transformedKey:A.parsedKey,transform:b=>{let v=[...m,h];return A.valueSchema.parse(b,{...f,breadcrumbsPrefix:v})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return bKa({value:d,requiredKeys:c(),requiredKeysSet:l(),getProperty:h=>{let A=e[h];if(A!=null)return Iue(A)?{transformedKey:A.rawKey,transform:b=>{let v=[...m,h];return A.valueSchema.json(b,{...f,breadcrumbsPrefix:v})}}:{transformedKey:h,transform:b=>{let v=[...m,h];return A.json(b,{...f,breadcrumbsPrefix:v})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>Ju.OBJECT};return{...r_(p),...Rm(p),...P7(p),...jNe(p)}}function bKa({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Eue(e))return{ok:!1,errors:[{path:s,message:$d(e,"object")}]};let a=t.length,c=[],u={};for(let l in e){if(!rRf.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?u[d.transformedKey]=f.value:(u[l]=p,c.push(...f.errors))}else switch(i){case"fail":c.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=p;break}}if(a>0)for(let l of t)l in e||c.push({path:s,message:`Missing required key "${l}"`});return c.length===0||o?{ok:!0,value:u}:{ok:!1,errors:c}}function jNe(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>EKa({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>EKa({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Ju.OBJECT};return{...r,...Rm(r),...P7(r),...jNe(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))t.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))r.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},getType:()=>Ju.OBJECT};return{...n,...Rm(n),...P7(n),...jNe(n)}}}}function EKa({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Eue(t))return{ok:!1,errors:[{path:i,message:$d(t,"object")}]};let o=new Set(e),[s,a]=AKa(Ckt(t),l=>o.has(l)),c=r(vkt(t,a)),u=n(vkt(t,s));return c.ok&&u.ok?{ok:!0,value:{...c.value,...u.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...u.ok?[]:u.errors]}}function nRf(e){return!iRf(e)}function iRf(e){switch(e.getType()){case Ju.ANY:case Ju.UNKNOWN:case Ju.OPTIONAL:case Ju.OPTIONAL_NULLABLE:return!0;default:return!1}}function IKa(e){return kDr(e)}function vKa(e){let t={...zXi(e),_getRawProperties:()=>sXe(e)._getRawProperties(),_getParsedProperties:()=>sXe(e)._getParsedProperties()};return{...t,...Rm(t),...P7(t),...jNe(t)}}function NDr(e){let t={parse:(r,n)=>CKa(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>CKa(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>Ju.LIST};return{...r_(t),...Rm(t)}}function CKa(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:$d(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function wKa(e){return n_(Ju.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:$d(r,`${e.toString()}`)}]})()}function xKa(e){return n_(Ju.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:$d(r,`"${e}"`)}]})()}var SKa=n_(Ju.ANY,e=>({ok:!0,value:e}));var _Ka=n_(Ju.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:$d(e,"boolean")}]});var BKa=n_(Ju.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var TKa=n_(Ju.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:$d(e,"number")}]});var OKa=n_(Ju.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:$d(e,"string")}]});var PKa=n_(Ju.UNKNOWN,e=>({ok:!0,value:e}));var oRf=Object.prototype.hasOwnProperty;function RKa(e,t){let r={parse:(n,i)=>DKa({value:n,isKeyNumeric:e.getType()===Ju.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>DKa({value:n,isKeyNumeric:e.getType()===Ju.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Ju.RECORD};return{...r_(r),...Rm(r)}}function DKa({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Eue(e))return{ok:!1,errors:[{path:i,message:$d(e,"object")}]};let o={},s=[];for(let a in e){if(!oRf.call(e,a))continue;let c=e[a];if(c===void 0)continue;let u=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(u=d)}let l=r(u),p=n(c,u);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function FKa(e){let t=NDr(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:$d(n,"Set")}]},getType:()=>Ju.SET};return{...r_(r),...Rm(r)}}function NKa(e){let t={parse:(r,n)=>kKa((i,o)=>i.parse(r,o),e,n),json:(r,n)=>kKa((i,o)=>i.json(r,o),e,n),getType:()=>Ju.UNDISCRIMINATED_UNION};return{...r_(t),...Rm(t)}}function kKa(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function QKa(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var sRf=Object.prototype.hasOwnProperty;function MKa(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=FDr(Ckt(t)),o={parse:(s,a)=>jKa({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.parse(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>jKa({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.json(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>Ju.UNION};return{...r_(o),...Rm(o),...P7(o)}}function jKa({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Eue(e))return{ok:!1,errors:[{path:a,message:$d(e,"object")}]};let c=e[t],u={};for(let f in e)sRf.call(e,f)&&f!==t&&(u[f]=e[f]);if(c==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(c);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...u}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(u,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var jY=go.objectWithoutOptionalProperties({docs:go.string().optional()});var WXi={};ne(WXi,{ConjureServiceName:()=>QDr,DefinitionFile:()=>LKa});var QDr=go.string();var jDr=go.enum_(["none","header"]);var aXe=go.undiscriminatedUnion([jDr,go.string()]);var MDr=go.enum_(["rid","string","safelong","integer","double","boolean","binary"]);var J0e=go.undiscriminatedUnion([MDr,go.string()]);var LDr=go.objectWithoutOptionalProperties({type:J0e,docs:go.string().optional()});var Y0e=go.undiscriminatedUnion([J0e,LDr]);var UDr=go.enum_(["path","query","body"]);var zDr=go.objectWithoutOptionalProperties({paramType:go.property("param-type",UDr),type:go.string()}).extend(jY);var VDr=go.undiscriminatedUnion([go.string(),zDr]);var qDr=go.objectWithoutOptionalProperties({http:go.string(),auth:aXe.optional(),args:go.record(go.string(),VDr).optional(),returns:Y0e.optional()}).extend(jY);var GDr=go.objectWithoutOptionalProperties({name:go.string().optional(),package:go.string().optional(),basePath:go.property("base-path",go.string().optional()),defaultAuth:go.property("default-auth",aXe.optional()),endpoints:go.record(go.string(),qDr).optional()}).extend(jY);var WDr=go.objectWithoutOptionalProperties({alias:J0e,docs:go.string().optional()});var $Dr=go.objectWithoutOptionalProperties({value:go.string()}).extend(jY);var HDr=go.undiscriminatedUnion([go.string(),$Dr]);var KDr=go.objectWithoutOptionalProperties({values:go.list(HDr)});var JDr=go.objectWithoutOptionalProperties({fields:go.record(go.string(),Y0e)});var YDr=go.objectWithoutOptionalProperties({union:go.record(go.string(),Y0e)});var XDr=go.undiscriminatedUnion([WDr,YDr,JDr,KDr]);var ZDr=go.objectWithoutOptionalProperties({objects:go.record(go.string(),XDr).optional()});var eRr=go.objectWithoutOptionalProperties({conjureImports:go.property("conjure-imports",go.record(go.string(),go.string()).optional()),definitions:ZDr.optional()});var LKa=go.objectWithoutOptionalProperties({types:eRr.optional(),services:go.record(QDr,GDr).optional()});var $Xi={};ne($Xi,{ConjureArgument:()=>VDr,ConjureArgumentWithParamType:()=>zDr,ConjureAuthDefinition:()=>aXe,ConjureAuthDefinitionType:()=>jDr,ConjureEndpointDefinition:()=>qDr,ConjureParamType:()=>UDr,ConjureService:()=>GDr});var HXi={};ne(HXi,{ConjureAliasDeclaration:()=>WDr,ConjureDefinitions:()=>ZDr,ConjureEnumDeclaration:()=>KDr,ConjureEnumVariant:()=>HDr,ConjureEnumWithDocs:()=>$Dr,ConjureObjectDeclaration:()=>JDr,ConjurePrimitive:()=>MDr,ConjureType:()=>J0e,ConjureTypeDeclaration:()=>XDr,ConjureTypeReference:()=>Y0e,ConjureTypeWithDocs:()=>LDr,ConjureTypes:()=>eRr,ConjureUnionDeclaration:()=>YDr});jt();Xt();Xt();var UKa=require("fs/promises");bs();async function zKa(e,t){let r=[];for(let n of await aS(e,t))r.push(await aRf({relativeFilepath:Hs(e,n),absoluteFilepath:n}));return r}async function aRf({relativeFilepath:e,absoluteFilepath:t}){let r=(await(0,UKa.readFile)(t)).toString().replaceAll(/: rid(?:$|\s)/g,`: string
|
|
@@ -2571,7 +2571,7 @@ For more information, see https://buildwithfern.com/learn/api-definition/introdu
|
|
|
2571
2571
|
`,s+1),c=a===-1?"":o.slice(a+1);String(n.stack).endsWith(c)||(n.stack+=`
|
|
2572
2572
|
`+o)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=L7(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&CNt.assertOptions(n,{silentJSONParsing:LU.transitional(LU.boolean),forcedJSONParsing:LU.transitional(LU.boolean),clarifyTimeoutError:LU.transitional(LU.boolean),legacyInterceptorReqResOrdering:LU.transitional(LU.boolean)},!1),i!=null&&(nr.isFunction(i)?r.paramsSerializer={serialize:i}:CNt.assertOptions(i,{encode:LU.function,serialize:LU.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),CNt.assertOptions(r,{baseUrl:LU.spelling("baseURL"),withXsrfToken:LU.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=o&&nr.merge(o.common,o[r.method]);o&&nr.forEach(["delete","get","head","post","put","patch","common"],m=>{delete o[m]}),r.headers=dE.concat(s,o);let a=[],c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;c=c&&h.synchronous;let A=r.transitional||ube;A&&A.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});let u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let l,p=0,d;if(!c){let m=[AFr.bind(this),void 0];for(m.unshift(...a),m.push(...u),d=m.length,l=Promise.resolve(r);p<d;)l=l.then(m[p++],m[p++]);return l}d=a.length;let f=r;for(;p<d;){let m=a[p++],h=a[p++];try{f=m(f)}catch(A){h.call(this,A);break}}try{l=AFr.call(this,f)}catch(m){return Promise.reject(m)}for(p=0,d=u.length;p<d;)l=l.then(u[p++],u[p++]);return l}getUri(t){t=L7(this.defaults,t);let r=nQe(t.baseURL,t.url,t.allowAbsoluteUrls);return rQe(r,t.params,t.paramsSerializer)}};nr.forEach(["delete","get","head","options"],function(t){PXe.prototype[t]=function(r,n){return this.request(L7(n||{},{method:t,url:r,data:(n||{}).data}))}});nr.forEach(["post","put","patch"],function(t){function r(n){return function(o,s,a){return this.request(L7(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}PXe.prototype[t]=r(),PXe.prototype[t+"Form"]=r(!0)});var wNt=PXe;var lro=class e{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});let n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o,s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},t(function(o,s,a){n.reason||(n.reason=new k6(o,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new e(function(i){t=i}),cancel:t}}},kec=lro;function pro(e){return function(r){return e.apply(null,r)}}function fro(e){return nr.isObject(e)&&e.isAxiosError===!0}var dro={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(dro).forEach(([e,t])=>{dro[t]=e});var Nec=dro;function Qec(e){let t=new wNt(e),r=lNt(wNt.prototype.request,t);return nr.extend(r,wNt.prototype,t,{allOwnKeys:!0}),nr.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return Qec(L7(e,i))},r}var GC=Qec(_Xe);GC.Axios=wNt;GC.CanceledError=k6;GC.CancelToken=kec;GC.isCancel=gNt;GC.VERSION=sQe;GC.toFormData=cbe;GC.AxiosError=Io;GC.Cancel=GC.CanceledError;GC.all=function(t){return Promise.all(t)};GC.spread=pro;GC.isAxiosError=fro;GC.mergeConfig=L7;GC.AxiosHeaders=dE;GC.formToJSON=e=>pFr(nr.isHTMLForm(e)?new FormData(e):e);GC.getAdapter=gFr.getAdapter;GC.HttpStatusCode=Nec;GC.default=GC;var fy=GC;var{Axios:SK0,AxiosError:jec,CanceledError:_K0,isCancel:BK0,CancelToken:TK0,VERSION:OK0,all:PK0,Cancel:DK0,isAxiosError:RK0,spread:FK0,toFormData:kK0,AxiosHeaders:NK0,HttpStatusCode:QK0,formToJSON:jK0,getAdapter:MK0,mergeConfig:LK0}=fy;var trc=require("fs"),VXe=require("fs/promises");var rrc=require("os"),nrc=we(require("path"),1),irc=require("stream/promises");var Atc=we(require("events"),1),fF=we(require("fs"),1),HFr=require("events"),uno=we(require("stream"),1),ytc=require("string_decoder"),pno=we(require("path"),1),yQe=we(require("fs"),1),JFr=require("path"),Itc=require("events"),qFr=we(require("assert"),1),ybe=require("buffer"),Vec=we(require("zlib"),1),vtc=we(require("zlib"),1),AQe=require("path"),Btc=require("path"),$Nt=we(require("fs"),1),q7=we(require("fs"),1),Gro=we(require("path"),1),Rtc=require("path"),Zro=we(require("path"),1),bno=we(require("fs"),1),Ltc=we(require("assert"),1),Eno=require("crypto"),Xf=we(require("fs"),1),$C=we(require("path"),1),Ino=we(require("fs"),1),JNt=we(require("fs"),1),UXe=we(require("path"),1),NN=we(require("fs"),1),Ktc=we(require("fs/promises"),1),HNt=we(require("path"),1),vno=require("path"),kN=we(require("fs"),1),wno=we(require("path"),1),B6f=Object.defineProperty,T6f=(e,t)=>{for(var r in t)B6f(e,r,{get:t[r],enumerable:!0})},Mec=typeof process=="object"&&process?process:{stdout:null,stderr:null},O6f=e=>!!e&&typeof e=="object"&&(e instanceof vQe||e instanceof uno.default||P6f(e)||D6f(e)),P6f=e=>!!e&&typeof e=="object"&&e instanceof HFr.EventEmitter&&typeof e.pipe=="function"&&e.pipe!==uno.default.Writable.prototype.pipe,D6f=e=>!!e&&typeof e=="object"&&e instanceof HFr.EventEmitter&&typeof e.write=="function"&&typeof e.end=="function",Fue=Symbol("EOF"),kue=Symbol("maybeEmitEnd"),lbe=Symbol("emittedEnd"),bFr=Symbol("emittingEnd"),xNt=Symbol("emittedError"),EFr=Symbol("closed"),Lec=Symbol("read"),IFr=Symbol("flush"),Uec=Symbol("flushChunk"),U7=Symbol("encoding"),DXe=Symbol("decoder"),c_=Symbol("flowing"),SNt=Symbol("paused"),NXe=Symbol("resume"),u_=Symbol("buffer"),pF=Symbol("pipes"),l_=Symbol("bufferLength"),mro=Symbol("bufferPush"),vFr=Symbol("bufferShift"),tP=Symbol("objectMode"),vv=Symbol("destroyed"),hro=Symbol("error"),gro=Symbol("emitData"),zec=Symbol("emitEnd"),Aro=Symbol("emitEnd2"),VY=Symbol("async"),yro=Symbol("abort"),CFr=Symbol("aborted"),_Nt=Symbol("signal"),cQe=Symbol("dataListeners"),N6=Symbol("discarded"),BNt=e=>Promise.resolve().then(e),R6f=e=>e(),F6f=e=>e==="end"||e==="finish"||e==="prefinish",k6f=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,N6f=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),btc=class{src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[NXe](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Q6f=class extends btc{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,r){super(e,t,r),this.proxyErrors=n=>this.dest.emit("error",n),e.on("error",this.proxyErrors)}},j6f=e=>!!e.objectMode,M6f=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",vQe=class extends HFr.EventEmitter{[c_]=!1;[SNt]=!1;[pF]=[];[u_]=[];[tP];[U7];[VY];[DXe];[Fue]=!1;[lbe]=!1;[bFr]=!1;[EFr]=!1;[xNt]=null;[l_]=0;[vv]=!1;[_Nt];[CFr]=!1;[cQe]=0;[N6]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");j6f(t)?(this[tP]=!0,this[U7]=null):M6f(t)?(this[U7]=t.encoding,this[tP]=!1):(this[tP]=!1,this[U7]=null),this[VY]=!!t.async,this[DXe]=this[U7]?new ytc.StringDecoder(this[U7]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[u_]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[pF]});let{signal:r}=t;r&&(this[_Nt]=r,r.aborted?this[yro]():r.addEventListener("abort",()=>this[yro]()))}get bufferLength(){return this[l_]}get encoding(){return this[U7]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[tP]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[VY]}set async(e){this[VY]=this[VY]||!!e}[yro](){this[CFr]=!0,this.emit("abort",this[_Nt]?.reason),this.destroy(this[_Nt]?.reason)}get aborted(){return this[CFr]}set aborted(e){}write(e,t,r){if(this[CFr])return!1;if(this[Fue])throw new Error("write after end");if(this[vv])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(r=t,t="utf8"),t||(t="utf8");let n=this[VY]?BNt:R6f;if(!this[tP]&&!Buffer.isBuffer(e)){if(N6f(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(k6f(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[tP]?(this[c_]&&this[l_]!==0&&this[IFr](!0),this[c_]?this.emit("data",e):this[mro](e),this[l_]!==0&&this.emit("readable"),r&&n(r),this[c_]):e.length?(typeof e=="string"&&!(t===this[U7]&&!this[DXe]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[U7]&&(e=this[DXe].write(e)),this[c_]&&this[l_]!==0&&this[IFr](!0),this[c_]?this.emit("data",e):this[mro](e),this[l_]!==0&&this.emit("readable"),r&&n(r),this[c_]):(this[l_]!==0&&this.emit("readable"),r&&n(r),this[c_])}read(e){if(this[vv])return null;if(this[N6]=!1,this[l_]===0||e===0||e&&e>this[l_])return this[kue](),null;this[tP]&&(e=null),this[u_].length>1&&!this[tP]&&(this[u_]=[this[U7]?this[u_].join(""):Buffer.concat(this[u_],this[l_])]);let t=this[Lec](e||null,this[u_][0]);return this[kue](),t}[Lec](e,t){if(this[tP])this[vFr]();else{let r=t;e===r.length||e===null?this[vFr]():typeof r=="string"?(this[u_][0]=r.slice(e),t=r.slice(0,e),this[l_]-=e):(this[u_][0]=r.subarray(e),t=r.subarray(0,e),this[l_]-=e)}return this.emit("data",t),!this[u_].length&&!this[Fue]&&this.emit("drain"),t}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t="utf8"),e!==void 0&&this.write(e,t),r&&this.once("end",r),this[Fue]=!0,this.writable=!1,(this[c_]||!this[SNt])&&this[kue](),this}[NXe](){this[vv]||(!this[cQe]&&!this[pF].length&&(this[N6]=!0),this[SNt]=!1,this[c_]=!0,this.emit("resume"),this[u_].length?this[IFr]():this[Fue]?this[kue]():this.emit("drain"))}resume(){return this[NXe]()}pause(){this[c_]=!1,this[SNt]=!0,this[N6]=!1}get destroyed(){return this[vv]}get flowing(){return this[c_]}get paused(){return this[SNt]}[mro](e){this[tP]?this[l_]+=1:this[l_]+=e.length,this[u_].push(e)}[vFr](){return this[tP]?this[l_]-=1:this[l_]-=this[u_][0].length,this[u_].shift()}[IFr](e=!1){do;while(this[Uec](this[vFr]())&&this[u_].length);!e&&!this[u_].length&&!this[Fue]&&this.emit("drain")}[Uec](e){return this.emit("data",e),this[c_]}pipe(e,t){if(this[vv])return e;this[N6]=!1;let r=this[lbe];return t=t||{},e===Mec.stdout||e===Mec.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[pF].push(t.proxyErrors?new Q6f(this,e,t):new btc(this,e,t)),this[VY]?BNt(()=>this[NXe]()):this[NXe]()),e}unpipe(e){let t=this[pF].find(r=>r.dest===e);t&&(this[pF].length===1?(this[c_]&&this[cQe]===0&&(this[c_]=!1),this[pF]=[]):this[pF].splice(this[pF].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let r=super.on(e,t);if(e==="data")this[N6]=!1,this[cQe]++,!this[pF].length&&!this[c_]&&this[NXe]();else if(e==="readable"&&this[l_]!==0)super.emit("readable");else if(F6f(e)&&this[lbe])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[xNt]){let n=t;this[VY]?BNt(()=>n.call(this,this[xNt])):n.call(this,this[xNt])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[cQe]=this.listeners("data").length,this[cQe]===0&&!this[N6]&&!this[pF].length&&(this[c_]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[cQe]=0,!this[N6]&&!this[pF].length&&(this[c_]=!1)),t}get emittedEnd(){return this[lbe]}[kue](){!this[bFr]&&!this[lbe]&&!this[vv]&&this[u_].length===0&&this[Fue]&&(this[bFr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[EFr]&&this.emit("close"),this[bFr]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==vv&&this[vv])return!1;if(e==="data")return!this[tP]&&!r?!1:this[VY]?(BNt(()=>this[gro](r)),!0):this[gro](r);if(e==="end")return this[zec]();if(e==="close"){if(this[EFr]=!0,!this[lbe]&&!this[vv])return!1;let i=super.emit("close");return this.removeAllListeners("close"),i}else if(e==="error"){this[xNt]=r,super.emit(hro,r);let i=!this[_Nt]||this.listeners("error").length?super.emit("error",r):!1;return this[kue](),i}else if(e==="resume"){let i=super.emit("resume");return this[kue](),i}else if(e==="finish"||e==="prefinish"){let i=super.emit(e);return this.removeAllListeners(e),i}let n=super.emit(e,...t);return this[kue](),n}[gro](e){for(let r of this[pF])r.dest.write(e)===!1&&this.pause();let t=this[N6]?!1:super.emit("data",e);return this[kue](),t}[zec](){return this[lbe]?!1:(this[lbe]=!0,this.readable=!1,this[VY]?(BNt(()=>this[Aro]()),!0):this[Aro]())}[Aro](){if(this[DXe]){let t=this[DXe].end();if(t){for(let r of this[pF])r.dest.write(t);this[N6]||super.emit("data",t)}}for(let t of this[pF])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[tP]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[tP]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[tP])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[U7]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(vv,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[N6]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Fue])return t();let n,i,o=u=>{this.off("data",s),this.off("end",a),this.off(vv,c),t(),i(u)},s=u=>{this.off("error",o),this.off("end",a),this.off(vv,c),this.pause(),n({value:u,done:!!this[Fue]})},a=()=>{this.off("error",o),this.off("data",s),this.off(vv,c),t(),n({done:!0,value:void 0})},c=()=>o(new Error("stream destroyed"));return new Promise((u,l)=>{i=l,n=u,this.once(vv,c),this.once("error",o),this.once("end",a),this.once("data",s)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[N6]=!1;let e=!1,t=()=>(this.pause(),this.off(hro,t),this.off(vv,t),this.off("end",t),e=!0,{done:!0,value:void 0}),r=()=>{if(e)return t();let n=this.read();return n===null?t():{done:!1,value:n}};return this.once("end",t),this.once(hro,t),this.once(vv,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[vv])return e?this.emit("error",e):this.emit(vv),this;this[vv]=!0,this[N6]=!0,this[u_].length=0,this[l_]=0;let t=this;return typeof t.close=="function"&&!this[EFr]&&t.close(),e?this.emit("error",e):this.emit(vv),this}static get isStream(){return O6f}},L6f=fF.default.writev,Ebe=Symbol("_autoClose"),W7=Symbol("_close"),TNt=Symbol("_ended"),Qh=Symbol("_fd"),bro=Symbol("_finished"),Mue=Symbol("_flags"),Ero=Symbol("_flush"),Uro=Symbol("_handleChunk"),zro=Symbol("_makeBuf"),MNt=Symbol("_mode"),wFr=Symbol("_needDrain"),LXe=Symbol("_onerror"),zXe=Symbol("_onopen"),Iro=Symbol("_onread"),QXe=Symbol("_onwrite"),Ibe=Symbol("_open"),G7=Symbol("_path"),mbe=Symbol("_pos"),qY=Symbol("_queue"),jXe=Symbol("_read"),vro=Symbol("_readSize"),jue=Symbol("_reading"),ONt=Symbol("_remain"),Cro=Symbol("_size"),RFr=Symbol("_write"),uQe=Symbol("_writing"),FFr=Symbol("_defaultFlag"),bQe=Symbol("_errored"),lno=class extends vQe{[bQe]=!1;[Qh];[G7];[vro];[jue]=!1;[Cro];[ONt];[Ebe];constructor(e,t){if(t=t||{},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[bQe]=!1,this[Qh]=typeof t.fd=="number"?t.fd:void 0,this[G7]=e,this[vro]=t.readSize||16*1024*1024,this[jue]=!1,this[Cro]=typeof t.size=="number"?t.size:1/0,this[ONt]=this[Cro],this[Ebe]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[Qh]=="number"?this[jXe]():this[Ibe]()}get fd(){return this[Qh]}get path(){return this[G7]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Ibe](){fF.default.open(this[G7],"r",(e,t)=>this[zXe](e,t))}[zXe](e,t){e?this[LXe](e):(this[Qh]=t,this.emit("open",t),this[jXe]())}[zro](){return Buffer.allocUnsafe(Math.min(this[vro],this[ONt]))}[jXe](){if(!this[jue]){this[jue]=!0;let e=this[zro]();if(e.length===0)return process.nextTick(()=>this[Iro](null,0,e));fF.default.read(this[Qh],e,0,e.length,null,(t,r,n)=>this[Iro](t,r,n))}}[Iro](e,t,r){this[jue]=!1,e?this[LXe](e):this[Uro](t,r)&&this[jXe]()}[W7](){if(this[Ebe]&&typeof this[Qh]=="number"){let e=this[Qh];this[Qh]=void 0,fF.default.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[LXe](e){this[jue]=!0,this[W7](),this.emit("error",e)}[Uro](e,t){let r=!1;return this[ONt]-=e,e>0&&(r=super.write(e<t.length?t.subarray(0,e):t)),(e===0||this[ONt]<=0)&&(r=!1,this[W7](),super.end()),r}emit(e,...t){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[Qh]=="number"&&this[jXe](),!1;case"error":return this[bQe]?!1:(this[bQe]=!0,super.emit(e,...t));default:return super.emit(e,...t)}}},U6f=class extends lno{[Ibe](){let e=!0;try{this[zXe](null,fF.default.openSync(this[G7],"r")),e=!1}finally{e&&this[W7]()}}[jXe](){let e=!0;try{if(!this[jue]){this[jue]=!0;do{let t=this[zro](),r=t.length===0?0:fF.default.readSync(this[Qh],t,0,t.length,null);if(!this[Uro](r,t))break}while(!0);this[jue]=!1}e=!1}finally{e&&this[W7]()}}[W7](){if(this[Ebe]&&typeof this[Qh]=="number"){let e=this[Qh];this[Qh]=void 0,fF.default.closeSync(e),this.emit("close")}}},KFr=class extends Atc.default{readable=!1;writable=!0;[bQe]=!1;[uQe]=!1;[TNt]=!1;[qY]=[];[wFr]=!1;[G7];[MNt];[Ebe];[Qh];[FFr];[Mue];[bro]=!1;[mbe];constructor(e,t){t=t||{},super(t),this[G7]=e,this[Qh]=typeof t.fd=="number"?t.fd:void 0,this[MNt]=t.mode===void 0?438:t.mode,this[mbe]=typeof t.start=="number"?t.start:void 0,this[Ebe]=typeof t.autoClose=="boolean"?t.autoClose:!0;let r=this[mbe]!==void 0?"r+":"w";this[FFr]=t.flags===void 0,this[Mue]=t.flags===void 0?r:t.flags,this[Qh]===void 0&&this[Ibe]()}emit(e,...t){if(e==="error"){if(this[bQe])return!1;this[bQe]=!0}return super.emit(e,...t)}get fd(){return this[Qh]}get path(){return this[G7]}[LXe](e){this[W7](),this[uQe]=!0,this.emit("error",e)}[Ibe](){fF.default.open(this[G7],this[Mue],this[MNt],(e,t)=>this[zXe](e,t))}[zXe](e,t){this[FFr]&&this[Mue]==="r+"&&e&&e.code==="ENOENT"?(this[Mue]="w",this[Ibe]()):e?this[LXe](e):(this[Qh]=t,this.emit("open",t),this[uQe]||this[Ero]())}end(e,t){return e&&this.write(e,t),this[TNt]=!0,!this[uQe]&&!this[qY].length&&typeof this[Qh]=="number"&&this[QXe](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[TNt]?(this.emit("error",new Error("write() after end()")),!1):this[Qh]===void 0||this[uQe]||this[qY].length?(this[qY].push(e),this[wFr]=!0,!1):(this[uQe]=!0,this[RFr](e),!0)}[RFr](e){fF.default.write(this[Qh],e,0,e.length,this[mbe],(t,r)=>this[QXe](t,r))}[QXe](e,t){e?this[LXe](e):(this[mbe]!==void 0&&typeof t=="number"&&(this[mbe]+=t),this[qY].length?this[Ero]():(this[uQe]=!1,this[TNt]&&!this[bro]?(this[bro]=!0,this[W7](),this.emit("finish")):this[wFr]&&(this[wFr]=!1,this.emit("drain"))))}[Ero](){if(this[qY].length===0)this[TNt]&&this[QXe](null,0);else if(this[qY].length===1)this[RFr](this[qY].pop());else{let e=this[qY];this[qY]=[],L6f(this[Qh],e,this[mbe],(t,r)=>this[QXe](t,r))}}[W7](){if(this[Ebe]&&typeof this[Qh]=="number"){let e=this[Qh];this[Qh]=void 0,fF.default.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},Etc=class extends KFr{[Ibe](){let e;if(this[FFr]&&this[Mue]==="r+")try{e=fF.default.openSync(this[G7],this[Mue],this[MNt])}catch(t){if(t?.code==="ENOENT")return this[Mue]="w",this[Ibe]();throw t}else e=fF.default.openSync(this[G7],this[Mue],this[MNt]);this[zXe](null,e)}[W7](){if(this[Ebe]&&typeof this[Qh]=="number"){let e=this[Qh];this[Qh]=void 0,fF.default.closeSync(e),this.emit("close")}}[RFr](e){let t=!0;try{this[QXe](null,fF.default.writeSync(this[Qh],e,0,e.length,this[mbe])),t=!1}finally{if(t)try{this[W7]()}catch{}}}},z6f=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),V6f=e=>!!e.sync&&!!e.file,q6f=e=>!e.sync&&!!e.file,G6f=e=>!!e.sync&&!e.file,W6f=e=>!e.sync&&!e.file,$6f=e=>!!e.file,H6f=e=>z6f.get(e)||e,fno=(e={})=>{if(!e)return{};let t={};for(let[r,n]of Object.entries(e)){let i=H6f(r);t[i]=n}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t},KNt=(e,t,r,n,i)=>Object.assign((o=[],s,a)=>{Array.isArray(o)&&(s=o,o={}),typeof s=="function"&&(a=s,s=void 0),s=s?Array.from(s):[];let c=fno(o);if(i?.(c,s),V6f(c)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return e(c,s)}else if(q6f(c)){let u=t(c,s);return a?u.then(()=>a(),a):u}else if(G6f(c)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return r(c,s)}else if(W6f(c)){if(typeof a=="function")throw new TypeError("callback only supported with file option");return n(c,s)}throw new Error("impossible options??")},{syncFile:e,asyncFile:t,syncNoFile:r,asyncNoFile:n,validate:i}),K6f=vtc.default.constants||{ZLIB_VERNUM:4736},$Y=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},K6f)),J6f=ybe.Buffer.concat,qec=Object.getOwnPropertyDescriptor(ybe.Buffer,"concat"),Y6f=e=>e,wro=qec?.writable===!0||qec?.set!==void 0?e=>{ybe.Buffer.concat=e?Y6f:J6f}:e=>{},EQe=Symbol("_superWrite"),xFr=class extends Error{code;errno;constructor(e,t){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,t??this.constructor)}get name(){return"ZlibError"}},xro=Symbol("flushFlag"),dno=class extends vQe{#e=!1;#t=!1;#r;#n;#i;#o;#s;get sawError(){return this.#e}get handle(){return this.#o}get flushFlag(){return this.#r}constructor(e,t){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(e),this.#r=e.flush??0,this.#n=e.finishFlush??0,this.#i=e.fullFlushFlag??0,typeof Vec[t]!="function")throw new TypeError("Compression method not supported: "+t);try{this.#o=new Vec[t](e)}catch(r){throw new xFr(r,this.constructor)}this.#s=r=>{this.#e||(this.#e=!0,this.close(),this.emit("error",r))},this.#o?.on("error",r=>this.#s(new xFr(r))),this.once("end",()=>this.close)}close(){this.#o&&(this.#o.close(),this.#o=void 0,this.emit("close"))}reset(){if(!this.#e)return(0,qFr.default)(this.#o,"zlib binding closed"),this.#o.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#i),this.write(Object.assign(ybe.Buffer.alloc(0),{[xro]:e})))}end(e,t,r){return typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#n),this.#t=!0,super.end(r)}get ended(){return this.#t}[EQe](e){return super.write(e)}write(e,t,r){if(typeof t=="function"&&(r=t,t="utf8"),typeof e=="string"&&(e=ybe.Buffer.from(e,t)),this.#e)return;(0,qFr.default)(this.#o,"zlib binding closed");let n=this.#o._handle,i=n.close;n.close=()=>{};let o=this.#o.close;this.#o.close=()=>{},wro(!0);let s;try{let c=typeof e[xro]=="number"?e[xro]:this.#r;s=this.#o._processChunk(e,c),wro(!1)}catch(c){wro(!1),this.#s(new xFr(c,this.write))}finally{this.#o&&(this.#o._handle=n,n.close=i,this.#o.close=o,this.#o.removeAllListeners("error"))}this.#o&&this.#o.on("error",c=>this.#s(new xFr(c,this.write)));let a;if(s)if(Array.isArray(s)&&s.length>0){let c=s[0];a=this[EQe](ybe.Buffer.from(c));for(let u=1;u<s.length;u++)a=this[EQe](s[u])}else a=this[EQe](ybe.Buffer.from(s));return r&&r(),a}},Ctc=class extends dno{#e;#t;constructor(e,t){e=e||{},e.flush=e.flush||$Y.Z_NO_FLUSH,e.finishFlush=e.finishFlush||$Y.Z_FINISH,e.fullFlushFlag=$Y.Z_FULL_FLUSH,super(e,t),this.#e=e.level,this.#t=e.strategy}params(e,t){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#e!==e||this.#t!==t){this.flush($Y.Z_SYNC_FLUSH),(0,qFr.default)(this.handle,"zlib binding closed");let r=this.handle.flush;this.handle.flush=(n,i)=>{typeof n=="function"&&(i=n,n=this.flushFlag),this.flush(n),i?.()};try{this.handle.params(e,t)}finally{this.handle.flush=r}this.handle&&(this.#e=e,this.#t=t)}}}},X6f=class extends Ctc{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[EQe](e){return this.#e?(this.#e=!1,e[9]=255,super[EQe](e)):super[EQe](e)}},Z6f=class extends Ctc{constructor(e){super(e,"Unzip")}},wtc=class extends dno{constructor(e,t){e=e||{},e.flush=e.flush||$Y.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||$Y.BROTLI_OPERATION_FINISH,e.fullFlushFlag=$Y.BROTLI_OPERATION_FLUSH,super(e,t)}},eLf=class extends wtc{constructor(e){super(e,"BrotliCompress")}},tLf=class extends wtc{constructor(e){super(e,"BrotliDecompress")}},xtc=class extends dno{constructor(e,t){e=e||{},e.flush=e.flush||$Y.ZSTD_e_continue,e.finishFlush=e.finishFlush||$Y.ZSTD_e_end,e.fullFlushFlag=$Y.ZSTD_e_flush,super(e,t)}},rLf=class extends xtc{constructor(e){super(e,"ZstdCompress")}},nLf=class extends xtc{constructor(e){super(e,"ZstdDecompress")}},iLf=(e,t)=>{if(Number.isSafeInteger(e))e<0?sLf(e,t):oLf(e,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},oLf=(e,t)=>{t[0]=128;for(var r=t.length;r>1;r--)t[r-1]=e&255,e=Math.floor(e/256)},sLf=(e,t)=>{t[0]=255;var r=!1;e=e*-1;for(var n=t.length;n>1;n--){var i=e&255;e=Math.floor(e/256),r?t[n-1]=Stc(i):i===0?t[n-1]=0:(r=!0,t[n-1]=_tc(i))}},aLf=e=>{let t=e[0],r=t===128?uLf(e.subarray(1,e.length)):t===255?cLf(e):null;if(r===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(r))throw Error("parsed number outside of javascript safe integer range");return r},cLf=e=>{for(var t=e.length,r=0,n=!1,i=t-1;i>-1;i--){var o=Number(e[i]),s;n?s=Stc(o):o===0?s=o:(n=!0,s=_tc(o)),s!==0&&(r-=s*Math.pow(256,t-i-1))}return r},uLf=e=>{for(var t=e.length,r=0,n=t-1;n>-1;n--){var i=Number(e[n]);i!==0&&(r+=i*Math.pow(256,t-n-1))}return r},Stc=e=>(255^e)&255,_tc=e=>(255^e)+1&255,lLf={};T6f(lLf,{code:()=>mno,isCode:()=>kFr,isName:()=>pLf,name:()=>YFr});var kFr=e=>YFr.has(e),pLf=e=>mno.has(e),YFr=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),mno=new Map(Array.from(YFr).map(e=>[e[1],e[0]])),IQe=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,r,n){Buffer.isBuffer(e)?this.decode(e,t||0,r,n):e&&this.#t(e)}decode(e,t,r,n){if(t||(t=0),!e||!(e.length>=t+512))throw new Error("need 512 bytes for header");this.path=r?.path??lQe(e,t,100),this.mode=r?.mode??n?.mode??hbe(e,t+100,8),this.uid=r?.uid??n?.uid??hbe(e,t+108,8),this.gid=r?.gid??n?.gid??hbe(e,t+116,8),this.size=r?.size??n?.size??hbe(e,t+124,12),this.mtime=r?.mtime??n?.mtime??Sro(e,t+136,12),this.cksum=hbe(e,t+148,12),n&&this.#t(n,!0),r&&this.#t(r);let i=lQe(e,t+156,1);if(kFr(i)&&(this.#e=i||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=lQe(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=r?.uname??n?.uname??lQe(e,t+265,32),this.gname=r?.gname??n?.gname??lQe(e,t+297,32),this.devmaj=r?.devmaj??n?.devmaj??hbe(e,t+329,8)??0,this.devmin=r?.devmin??n?.devmin??hbe(e,t+337,8)??0,e[t+475]!==0){let s=lQe(e,t+345,155);this.path=s+"/"+this.path}else{let s=lQe(e,t+345,130);s&&(this.path=s+"/"+this.path),this.atime=r?.atime??n?.atime??Sro(e,t+476,12),this.ctime=r?.ctime??n?.ctime??Sro(e,t+488,12)}let o=256;for(let s=t;s<t+148;s++)o+=e[s];for(let s=t+156;s<t+512;s++)o+=e[s];this.cksumValid=o===this.cksum,this.cksum===void 0&&o===256&&(this.nullBlock=!0)}#t(e,t=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([r,n])=>!(n==null||r==="path"&&t||r==="linkpath"&&t||r==="global"))))}encode(e,t=0){if(e||(e=this.block=Buffer.alloc(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw new Error("need 512 bytes for header");let r=this.ctime||this.atime?130:155,n=fLf(this.path||"",r),i=n[0],o=n[1];this.needPax=!!n[2],this.needPax=pQe(e,t,100,i)||this.needPax,this.needPax=gbe(e,t+100,8,this.mode)||this.needPax,this.needPax=gbe(e,t+108,8,this.uid)||this.needPax,this.needPax=gbe(e,t+116,8,this.gid)||this.needPax,this.needPax=gbe(e,t+124,12,this.size)||this.needPax,this.needPax=_ro(e,t+136,12,this.mtime)||this.needPax,e[t+156]=Number(this.#e.codePointAt(0)),this.needPax=pQe(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=pQe(e,t+265,32,this.uname)||this.needPax,this.needPax=pQe(e,t+297,32,this.gname)||this.needPax,this.needPax=gbe(e,t+329,8,this.devmaj)||this.needPax,this.needPax=gbe(e,t+337,8,this.devmin)||this.needPax,this.needPax=pQe(e,t+345,r,o)||this.needPax,e[t+475]!==0?this.needPax=pQe(e,t+345,155,o)||this.needPax:(this.needPax=pQe(e,t+345,130,o)||this.needPax,this.needPax=_ro(e,t+476,12,this.atime)||this.needPax,this.needPax=_ro(e,t+488,12,this.ctime)||this.needPax);let s=256;for(let a=t;a<t+148;a++)s+=e[a];for(let a=t+156;a<t+512;a++)s+=e[a];return this.cksum=s,gbe(e,t+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:YFr.get(this.#e)}get typeKey(){return this.#e}set type(e){let t=String(mno.get(e));if(kFr(t)||t==="Unsupported")this.#e=t;else if(kFr(e))this.#e=e;else throw new TypeError("invalid entry type: "+e)}},fLf=(e,t)=>{let r=e,n="",i,o=AQe.posix.parse(e).root||".";if(Buffer.byteLength(r)<100)i=[r,n,!1];else{n=AQe.posix.dirname(r),r=AQe.posix.basename(r);do Buffer.byteLength(r)<=100&&Buffer.byteLength(n)<=t?i=[r,n,!1]:Buffer.byteLength(r)>100&&Buffer.byteLength(n)<=t?i=[r.slice(0,99),n,!0]:(r=AQe.posix.join(AQe.posix.basename(n),r),n=AQe.posix.dirname(n));while(n!==o&&i===void 0);i||(i=[e.slice(0,99),"",!0])}return i},lQe=(e,t,r)=>e.subarray(t,t+r).toString("utf8").replace(/\0.*/,""),Sro=(e,t,r)=>dLf(hbe(e,t,r)),dLf=e=>e===void 0?void 0:new Date(e*1e3),hbe=(e,t,r)=>Number(e[t])&128?aLf(e.subarray(t,t+r)):hLf(e,t,r),mLf=e=>isNaN(e)?void 0:e,hLf=(e,t,r)=>mLf(parseInt(e.subarray(t,t+r).toString("utf8").replace(/\0.*$/,"").trim(),8)),gLf={12:8589934591,8:2097151},gbe=(e,t,r,n)=>n===void 0?!1:n>gLf[r]||n<0?(iLf(n,e.subarray(t,t+r)),!0):(ALf(e,t,r,n),!1),ALf=(e,t,r,n)=>e.write(yLf(n,r),t,r,"ascii"),yLf=(e,t)=>bLf(Math.floor(e).toString(8),t),bLf=(e,t)=>(e.length===t-1?e:new Array(t-e.length-1).join("0")+e+" ")+"\0",_ro=(e,t,r,n)=>n===void 0?!1:gbe(e,t,r,n.getTime()/1e3),ELf=new Array(156).join("\0"),pQe=(e,t,r,n)=>n===void 0?!1:(e.write(n+ELf,t,r,"utf8"),n.length!==Buffer.byteLength(n)||n.length>r),GFr=class Ttc{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,r=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=r,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let r=Buffer.byteLength(t),n=512*Math.ceil(1+r/512),i=Buffer.allocUnsafe(n);for(let o=0;o<512;o++)i[o]=0;new IQe({path:("PaxHeader/"+(0,Btc.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:r,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(i),i.write(t,512,r,"utf8");for(let o=r+512;o<i.length;o++)i[o]=0;return i}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===void 0)return"";let r=this[t],n=r instanceof Date?r.getTime()/1e3:r,i=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+n+`
|
|
2573
2573
|
`,o=Buffer.byteLength(i),s=Math.floor(Math.log(o)/Math.log(10))+1;return o+s>=Math.pow(10,s)&&(s+=1),s+o+i}static parse(t,r,n=!1){return new Ttc(ILf(vLf(t),r),n)}},ILf=(e,t)=>t?Object.assign({},t,e):e,vLf=e=>e.replace(/\n$/,"").split(`
|
|
2574
|
-
`).reduce(CLf,Object.create(null)),CLf=(e,t)=>{let r=parseInt(t,10);if(r!==Buffer.byteLength(t)+1)return e;t=t.slice((r+" ").length);let n=t.split("="),i=n.shift();if(!i)return e;let o=i.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),s=n.join("=");return e[o]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(o)?new Date(Number(s)*1e3):/^[0-9]+$/.test(s)?+s:s,e},wLf=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Xp=wLf!=="win32"?e=>e:e=>e&&e.replaceAll(/\\/g,"/"),Otc=class extends vQe{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,t,r){switch(super({}),this.pause(),this.extended=t,this.globalExtended=r,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=Xp(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?Xp(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),r&&this.#e(r,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw new Error("writing more to entry than is appropriate");let r=this.remain,n=this.blockRemain;return this.remain=Math.max(0,r-t),this.blockRemain=Math.max(0,n-t),this.ignore?!0:r>=t?super.write(e):super.write(e.subarray(0,r))}#e(e,t=!1){e.path&&(e.path=Xp(e.path)),e.linkpath&&(e.linkpath=Xp(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([r,n])=>!(n==null||r==="path"&&t))))}},XFr=(e,t,r,n={})=>{e.file&&(n.file=e.file),e.cwd&&(n.cwd=e.cwd),n.code=r instanceof Error&&r.code||t,n.tarCode=t,!e.strict&&n.recoverable!==!1?(r instanceof Error&&(n=Object.assign(r,n),r=r.message),e.emit("warn",t,r,n)):r instanceof Error?e.emit("error",Object.assign(r,n)):e.emit("error",Object.assign(new Error(`${t}: ${r}`),n))},xLf=1024*1024,Vro=Buffer.from([31,139]),qro=Buffer.from([40,181,47,253]),SLf=Math.max(Vro.length,qro.length),UU=Symbol("state"),fQe=Symbol("writeEntry"),Nue=Symbol("readEntry"),Bro=Symbol("nextEntry"),Gec=Symbol("processEntry"),GY=Symbol("extendedHeader"),PNt=Symbol("globalExtendedHeader"),pbe=Symbol("meta"),Wec=Symbol("emitMeta"),I0=Symbol("buffer"),Que=Symbol("queue"),fbe=Symbol("ended"),Tro=Symbol("emittedEnd"),dQe=Symbol("emit"),WC=Symbol("unzip"),SFr=Symbol("consumeChunk"),_Fr=Symbol("consumeChunkSub"),Oro=Symbol("consumeBody"),$ec=Symbol("consumeMeta"),Hec=Symbol("consumeHeader"),DNt=Symbol("consuming"),Pro=Symbol("bufferConcat"),BFr=Symbol("maybeEnd"),RXe=Symbol("writing"),dbe=Symbol("aborted"),TFr=Symbol("onDone"),mQe=Symbol("sawValidEntry"),OFr=Symbol("sawNullBlock"),PFr=Symbol("sawEOF"),Kec=Symbol("closeStream"),_Lf=()=>!0,WNt=class extends Itc.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[Que]=[];[I0];[Nue];[fQe];[UU]="begin";[pbe]="";[GY];[PNt];[fbe]=!1;[WC];[dbe]=!1;[mQe];[OFr]=!1;[PFr]=!1;[RXe]=!1;[DNt]=!1;[Tro]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(TFr,()=>{(this[UU]==="begin"||this[mQe]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(TFr,e.ondone):this.on(TFr,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||xLf,this.filter=typeof e.filter=="function"?e.filter:_Lf;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:t?void 0:!1;let r=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:r?!0:void 0,this.on("end",()=>this[Kec]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,r={}){XFr(this,e,t,r)}[Hec](e,t){this[mQe]===void 0&&(this[mQe]=!1);let r;try{r=new IQe(e,t,this[GY],this[PNt])}catch(n){return this.warn("TAR_ENTRY_INVALID",n)}if(r.nullBlock)this[OFr]?(this[PFr]=!0,this[UU]==="begin"&&(this[UU]="header"),this[dQe]("eof")):(this[OFr]=!0,this[dQe]("nullBlock"));else if(this[OFr]=!1,!r.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:r});else if(!r.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:r});else{let n=r.type;if(/^(Symbolic)?Link$/.test(n)&&!r.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:r});else if(!/^(Symbolic)?Link$/.test(n)&&!/^(Global)?ExtendedHeader$/.test(n)&&r.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:r});else{let i=this[fQe]=new Otc(r,this[GY],this[PNt]);if(!this[mQe])if(i.remain){let o=()=>{i.invalid||(this[mQe]=!0)};i.on("end",o)}else this[mQe]=!0;i.meta?i.size>this.maxMetaEntrySize?(i.ignore=!0,this[dQe]("ignoredEntry",i),this[UU]="ignore",i.resume()):i.size>0&&(this[pbe]="",i.on("data",o=>this[pbe]+=o),this[UU]="meta"):(this[GY]=void 0,i.ignore=i.ignore||!this.filter(i.path,i),i.ignore?(this[dQe]("ignoredEntry",i),this[UU]=i.remain?"ignore":"header",i.resume()):(i.remain?this[UU]="body":(this[UU]="header",i.end()),this[Nue]?this[Que].push(i):(this[Que].push(i),this[Bro]())))}}}[Kec](){queueMicrotask(()=>this.emit("close"))}[Gec](e){let t=!0;if(!e)this[Nue]=void 0,t=!1;else if(Array.isArray(e)){let[r,...n]=e;this.emit(r,...n)}else this[Nue]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[Bro]()),t=!1);return t}[Bro](){do;while(this[Gec](this[Que].shift()));if(this[Que].length===0){let e=this[Nue];!e||e.flowing||e.size===e.remain?this[RXe]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[Oro](e,t){let r=this[fQe];if(!r)throw new Error("attempt to consume body without entry??");let n=r.blockRemain??0,i=n>=e.length&&t===0?e:e.subarray(t,t+n);return r.write(i),r.blockRemain||(this[UU]="header",this[fQe]=void 0,r.end()),i.length}[$ec](e,t){let r=this[fQe],n=this[Oro](e,t);return!this[fQe]&&r&&this[Wec](r),n}[dQe](e,t,r){this[Que].length===0&&!this[Nue]?this.emit(e,t,r):this[Que].push([e,t,r])}[Wec](e){switch(this[dQe]("meta",this[pbe]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[GY]=GFr.parse(this[pbe],this[GY],!1);break;case"GlobalExtendedHeader":this[PNt]=GFr.parse(this[pbe],this[PNt],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[GY]??Object.create(null);this[GY]=t,t.path=this[pbe].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[GY]||Object.create(null);this[GY]=t,t.linkpath=this[pbe].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[dbe]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,r){if(typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[dbe])return r?.(),!1;if((this[WC]===void 0||this.brotli===void 0&&this[WC]===!1)&&e){if(this[I0]&&(e=Buffer.concat([this[I0],e]),this[I0]=void 0),e.length<SLf)return this[I0]=e,r?.(),!0;for(let s=0;this[WC]===void 0&&s<Vro.length;s++)e[s]!==Vro[s]&&(this[WC]=!1);let i=!1;if(this[WC]===!1&&this.zstd!==!1){i=!0;for(let s=0;s<qro.length;s++)if(e[s]!==qro[s]){i=!1;break}}let o=this.brotli===void 0&&!i;if(this[WC]===!1&&o)if(e.length<512)if(this[fbe])this.brotli=!0;else return this[I0]=e,r?.(),!0;else try{new IQe(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[WC]===void 0||this[WC]===!1&&(this.brotli||i)){let s=this[fbe];this[fbe]=!1,this[WC]=this[WC]===void 0?new Z6f({}):i?new nLf({}):new tLf({}),this[WC].on("data",c=>this[SFr](c)),this[WC].on("error",c=>this.abort(c)),this[WC].on("end",()=>{this[fbe]=!0,this[SFr]()}),this[RXe]=!0;let a=!!this[WC][s?"end":"write"](e);return this[RXe]=!1,r?.(),a}}this[RXe]=!0,this[WC]?this[WC].write(e):this[SFr](e),this[RXe]=!1;let n=this[Que].length>0?!1:this[Nue]?this[Nue].flowing:!0;return!n&&this[Que].length===0&&this[Nue]?.once("drain",()=>this.emit("drain")),r?.(),n}[Pro](e){e&&!this[dbe]&&(this[I0]=this[I0]?Buffer.concat([this[I0],e]):e)}[BFr](){if(this[fbe]&&!this[Tro]&&!this[dbe]&&!this[DNt]){this[Tro]=!0;let e=this[fQe];if(e&&e.blockRemain){let t=this[I0]?this[I0].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[I0]&&e.write(this[I0]),e.end()}this[dQe](TFr)}}[SFr](e){if(this[DNt]&&e)this[Pro](e);else if(!e&&!this[I0])this[BFr]();else if(e){if(this[DNt]=!0,this[I0]){this[Pro](e);let t=this[I0];this[I0]=void 0,this[_Fr](t)}else this[_Fr](e);for(;this[I0]&&this[I0]?.length>=512&&!this[dbe]&&!this[PFr];){let t=this[I0];this[I0]=void 0,this[_Fr](t)}this[DNt]=!1}(!this[I0]||this[fbe])&&this[BFr]()}[_Fr](e){let t=0,r=e.length;for(;t+512<=r&&!this[dbe]&&!this[PFr];)switch(this[UU]){case"begin":case"header":this[Hec](e,t),t+=512;break;case"ignore":case"body":t+=this[Oro](e,t);break;case"meta":t+=this[$ec](e,t);break;default:throw new Error("invalid state: "+this[UU])}t<r&&(this[I0]=this[I0]?Buffer.concat([e.subarray(t),this[I0]]):e.subarray(t))}end(e,t,r){return typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t)),r&&this.once("finish",r),this[dbe]||(this[WC]?(e&&this[WC].write(e),this[WC].end()):(this[fbe]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[BFr]())),this}},LNt=e=>{let t=e.length-1,r=-1;for(;t>-1&&e.charAt(t)==="/";)r=t,t--;return r===-1?e:e.slice(0,r)},BLf=e=>{let t=e.onReadEntry;e.onReadEntry=t?r=>{t(r),r.resume()}:r=>r.resume()},Ptc=(e,t)=>{let r=new Map(t.map(o=>[LNt(o),!0])),n=e.filter,i=(o,s="")=>{let a=s||(0,JFr.parse)(o).root||".",c;if(o===a)c=!1;else{let u=r.get(o);c=u!==void 0?u:i((0,JFr.dirname)(o),a)}return r.set(o,c),c};e.filter=n?(o,s)=>n(o,s)&&i(LNt(o)):o=>i(LNt(o))},TLf=e=>{let t=new WNt(e),r=e.file,n;try{n=yQe.default.openSync(r,"r");let i=yQe.default.fstatSync(n),o=e.maxReadSize||16*1024*1024;if(i.size<o){let s=Buffer.allocUnsafe(i.size),a=yQe.default.readSync(n,s,0,i.size,0);t.end(a===s.byteLength?s:s.subarray(0,a))}else{let s=0,a=Buffer.allocUnsafe(o);for(;s<i.size;){let c=yQe.default.readSync(n,a,0,o,s);if(c===0)break;s+=c,t.write(a.subarray(0,c))}t.end()}}finally{if(typeof n=="number")try{yQe.default.closeSync(n)}catch{}}},OLf=(e,t)=>{let r=new WNt(e),n=e.maxReadSize||16*1024*1024,i=e.file;return new Promise((o,s)=>{r.on("error",s),r.on("end",o),yQe.default.stat(i,(a,c)=>{if(a)s(a);else{let u=new lno(i,{readSize:n,size:c.size});u.on("error",s),u.pipe(r)}})})},ZFr=KNt(TLf,OLf,e=>new WNt(e),e=>new WNt(e),(e,t)=>{t?.length&&Ptc(e,t),e.noResume||BLf(e)}),Dtc=(e,t,r)=>(e&=4095,r&&(e=(e|384)&-19),t&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),{isAbsolute:PLf,parse:Jec}=Rtc.win32,hno=e=>{let t="",r=Jec(e);for(;PLf(e)||r.root;){let n=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":r.root;e=e.slice(n.length),t+=n,r=Jec(e)}return[t,e]},e2r=["|","<",">","?",":"],gno=e2r.map(e=>String.fromCodePoint(61440+Number(e.codePointAt(0)))),DLf=new Map(e2r.map((e,t)=>[e,gno[t]])),RLf=new Map(gno.map((e,t)=>[e,e2r[t]])),Yec=e=>e2r.reduce((t,r)=>t.split(r).join(DLf.get(r)),e),FLf=e=>gno.reduce((t,r)=>t.split(r).join(RLf.get(r)),e),Ftc=(e,t)=>t?(e=Xp(e).replace(/^\.(\/|$)/,""),LNt(t)+"/"+e):Xp(e),kLf=16*1024*1024,Xec=Symbol("process"),Zec=Symbol("file"),etc=Symbol("directory"),Wro=Symbol("symlink"),ttc=Symbol("hardlink"),RNt=Symbol("header"),NFr=Symbol("read"),$ro=Symbol("lstat"),QFr=Symbol("onlstat"),Hro=Symbol("onread"),Kro=Symbol("onreadlink"),Jro=Symbol("openfile"),Yro=Symbol("onopenfile"),Abe=Symbol("close"),WFr=Symbol("mode"),Xro=Symbol("awaitDrain"),Dro=Symbol("ondrain"),WY=Symbol("prefix"),ktc=class extends vQe{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,t={}){let r=fno(t);super(),this.path=Xp(e),this.portable=!!r.portable,this.maxReadSize=r.maxReadSize||kLf,this.linkCache=r.linkCache||new Map,this.statCache=r.statCache||new Map,this.preservePaths=!!r.preservePaths,this.cwd=Xp(r.cwd||process.cwd()),this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.mtime=r.mtime,this.prefix=r.prefix?Xp(r.prefix):void 0,this.onWriteEntry=r.onWriteEntry,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let n=!1;if(!this.preservePaths){let[o,s]=hno(this.path);o&&typeof s=="string"&&(this.path=s,n=o)}this.win32=!!r.win32||process.platform==="win32",this.win32&&(this.path=FLf(this.path.replaceAll(/\\/g,"/")),e=e.replaceAll(/\\/g,"/")),this.absolute=Xp(r.absolute||Gro.default.resolve(this.cwd,e)),this.path===""&&(this.path="./"),n&&this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path});let i=this.statCache.get(this.absolute);i?this[QFr](i):this[$ro]()}warn(e,t,r={}){return XFr(this,e,t,r)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[$ro](){q7.default.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[QFr](t)})}[QFr](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=jLf(e),this.emit("stat",e),this[Xec]()}[Xec](){switch(this.type){case"File":return this[Zec]();case"Directory":return this[etc]();case"SymbolicLink":return this[Wro]();default:return this.end()}}[WFr](e){return Dtc(e,this.type==="Directory",this.portable)}[WY](e){return Ftc(e,this.prefix)}[RNt](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new IQe({path:this[WY](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[WY](this.linkpath):this.linkpath,mode:this[WFr](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new GFr({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[WY](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[WY](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e)}[etc](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[RNt](),this.end()}[Wro](){q7.default.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Kro](t)})}[Kro](e){this.linkpath=Xp(e),this[RNt](),this.end()}[ttc](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=Xp(Gro.default.relative(this.cwd,e)),this.stat.size=0,this[RNt](),this.end()}[Zec](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[ttc](t);this.linkCache.set(e,this.absolute)}if(this[RNt](),this.stat.size===0)return this.end();this[Jro]()}[Jro](){q7.default.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[Yro](t)})}[Yro](e){if(this.fd=e,this.#e)return this[Abe]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[NFr]()}[NFr](){let{fd:e,buf:t,offset:r,length:n,pos:i}=this;if(e===void 0||t===void 0)throw new Error("cannot read file without first opening");q7.default.read(e,t,r,n,i,(o,s)=>{if(o)return this[Abe](()=>this.emit("error",o));this[Hro](s)})}[Abe](e=()=>{}){this.fd!==void 0&&q7.default.close(this.fd,e)}[Hro](e){if(e<=0&&this.remain>0){let r=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Abe](()=>this.emit("error",r))}if(e>this.remain){let r=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Abe](()=>this.emit("error",r))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let r=e;r<this.length&&e<this.blockRemain;r++)this.buf[r+this.offset]=0,e++,this.remain++;let t=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(t)?this[Dro]():this[Xro](()=>this[Dro]())}[Xro](e){this.once("drain",e)}write(e,t,r){if(typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemain<e.length){let n=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",n)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,r)}[Dro](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[Abe](e=>e?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[NFr]()}},NLf=class extends ktc{sync=!0;[$ro](){this[QFr](q7.default.lstatSync(this.absolute))}[Wro](){this[Kro](q7.default.readlinkSync(this.absolute))}[Jro](){this[Yro](q7.default.openSync(this.absolute,"r"))}[NFr](){let e=!0;try{let{fd:t,buf:r,offset:n,length:i,pos:o}=this;if(t===void 0||r===void 0)throw new Error("fd and buf must be set in READ method");let s=q7.default.readSync(t,r,n,i,o);this[Hro](s),e=!1}finally{if(e)try{this[Abe](()=>{})}catch{}}}[Xro](e){e()}[Abe](e=()=>{}){this.fd!==void 0&&q7.default.closeSync(this.fd),e()}},QLf=class extends vQe{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,t,r={}){return XFr(this,e,t,r)}constructor(e,t={}){let r=fno(t);super(),this.preservePaths=!!r.preservePaths,this.portable=!!r.portable,this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.onWriteEntry=r.onWriteEntry,this.readEntry=e;let{type:n}=e;if(n==="Unsupported")throw new Error("writing entry that should be ignored");this.type=n,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=r.prefix,this.path=Xp(e.path),this.mode=e.mode!==void 0?this[WFr](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:r.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?Xp(e.linkpath):void 0,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let i=!1;if(!this.preservePaths){let[s,a]=hno(this.path);s&&typeof a=="string"&&(this.path=a,i=s)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new IQe({path:this[WY](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[WY](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path}),this.header.encode()&&!this.noPax&&super.write(new GFr({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[WY](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[WY](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let o=this.header?.block;if(!o)throw new Error("failed to encode header");super.write(o),e.pipe(this)}[WY](e){return Ftc(e,this.prefix)}[WFr](e){return Dtc(e,this.type==="Directory",this.portable)}write(e,t,r){typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let n=e.length;if(n>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=n,super.write(e,r)}end(e,t,r){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),r&&this.once("finish",r),e?super.end(e,r):super.end(r),this}},jLf=e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported",MLf=class MXe{tail;head;length=0;static create(t=[]){return new MXe(t)}constructor(t=[]){for(let r of t)this.push(r)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");let r=t.next,n=t.prev;return r&&(r.prev=n),n&&(n.next=r),t===this.head&&(this.head=r),t===this.tail&&(this.tail=n),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,r}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let r=this.head;t.list=this,t.next=r,r&&(r.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let r=this.tail;t.list=this,t.prev=r,r&&(r.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let r=0,n=t.length;r<n;r++)ULf(this,t[r]);return this.length}unshift(...t){for(var r=0,n=t.length;r<n;r++)zLf(this,t[r]);return this.length}pop(){if(!this.tail)return;let t=this.tail.value,r=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,r.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,r=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,r.list=void 0,this.length--,t}forEach(t,r){r=r||this;for(let n=this.head,i=0;n;i++)t.call(r,n.value,i,this),n=n.next}forEachReverse(t,r){r=r||this;for(let n=this.tail,i=this.length-1;n;i--)t.call(r,n.value,i,this),n=n.prev}get(t){let r=0,n=this.head;for(;n&&r<t;r++)n=n.next;if(r===t&&n)return n.value}getReverse(t){let r=0,n=this.tail;for(;n&&r<t;r++)n=n.prev;if(r===t&&n)return n.value}map(t,r){r=r||this;let n=new MXe;for(let i=this.head;i;)n.push(t.call(r,i.value,this)),i=i.next;return n}mapReverse(t,r){r=r||this;var n=new MXe;for(let i=this.tail;i;)n.push(t.call(r,i.value,this)),i=i.prev;return n}reduce(t,r){let n,i=this.head;if(arguments.length>1)n=r;else if(this.head)i=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;i;o++)n=t(n,i.value,o),i=i.next;return n}reduceReverse(t,r){let n,i=this.tail;if(arguments.length>1)n=r;else if(this.tail)i=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let o=this.length-1;i;o--)n=t(n,i.value,o),i=i.prev;return n}toArray(){let t=new Array(this.length);for(let r=0,n=this.head;n;r++)t[r]=n.value,n=n.next;return t}toArrayReverse(){let t=new Array(this.length);for(let r=0,n=this.tail;n;r++)t[r]=n.value,n=n.prev;return t}slice(t=0,r=this.length){r<0&&(r+=this.length),t<0&&(t+=this.length);let n=new MXe;if(r<t||r<0)return n;t<0&&(t=0),r>this.length&&(r=this.length);let i=this.head,o=0;for(o=0;i&&o<t;o++)i=i.next;for(;i&&o<r;o++,i=i.next)n.push(i.value);return n}sliceReverse(t=0,r=this.length){r<0&&(r+=this.length),t<0&&(t+=this.length);let n=new MXe;if(r<t||r<0)return n;t<0&&(t=0),r>this.length&&(r=this.length);let i=this.length,o=this.tail;for(;o&&i>r;i--)o=o.prev;for(;o&&i>t;i--,o=o.prev)n.push(o.value);return n}splice(t,r=0,...n){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let i=this.head;for(let s=0;i&&s<t;s++)i=i.next;let o=[];for(let s=0;i&&s<r;s++)o.push(i.value),i=this.removeNode(i);i?i!==this.tail&&(i=i.prev):i=this.tail;for(let s of n)i=LLf(this,i,s);return o}reverse(){let t=this.head,r=this.tail;for(let n=t;n;n=n.prev){let i=n.prev;n.prev=n.next,n.next=i}return this.head=r,this.tail=t,this}};function LLf(e,t,r){let n=t,i=t?t.next:e.head,o=new Ano(r,n,i,e);return o.next===void 0&&(e.tail=o),o.prev===void 0&&(e.head=o),e.length++,o}function ULf(e,t){e.tail=new Ano(t,e.tail,void 0,e),e.head||(e.head=e.tail),e.length++}function zLf(e,t){e.head=new Ano(t,void 0,e.head,e),e.tail||(e.tail=e.head),e.length++}var Ano=class{list;next;prev;value;constructor(e,t,r,n){this.list=n,this.value=e,t?(t.next=this,this.prev=t):this.prev=void 0,r?(r.prev=this,this.next=r):this.next=void 0}},rtc=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,t){this.path=e||"./",this.absolute=t}},ntc=Buffer.alloc(1024),jFr=Symbol("onStat"),FNt=Symbol("ended"),z7=Symbol("queue"),hQe=Symbol("current"),gQe=Symbol("process"),kNt=Symbol("processing"),Rro=Symbol("processJob"),V7=Symbol("jobs"),Fro=Symbol("jobDone"),MFr=Symbol("addFSEntry"),itc=Symbol("addTarEntry"),eno=Symbol("stat"),tno=Symbol("readdir"),LFr=Symbol("onreaddir"),UFr=Symbol("pipe"),otc=Symbol("entry"),kro=Symbol("entryOpt"),zFr=Symbol("writeEntryClass"),Ntc=Symbol("write"),Nro=Symbol("ondrain"),t2r=class extends vQe{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[zFr];onWriteEntry;[z7];[V7]=0;[kNt]=!1;[FNt]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=Xp(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[zFr]=ktc,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new X6f(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new eLf(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new rLf(e.zstd)),!this.zip)throw new Error("impossible");let t=this.zip;t.on("data",r=>super.write(r)),t.on("end",()=>super.end()),t.on("drain",()=>this[Nro]()),this.on("resume",()=>t.resume())}else this.on("drain",this[Nro]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[z7]=new MLf,this[V7]=0,this.jobs=Number(e.jobs)||4,this[kNt]=!1,this[FNt]=!1}[Ntc](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t=void 0),e&&this.add(e),this[FNt]=!0,this[gQe](),r&&r(),this}write(e){if(this[FNt])throw new Error("write after end");return e instanceof Otc?this[itc](e):this[MFr](e),this.flowing}[itc](e){let t=Xp(Zro.default.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let r=new rtc(e.path,t);r.entry=new QLf(e,this[kro](r)),r.entry.on("end",()=>this[Fro](r)),this[V7]+=1,this[z7].push(r)}this[gQe]()}[MFr](e){let t=Xp(Zro.default.resolve(this.cwd,e));this[z7].push(new rtc(e,t)),this[gQe]()}[eno](e){e.pending=!0,this[V7]+=1;let t=this.follow?"stat":"lstat";$Nt.default[t](e.absolute,(r,n)=>{e.pending=!1,this[V7]-=1,r?this.emit("error",r):this[jFr](e,n)})}[jFr](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)?t.isFile()&&t.nlink>1&&e===this[hQe]&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync&&this[Rro](e):e.ignore=!0,this[gQe]()}[tno](e){e.pending=!0,this[V7]+=1,$Nt.default.readdir(e.absolute,(t,r)=>{if(e.pending=!1,this[V7]-=1,t)return this.emit("error",t);this[LFr](e,r)})}[LFr](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[gQe]()}[gQe](){if(!this[kNt]){this[kNt]=!0;for(let e=this[z7].head;e&&this[V7]<this.jobs;e=e.next)if(this[Rro](e.value),e.value.ignore){let t=e.next;this[z7].removeNode(e),e.next=t}this[kNt]=!1,this[FNt]&&this[z7].length===0&&this[V7]===0&&(this.zip?this.zip.end(ntc):(super.write(ntc),super.end()))}}get[hQe](){return this[z7]&&this[z7].head&&this[z7].head.value}[Fro](e){this[z7].shift(),this[V7]-=1,this[gQe]()}[Rro](e){if(!e.pending){if(e.entry){e===this[hQe]&&!e.piped&&this[UFr](e);return}if(!e.stat){let t=this.statCache.get(e.absolute);t?this[jFr](e,t):this[eno](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let t=this.readdirCache.get(e.absolute);if(t?this[LFr](e,t):this[tno](e),!e.readdir)return}if(e.entry=this[otc](e),!e.entry){e.ignore=!0;return}e===this[hQe]&&!e.piped&&this[UFr](e)}}}[kro](e){return{onwarn:(t,r,n)=>this.warn(t,r,n),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[otc](e){this[V7]+=1;try{return new this[zFr](e.path,this[kro](e)).on("end",()=>this[Fro](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[Nro](){this[hQe]&&this[hQe].entry&&this[hQe].entry.resume()}[UFr](e){e.piped=!0,e.readdir&&e.readdir.forEach(n=>{let i=e.path,o=i==="./"?"":i.replace(/\/*$/,"/");this[MFr](o+n)});let t=e.entry,r=this.zip;if(!t)throw new Error("cannot pipe without source");r?t.on("data",n=>{r.write(n)||t.pause()}):t.on("data",n=>{super.write(n)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,r={}){XFr(this,e,t,r)}},yno=class extends t2r{sync=!0;constructor(e){super(e),this[zFr]=NLf}pause(){}resume(){}[eno](e){let t=this.follow?"statSync":"lstatSync";this[jFr](e,$Nt.default[t](e.absolute))}[tno](e){this[LFr](e,$Nt.default.readdirSync(e.absolute))}[UFr](e){let t=e.entry,r=this.zip;if(e.readdir&&e.readdir.forEach(n=>{let i=e.path,o=i==="./"?"":i.replace(/\/*$/,"/");this[MFr](o+n)}),!t)throw new Error("Cannot pipe without source");r?t.on("data",n=>{r.write(n)}):t.on("data",n=>{super[Ntc](n)})}},VLf=(e,t)=>{let r=new yno(e),n=new Etc(e.file,{mode:e.mode||438});r.pipe(n),Qtc(r,t)},qLf=(e,t)=>{let r=new t2r(e),n=new KFr(e.file,{mode:e.mode||438});r.pipe(n);let i=new Promise((o,s)=>{n.on("error",s),n.on("close",o),r.on("error",s)});return jtc(r,t).catch(o=>r.emit("error",o)),i},Qtc=(e,t)=>{t.forEach(r=>{r.charAt(0)==="@"?ZFr({file:pno.default.resolve(e.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>e.add(n)}):e.add(r)}),e.end()},jtc=async(e,t)=>{for(let r of t)r.charAt(0)==="@"?await ZFr({file:pno.default.resolve(String(e.cwd),r.slice(1)),noResume:!0,onReadEntry:n=>{e.add(n)}}):e.add(r);e.end()},GLf=(e,t)=>{let r=new yno(e);return Qtc(r,t),r},WLf=(e,t)=>{let r=new t2r(e);return jtc(r,t).catch(n=>r.emit("error",n)),r},Mtc=KNt(VLf,qLf,GLf,WLf,(e,t)=>{if(!t?.length)throw new TypeError("no paths specified to add to archive")}),$Lf=process.env.__FAKE_PLATFORM__||process.platform,Utc=$Lf==="win32",{O_CREAT:ztc,O_NOFOLLOW:stc,O_TRUNC:Vtc,O_WRONLY:qtc}=Ino.default.constants,Gtc=Number(process.env.__FAKE_FS_O_FILENAME__)||Ino.default.constants.UV_FS_O_FILEMAP||0,HLf=Utc&&!!Gtc,KLf=512*1024,JLf=Gtc|Vtc|ztc|qtc,atc=!Utc&&typeof stc=="number"?stc|Vtc|ztc|qtc:null,Wtc=atc!==null?()=>atc:HLf?e=>e<KLf?JLf:"w":()=>"w",rno=(e,t,r)=>{try{return JNt.default.lchownSync(e,t,r)}catch(n){if(n?.code!=="ENOENT")throw n}},$Fr=(e,t,r,n)=>{JNt.default.lchown(e,t,r,i=>{n(i&&i?.code!=="ENOENT"?i:null)})},YLf=(e,t,r,n,i)=>{if(t.isDirectory())$tc(UXe.default.resolve(e,t.name),r,n,o=>{if(o)return i(o);let s=UXe.default.resolve(e,t.name);$Fr(s,r,n,i)});else{let o=UXe.default.resolve(e,t.name);$Fr(o,r,n,i)}},$tc=(e,t,r,n)=>{JNt.default.readdir(e,{withFileTypes:!0},(i,o)=>{if(i){if(i.code==="ENOENT")return n();if(i.code!=="ENOTDIR"&&i.code!=="ENOTSUP")return n(i)}if(i||!o.length)return $Fr(e,t,r,n);let s=o.length,a=null,c=u=>{if(!a){if(u)return n(a=u);if(--s===0)return $Fr(e,t,r,n)}};for(let u of o)YLf(e,u,t,r,c)})},XLf=(e,t,r,n)=>{t.isDirectory()&&Htc(UXe.default.resolve(e,t.name),r,n),rno(UXe.default.resolve(e,t.name),r,n)},Htc=(e,t,r)=>{let n;try{n=JNt.default.readdirSync(e,{withFileTypes:!0})}catch(i){let o=i;if(o?.code==="ENOENT")return;if(o?.code==="ENOTDIR"||o?.code==="ENOTSUP")return rno(e,t,r);throw o}for(let i of n)XLf(e,i,t,r);return rno(e,t,r)},Jtc=class extends Error{path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}},r2r=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}},ZLf=(e,t)=>{NN.default.stat(e,(r,n)=>{(r||!n.isDirectory())&&(r=new Jtc(e,r?.code||"ENOTDIR")),t(r)})},e4f=(e,t,r)=>{e=Xp(e);let n=t.umask??18,i=t.mode|448,o=(i&n)!==0,s=t.uid,a=t.gid,c=typeof s=="number"&&typeof a=="number"&&(s!==t.processUid||a!==t.processGid),u=t.preserve,l=t.unlink,p=Xp(t.cwd),d=(m,h)=>{m?r(m):h&&c?$tc(h,s,a,A=>d(A)):o?NN.default.chmod(e,i,r):r()};if(e===p)return ZLf(e,d);if(u)return Ktc.default.mkdir(e,{mode:i,recursive:!0}).then(m=>d(null,m??void 0),d);let f=Xp(HNt.default.relative(p,e)).split("/");nno(p,f,i,l,p,void 0,d)},nno=(e,t,r,n,i,o,s)=>{if(t.length===0)return s(null,o);let a=t.shift(),c=Xp(HNt.default.resolve(e+"/"+a));NN.default.mkdir(c,r,Ytc(c,t,r,n,i,o,s))},Ytc=(e,t,r,n,i,o,s)=>a=>{a?NN.default.lstat(e,(c,u)=>{if(c)c.path=c.path&&Xp(c.path),s(c);else if(u.isDirectory())nno(e,t,r,n,i,o,s);else if(n)NN.default.unlink(e,l=>{if(l)return s(l);NN.default.mkdir(e,r,Ytc(e,t,r,n,i,o,s))});else{if(u.isSymbolicLink())return s(new r2r(e,e+"/"+t.join("/")));s(a)}}):(o=o||e,nno(e,t,r,n,i,o,s))},t4f=e=>{let t=!1,r;try{t=NN.default.statSync(e).isDirectory()}catch(n){r=n?.code}finally{if(!t)throw new Jtc(e,r??"ENOTDIR")}},r4f=(e,t)=>{e=Xp(e);let r=t.umask??18,n=t.mode|448,i=(n&r)!==0,o=t.uid,s=t.gid,a=typeof o=="number"&&typeof s=="number"&&(o!==t.processUid||s!==t.processGid),c=t.preserve,u=t.unlink,l=Xp(t.cwd),p=m=>{m&&a&&Htc(m,o,s),i&&NN.default.chmodSync(e,n)};if(e===l)return t4f(l),p();if(c)return p(NN.default.mkdirSync(e,{mode:n,recursive:!0})??void 0);let d=Xp(HNt.default.relative(l,e)).split("/"),f;for(let m=d.shift(),h=l;m&&(h+="/"+m);m=d.shift()){h=Xp(HNt.default.resolve(h));try{NN.default.mkdirSync(h,n),f=f||h}catch{let A=NN.default.lstatSync(h);if(A.isDirectory())continue;if(u){NN.default.unlinkSync(h),NN.default.mkdirSync(h,n),f=f||h;continue}else if(A.isSymbolicLink())return new r2r(h,h+"/"+d.join("/"))}}return p(f)},Qro=Object.create(null),ctc=1e4,FXe=new Set,n4f=e=>{FXe.has(e)?FXe.delete(e):Qro[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),FXe.add(e);let t=Qro[e],r=FXe.size-ctc;if(r>ctc/10){for(let n of FXe)if(FXe.delete(n),delete Qro[n],--r<=0)break}return t},i4f=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,o4f=i4f==="win32",s4f=e=>e.split("/").slice(0,-1).reduce((t,r)=>{let n=t.at(-1);return n!==void 0&&(r=(0,vno.join)(n,r)),t.push(r||"/"),t},[]),a4f=class{#e=new Map;#t=new Map;#r=new Set;reserve(e,t){e=o4f?["win32 parallelization disabled"]:e.map(n=>LNt((0,vno.join)(n4f(n))));let r=new Set(e.map(n=>s4f(n)).reduce((n,i)=>n.concat(i)));this.#t.set(t,{dirs:r,paths:e});for(let n of e){let i=this.#e.get(n);i?i.push(t):this.#e.set(n,[t])}for(let n of r){let i=this.#e.get(n);if(!i)this.#e.set(n,[new Set([t])]);else{let o=i.at(-1);o instanceof Set?o.add(t):i.push(new Set([t]))}}return this.#i(t)}#n(e){let t=this.#t.get(e);if(!t)throw new Error("function does not have any path reservations");return{paths:t.paths.map(r=>this.#e.get(r)),dirs:[...t.dirs].map(r=>this.#e.get(r))}}check(e){let{paths:t,dirs:r}=this.#n(e);return t.every(n=>n&&n[0]===e)&&r.every(n=>n&&n[0]instanceof Set&&n[0].has(e))}#i(e){return this.#r.has(e)||!this.check(e)?!1:(this.#r.add(e),e(()=>this.#o(e)),!0)}#o(e){if(!this.#r.has(e))return!1;let t=this.#t.get(e);if(!t)throw new Error("invalid reservation");let{paths:r,dirs:n}=t,i=new Set;for(let o of r){let s=this.#e.get(o);if(!s||s?.[0]!==e)continue;let a=s[1];if(!a){this.#e.delete(o);continue}if(s.shift(),typeof a=="function")i.add(a);else for(let c of a)i.add(c)}for(let o of n){let s=this.#e.get(o),a=s?.[0];if(!(!s||!(a instanceof Set)))if(a.size===1&&s.length===1){this.#e.delete(o);continue}else if(a.size===1){s.shift();let c=s[0];typeof c=="function"&&i.add(c)}else a.delete(e)}return this.#r.delete(e),i.forEach(o=>this.#i(o)),!0}},c4f=()=>process.umask(),utc=Symbol("onEntry"),ino=Symbol("checkFs"),ltc=Symbol("checkFs2"),ono=Symbol("isReusable"),zU=Symbol("makeFs"),sno=Symbol("file"),ano=Symbol("directory"),VFr=Symbol("link"),ptc=Symbol("symlink"),ftc=Symbol("hardlink"),jNt=Symbol("ensureNoSymlink"),dtc=Symbol("unsupported"),mtc=Symbol("checkPath"),jro=Symbol("stripAbsolutePath"),bbe=Symbol("mkdir"),p_=Symbol("onError"),DFr=Symbol("pending"),htc=Symbol("pend"),kXe=Symbol("unpend"),Mro=Symbol("ended"),Lro=Symbol("maybeClose"),cno=Symbol("skip"),UNt=Symbol("doChown"),zNt=Symbol("uid"),VNt=Symbol("gid"),qNt=Symbol("checkedCwd"),u4f=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,GNt=u4f==="win32",l4f=1024,p4f=(e,t)=>{if(!GNt)return Xf.default.unlink(e,t);let r=e+".DELETE."+(0,Eno.randomBytes)(16).toString("hex");Xf.default.rename(e,r,n=>{if(n)return t(n);Xf.default.unlink(r,t)})},f4f=e=>{if(!GNt)return Xf.default.unlinkSync(e);let t=e+".DELETE."+(0,Eno.randomBytes)(16).toString("hex");Xf.default.renameSync(e,t),Xf.default.unlinkSync(t)},gtc=(e,t,r)=>e!==void 0&&e===e>>>0?e:t!==void 0&&t===t>>>0?t:r,Cno=class extends WNt{[Mro]=!1;[qNt]=!1;[DFr]=0;reservations=new a4f;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[Mro]=!0,this[Lro]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=e.preserveOwner===void 0&&typeof e.uid!="number"?!!(process.getuid&&process.getuid()===0):!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:l4f,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||GNt,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=Xp($C.default.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:c4f():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[utc](t))}warn(e,t,r={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(r.recoverable=!1),super.warn(e,t,r)}[Lro](){this[Mro]&&this[DFr]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[jro](e,t){let r=e[t],{type:n}=e;if(!r||this.preservePaths)return!0;let[i,o]=hno(r),s=o.replaceAll(/\\/g,"/").split("/");if(s.includes("..")||GNt&&/^[a-z]:\.\.$/i.test(s[0]??"")){if(t==="path"||n==="Link")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:r}),!1;let a=$C.default.posix.dirname(e.path),c=$C.default.posix.normalize($C.default.posix.join(a,s.join("/")));if(c.startsWith("../")||c==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:r}),!1}return i&&(e[t]=String(o),this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute ${t}`,{entry:e,[t]:r})),!0}[mtc](e){let t=Xp(e.path),r=t.split("/");if(this.strip){if(r.length<this.strip)return!1;if(e.type==="Link"){let n=Xp(String(e.linkpath)).split("/");if(n.length>=this.strip)e.linkpath=n.slice(this.strip).join("/");else return!1}r.splice(0,this.strip),e.path=r.join("/")}if(isFinite(this.maxDepth)&&r.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:r.length,maxDepth:this.maxDepth}),!1;if(!this[jro](e,"path")||!this[jro](e,"linkpath"))return!1;if(e.absolute=$C.default.isAbsolute(e.path)?Xp($C.default.resolve(e.path)):Xp($C.default.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:Xp(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:n}=$C.default.win32.parse(String(e.absolute));e.absolute=n+Yec(String(e.absolute).slice(n.length));let{root:i}=$C.default.win32.parse(e.path);e.path=i+Yec(e.path.slice(i.length))}return!0}[utc](e){if(!this[mtc](e))return e.resume();switch(Ltc.default.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[ino](e);default:return this[dtc](e)}}[p_](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[kXe](),t.resume())}[bbe](e,t,r){e4f(Xp(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t},r)}[UNt](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[zNt](e){return gtc(this.uid,e.uid,this.processUid)}[VNt](e){return gtc(this.gid,e.gid,this.processGid)}[sno](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.fmode,n=new KFr(String(e.absolute),{flags:Wtc(e.size),mode:r,autoClose:!1});n.on("error",a=>{n.fd&&Xf.default.close(n.fd,()=>{}),n.write=()=>!0,this[p_](a,e),t()});let i=1,o=a=>{if(a){n.fd&&Xf.default.close(n.fd,()=>{}),this[p_](a,e),t();return}--i===0&&n.fd!==void 0&&Xf.default.close(n.fd,c=>{c?this[p_](c,e):this[kXe](),t()})};n.on("finish",()=>{let a=String(e.absolute),c=n.fd;if(typeof c=="number"&&e.mtime&&!this.noMtime){i++;let u=e.atime||new Date,l=e.mtime;Xf.default.futimes(c,u,l,p=>p?Xf.default.utimes(a,u,l,d=>o(d&&p)):o())}if(typeof c=="number"&&this[UNt](e)){i++;let u=this[zNt](e),l=this[VNt](e);typeof u=="number"&&typeof l=="number"&&Xf.default.fchown(c,u,l,p=>p?Xf.default.chown(a,u,l,d=>o(d&&p)):o())}o()});let s=this.transform&&this.transform(e)||e;s!==e&&(s.on("error",a=>{this[p_](a,e),t()}),e.pipe(s)),s.pipe(n)}[ano](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode;this[bbe](String(e.absolute),r,n=>{if(n){this[p_](n,e),t();return}let i=1,o=()=>{--i===0&&(t(),this[kXe](),e.resume())};e.mtime&&!this.noMtime&&(i++,Xf.default.utimes(String(e.absolute),e.atime||new Date,e.mtime,o)),this[UNt](e)&&(i++,Xf.default.chown(String(e.absolute),Number(this[zNt](e)),Number(this[VNt](e)),o)),o()})}[dtc](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[ptc](e,t){let r=Xp($C.default.relative(this.cwd,$C.default.resolve($C.default.dirname(String(e.absolute)),String(e.linkpath)))).split("/");this[jNt](e,this.cwd,r,()=>this[VFr](e,String(e.linkpath),"symlink",t),n=>{this[p_](n,e),t()})}[ftc](e,t){let r=Xp($C.default.resolve(this.cwd,String(e.linkpath))),n=Xp(String(e.linkpath)).split("/");this[jNt](e,this.cwd,n,()=>this[VFr](e,r,"link",t),i=>{this[p_](i,e),t()})}[jNt](e,t,r,n,i){let o=r.shift();if(this.preservePaths||o===void 0)return n();let s=$C.default.resolve(t,o);Xf.default.lstat(s,(a,c)=>{if(a)return n();if(c?.isSymbolicLink())return i(new r2r(s,$C.default.resolve(s,r.join("/"))));this[jNt](e,s,r,n,i)})}[htc](){this[DFr]++}[kXe](){this[DFr]--,this[Lro]()}[cno](e){this[kXe](),e.resume()}[ono](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!GNt}[ino](e){this[htc]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,r=>this[ltc](e,r))}[ltc](e,t){let r=s=>{t(s)},n=()=>{this[bbe](this.cwd,this.dmode,s=>{if(s){this[p_](s,e),r();return}this[qNt]=!0,i()})},i=()=>{if(e.absolute!==this.cwd){let s=Xp($C.default.dirname(String(e.absolute)));if(s!==this.cwd)return this[bbe](s,this.dmode,a=>{if(a){this[p_](a,e),r();return}o()})}o()},o=()=>{Xf.default.lstat(String(e.absolute),(s,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(e.mtime??a.mtime))){this[cno](e),r();return}if(s||this[ono](e,a))return this[zU](null,e,r);if(a.isDirectory()){if(e.type==="Directory"){let c=this.chmod&&e.mode&&(a.mode&4095)!==e.mode,u=l=>this[zU](l??null,e,r);return c?Xf.default.chmod(String(e.absolute),Number(e.mode),u):u()}if(e.absolute!==this.cwd)return Xf.default.rmdir(String(e.absolute),c=>this[zU](c??null,e,r))}if(e.absolute===this.cwd)return this[zU](null,e,r);p4f(String(e.absolute),c=>this[zU](c??null,e,r))})};this[qNt]?i():n()}[zU](e,t,r){if(e){this[p_](e,t),r();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[sno](t,r);case"Link":return this[ftc](t,r);case"SymbolicLink":return this[ptc](t,r);case"Directory":case"GNUDumpDir":return this[ano](t,r)}}[VFr](e,t,r,n){Xf.default[r](t,String(e.absolute),i=>{i?this[p_](i,e):(this[kXe](),e.resume()),n()})}},NNt=e=>{try{return[null,e()]}catch(t){return[t,null]}},Xtc=class extends Cno{sync=!0;[zU](e,t){return super[zU](e,t,()=>{})}[ino](e){if(!this[qNt]){let i=this[bbe](this.cwd,this.dmode);if(i)return this[p_](i,e);this[qNt]=!0}if(e.absolute!==this.cwd){let i=Xp($C.default.dirname(String(e.absolute)));if(i!==this.cwd){let o=this[bbe](i,this.dmode);if(o)return this[p_](o,e)}}let[t,r]=NNt(()=>Xf.default.lstatSync(String(e.absolute)));if(r&&(this.keep||this.newer&&r.mtime>(e.mtime??r.mtime)))return this[cno](e);if(t||this[ono](e,r))return this[zU](null,e);if(r.isDirectory()){if(e.type==="Directory"){let o=this.chmod&&e.mode&&(r.mode&4095)!==e.mode,[s]=o?NNt(()=>{Xf.default.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[zU](s,e)}let[i]=NNt(()=>Xf.default.rmdirSync(String(e.absolute)));this[zU](i,e)}let[n]=e.absolute===this.cwd?[]:NNt(()=>f4f(String(e.absolute)));this[zU](n,e)}[sno](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.fmode,n=s=>{let a;try{Xf.default.closeSync(i)}catch(c){a=c}(s||a)&&this[p_](s||a,e),t()},i;try{i=Xf.default.openSync(String(e.absolute),Wtc(e.size),r)}catch(s){return n(s)}let o=this.transform&&this.transform(e)||e;o!==e&&(o.on("error",s=>this[p_](s,e)),e.pipe(o)),o.on("data",s=>{try{Xf.default.writeSync(i,s,0,s.length)}catch(a){n(a)}}),o.on("end",()=>{let s=null;if(e.mtime&&!this.noMtime){let a=e.atime||new Date,c=e.mtime;try{Xf.default.futimesSync(i,a,c)}catch(u){try{Xf.default.utimesSync(String(e.absolute),a,c)}catch{s=u}}}if(this[UNt](e)){let a=this[zNt](e),c=this[VNt](e);try{Xf.default.fchownSync(i,Number(a),Number(c))}catch(u){try{Xf.default.chownSync(String(e.absolute),Number(a),Number(c))}catch{s=s||u}}}n(s)})}[ano](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode,n=this[bbe](String(e.absolute),r);if(n){this[p_](n,e),t();return}if(e.mtime&&!this.noMtime)try{Xf.default.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[UNt](e))try{Xf.default.chownSync(String(e.absolute),Number(this[zNt](e)),Number(this[VNt](e)))}catch{}t(),e.resume()}[bbe](e,t){try{return r4f(Xp(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t})}catch(r){return r}}[jNt](e,t,r,n,i){if(this.preservePaths||r.length===0)return n();let o=t;for(let s of r){o=$C.default.resolve(o,s);let[a,c]=NNt(()=>Xf.default.lstatSync(o));if(a)return n();if(c.isSymbolicLink())return i(new r2r(o,$C.default.resolve(t,r.join("/"))))}n()}[VFr](e,t,r,n){let i=`${r}Sync`;try{Xf.default[i](t,String(e.absolute)),n(),e.resume()}catch(o){return this[p_](o,e)}}},d4f=e=>{let t=new Xtc(e),r=e.file,n=bno.default.statSync(r),i=e.maxReadSize||16*1024*1024;new U6f(r,{readSize:i,size:n.size}).pipe(t)},m4f=(e,t)=>{let r=new Cno(e),n=e.maxReadSize||16*1024*1024,i=e.file;return new Promise((o,s)=>{r.on("error",s),r.on("close",o),bno.default.stat(i,(a,c)=>{if(a)s(a);else{let u=new lno(i,{readSize:n,size:c.size});u.on("error",s),u.pipe(r)}})})},Ztc=KNt(d4f,m4f,e=>new Xtc(e),e=>new Cno(e),(e,t)=>{t?.length&&Ptc(e,t)}),h4f=(e,t)=>{let r=new yno(e),n=!0,i,o;try{try{i=kN.default.openSync(e.file,"r+")}catch(c){if(c?.code==="ENOENT")i=kN.default.openSync(e.file,"w+");else throw c}let s=kN.default.fstatSync(i),a=Buffer.alloc(512);e:for(o=0;o<s.size;o+=512){for(let l=0,p=0;l<512;l+=p){if(p=kN.default.readSync(i,a,l,a.length-l,o+l),o===0&&a[0]===31&&a[1]===139)throw new Error("cannot append to compressed archives");if(!p)break e}let c=new IQe(a);if(!c.cksumValid)break;let u=512*Math.ceil((c.size||0)/512);if(o+u+512>s.size)break;o+=u,e.mtimeCache&&c.mtime&&e.mtimeCache.set(String(c.path),c.mtime)}n=!1,g4f(e,r,o,i,t)}finally{if(n)try{kN.default.closeSync(i)}catch{}}},g4f=(e,t,r,n,i)=>{let o=new Etc(e.file,{fd:n,start:r});t.pipe(o),y4f(t,i)},A4f=(e,t)=>{t=Array.from(t);let r=new t2r(e),n=(i,o,s)=>{let a=(d,f)=>{d?kN.default.close(i,m=>s(d)):s(null,f)},c=0;if(o===0)return a(null,0);let u=0,l=Buffer.alloc(512),p=(d,f)=>{if(d||f===void 0)return a(d);if(u+=f,u<512&&f)return kN.default.read(i,l,u,l.length-u,c+u,p);if(c===0&&l[0]===31&&l[1]===139)return a(new Error("cannot append to compressed archives"));if(u<512)return a(null,c);let m=new IQe(l);if(!m.cksumValid)return a(null,c);let h=512*Math.ceil((m.size??0)/512);if(c+h+512>o||(c+=h+512,c>=o))return a(null,c);e.mtimeCache&&m.mtime&&e.mtimeCache.set(String(m.path),m.mtime),u=0,kN.default.read(i,l,0,512,c,p)};kN.default.read(i,l,0,512,c,p)};return new Promise((i,o)=>{r.on("error",o);let s="r+",a=(c,u)=>{if(c&&c.code==="ENOENT"&&s==="r+")return s="w+",kN.default.open(e.file,s,a);if(c||!u)return o(c);kN.default.fstat(u,(l,p)=>{if(l)return kN.default.close(u,()=>o(l));n(u,p.size,(d,f)=>{if(d)return o(d);let m=new KFr(e.file,{fd:u,start:f});r.pipe(m),m.on("error",o),m.on("close",i),b4f(r,t)})})};kN.default.open(e.file,s,a)})},y4f=(e,t)=>{t.forEach(r=>{r.charAt(0)==="@"?ZFr({file:wno.default.resolve(e.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>e.add(n)}):e.add(r)}),e.end()},b4f=async(e,t)=>{for(let r of t)r.charAt(0)==="@"?await ZFr({file:wno.default.resolve(String(e.cwd),r.slice(1)),noResume:!0,onReadEntry:n=>e.add(n)}):e.add(r);e.end()},QNt=KNt(h4f,A4f,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(e,t)=>{if(!$6f(e))throw new TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!t?.length)throw new TypeError("no paths specified to add/replace")}),zK0=KNt(QNt.syncFile,QNt.asyncFile,QNt.syncNoFile,QNt.asyncNoFile,(e,t=[])=>{QNt.validate?.(e,t),E4f(e)}),E4f=e=>{let t=e.filter;e.mtimeCache||(e.mtimeCache=new Map),e.filter=t?(r,n)=>t(r,n)&&!((e.mtimeCache?.get(r)??n.mtime??0)>(n.mtime??0)):(r,n)=>!((e.mtimeCache?.get(r)??n.mtime??0)>(n.mtime??0))};var orc=we(qw(),1);var I4f=Bue();async function src({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:n,cliVersion:i,settings:o,loadAPIWorkspace:s}){let a,c={type:Rl.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},u=t.dependencies[e];return u==null?c={type:Rl.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${B4f(u)}`},async l=>{switch(u.type){case"version":a=await S4f({context:l,dependency:u,cliVersion:i,settings:o,loadAPIWorkspace:s});return;case"local":a=await x4f({context:l,dependency:u,cliVersion:i,settings:o,loadAPIWorkspace:s});return;default:Ce(u)}}),a!=null?{didSucceed:!0,definition:a}:{didSucceed:!1,failure:c}}var arc="dependencies";var v4f="metadata.json",C4f=".fern";function w4f(e){return Ye(Ht.of((0,rrc.homedir)()),De.of(C4f),De.of(arc),De.of(e.organization),De.of(e.apiName),De.of(e.version))}async function x4f({dependency:e,context:t,cliVersion:r,settings:n,loadAPIWorkspace:i}){if(i==null){t.failWithoutThrowing("Failed to load api definition",void 0,{code:N.Code.ResolutionError});return}t.logger.info("Parsing...");let o=await i({absolutePathToWorkspace:e.absoluteFilepath,context:t,cliVersion:r,workspaceName:void 0});if(!o.didSucceed){t.failWithoutThrowing("Failed to load api definition",o.failures,{code:N.Code.ResolutionError});return}t.logger.info("Modifying source filepath ...");let s=await o.workspace.getDefinition({context:t,relativePathToDependency:De.of(e.path)},n);return t.logger.info("Loaded..."),s}async function S4f({dependency:e,context:t,cliVersion:r,settings:n,loadAPIWorkspace:i}){let o=w4f(e),s=Ye(o,De.of(arc)),a=Ye(o,De.of(v4f)),c;if(!await ar(s)||!await ar(a)){t.logger.info("Downloading manifest...");let p=await I4f.definitionRegistry.get(Gr.OrganizationId(e.organization),Gr.ApiId(e.apiName),e.version);if(!p.ok){p.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist",void 0,{code:N.Code.ResolutionError})},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist",void 0,{code:N.Code.ResolutionError})},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist",void 0,{code:N.Code.ResolutionError})},_other:h=>{t.failWithoutThrowing("Failed to download API manifest",h,{code:N.Code.NetworkError})}});return}let d=p.body.yamlSchemaVersion!=null?parseInt(p.body.yamlSchemaVersion):void 0,f=eQe(r),m=eQe(p.body.cliVersion);if(d!=null){if(d>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${p.body.cliVersion}`,void 0,{code:N.Code.VersionError});return}else if(d<1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a lower version of fern. Upgrade it to ${r}`,void 0,{code:N.Code.VersionError});return}}else if(f.major!==m.major||f.minor!==m.minor){t.failWithoutThrowing(`CLI version is ${p.body.cliVersion}. Expected ${f.major}.${f.minor}.x (to match current workspace).`,void 0,{code:N.Code.VersionError});return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+p.body.definitionS3DownloadUrl),await(0,VXe.mkdir)(s,{recursive:!0});try{await _4f({s3PreSignedReadUrl:p.body.definitionS3DownloadUrl,absolutePathToLocalOutput:s})}catch(h){t.failWithoutThrowing("Failed to download API",h,{code:N.Code.NetworkError});return}c=p.body,await(0,VXe.writeFile)(a,JSON.stringify(c))}else c=JSON.parse((await(0,VXe.readFile)(a)).toString());if(t.logger.info("Parsing..."),i==null){t.failWithoutThrowing("Failed to load API",void 0,{code:N.Code.ResolutionError});return}let u=await i({absolutePathToWorkspace:s,context:t,cliVersion:c.cliVersion,workspaceName:void 0});if(!u.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",u.failures,{code:N.Code.ParseError});return}if(u.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.",void 0,{code:N.Code.ConfigError});return}return await u.workspace.getDefinition({context:t},n)}async function _4f({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await fy.get(e,{responseType:"stream"}),n=await orc.default.dir(),i=nrc.default.join(n.path,"api.tgz");await(0,irc.pipeline)(r.data,(0,trc.createWriteStream)(i)),await Ztc({file:i,cwd:t})}function B4f(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:Ce(e)}}async function crc({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:n,settings:i,loadAPIWorkspace:o}){let s={},a={},c={};return await Promise.all(W0(t.packageMarkers).map(async([u,l])=>{if(l.contents.export==null)s[u]=l;else{let{export:p,...d}=l.contents;if(lh(d)>0)c[u]={type:Rl.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:u};else{let f=Sn(u);if(UT(t.namedDefinitionFiles).some(h=>h!==u&&h.startsWith(f)))c[u]={type:Rl.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:f};else{let h=await src({dependencyName:typeof l.contents.export=="string"?l.contents.export:l.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:n,settings:i,loadAPIWorkspace:o});h.didSucceed?a[Sn(u)]={definition:h.definition,url:typeof l.contents.export=="object"?l.contents.export.url:void 0}:c[u]=h.failure}}}})),lh(c)>0?{didSucceed:!1,failures:c}:{didSucceed:!0,packageMarkers:s,importedDefinitions:a}}jt();Xt();var urc=we(require("path"),1);var xno={};ne(xno,{additionalProperties:()=>D4f,default:()=>F4f,definitions:()=>R4f,properties:()=>O4f,required:()=>P4f,type:()=>T4f});var T4f="object",O4f={docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"default-environment":{oneOf:[{type:"string"},{type:"null"}]},environments:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/environments.EnvironmentSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/auth.ApiAuthSchema"},{type:"null"}]},"auth-schemes":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/auth.AuthSchemeDeclarationSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},name:{type:"string"},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"error-discrimination":{oneOf:[{$ref:"#/definitions/file.ErrorDiscriminationSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},errors:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"idempotency-headers":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/variables.VariableDeclarationSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"null"}]},product:{oneOf:[{$ref:"#/definitions/products.ProductDeclarationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},P4f=["name"],D4f=!1,R4f={"environments.ServerVariableSchema":{type:"object",properties:{id:{type:"string"},default:{oneOf:[{type:"string"},{type:"null"}]},values:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]}},required:["id"],additionalProperties:!1},"environments.SingleBaseUrlEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"url-template":{oneOf:[{type:"string"},{type:"null"}]},variables:{oneOf:[{type:"array",items:{$ref:"#/definitions/environments.ServerVariableSchema"}},{type:"null"}]}},required:["url"],additionalProperties:!1},"environments.MultipleBaseUrlsEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},urls:{type:"object",additionalProperties:{type:"string"}},"url-templates":{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"default-urls":{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/environments.ServerVariableSchema"}}},{type:"null"}]}},required:["urls"],additionalProperties:!1},"environments.EnvironmentSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/environments.SingleBaseUrlEnvironmentSchema"},{$ref:"#/definitions/environments.MultipleBaseUrlsEnvironmentSchema"}]},"auth.AuthSchemeReferenceSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{type:"string"}},required:["scheme"],additionalProperties:!1},"auth.AnyAuthItem":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"}]},"auth.AnyAuthSchemesSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},any:{type:"array",items:{$ref:"#/definitions/auth.AnyAuthItem"}}},required:["any"],additionalProperties:!1},"auth.EndpointSecuritySchemaDetails":{type:"object",additionalProperties:!1},"auth.EndpointSecuritySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"endpoint-security":{$ref:"#/definitions/auth.EndpointSecuritySchemaDetails"}},required:["endpoint-security"],additionalProperties:!1},"auth.ApiAuthSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"},{$ref:"#/definitions/auth.AnyAuthSchemesSchema"},{$ref:"#/definitions/auth.EndpointSecuritySchema"}]},"auth.AuthScope":{type:"string"},"auth.OAuthAccessTokenRequestPropertiesSchema":{type:"object",properties:{"client-id":{oneOf:[{type:"string"},{type:"null"}]},"client-secret":{oneOf:[{type:"string"},{type:"null"}]},scopes:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthAccessTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthGetTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthRefreshTokenRequestPropertiesSchema":{type:"object",properties:{"refresh-token":{type:"string"}},required:["refresh-token"],additionalProperties:!1},"auth.OAuthRefreshTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthRefreshTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"oauth"},type:{const:"client-credentials"},scopes:{oneOf:[{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}},{type:"null"}]},"client-id-env":{oneOf:[{type:"string"},{type:"null"}]},"client-secret-env":{oneOf:[{type:"string"},{type:"null"}]},"token-prefix":{oneOf:[{type:"string"},{type:"null"}]},"token-header":{oneOf:[{type:"string"},{type:"null"}]},"get-token":{$ref:"#/definitions/auth.OAuthGetTokenEndpointSchema"},"refresh-token":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenEndpointSchema"},{type:"null"}]}},required:["scheme","type","get-token"],additionalProperties:!1},"auth.HeaderAuthSchemeSchema":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},header:{type:"string"},type:{oneOf:[{type:"string"},{type:"null"}]},prefix:{oneOf:[{type:"string"},{type:"null"}]},placeholder:{oneOf:[{type:"string"},{type:"null"}]}},required:["header"],additionalProperties:!1},"auth.AuthVariable":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},omit:{oneOf:[{type:"boolean"},{type:"null"}]},placeholder:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.BasicAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"basic"},username:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]},password:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.TokenBearerAuthSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},token:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.InferredAuthenticatedRequestHeader":{type:"object",properties:{"response-property":{type:"string"},"header-name":{type:"string"},"value-prefix":{oneOf:[{type:"string"},{type:"null"}]}},required:["response-property","header-name"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchemaObject":{type:"object",properties:{endpoint:{type:"string"},"expiry-response-property":{oneOf:[{type:"string"},{type:"null"}]},"authenticated-request-headers":{oneOf:[{type:"array",items:{$ref:"#/definitions/auth.InferredAuthenticatedRequestHeader"}},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.InferredGetTokenEndpointSchemaObject"}]},"auth.InferredBearerAuthSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},"get-token":{$ref:"#/definitions/auth.InferredGetTokenEndpointSchema"}},required:["scheme","get-token"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{anyOf:[{$ref:"#/definitions/auth.TokenBearerAuthSchema"},{$ref:"#/definitions/auth.InferredBearerAuthSchema"}]},"auth.AuthSchemeDeclarationSchema":{anyOf:[{$ref:"#/definitions/auth.OAuthSchemeSchema"},{$ref:"#/definitions/auth.HeaderAuthSchemeSchema"},{$ref:"#/definitions/auth.BasicAuthSchemeSchema"},{$ref:"#/definitions/auth.BearerAuthSchemeSchema"}]},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ListValidationSchema":{type:"object",properties:{minItems:{oneOf:[{type:"integer"},{type:"null"}]},maxItems:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.MapValidationSchema":{type:"object",properties:{minProperties:{oneOf:[{type:"integer"},{type:"null"}]},maxProperties:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"},{$ref:"#/definitions/validation.ListValidationSchema"},{$ref:"#/definitions/validation.MapValidationSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"file.PropertyBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"property"},"property-name":{type:"string"}},required:["strategy","property-name"],additionalProperties:!1},"file.StatusCodeBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"status-code"}},required:["strategy"],additionalProperties:!1},"file.ErrorDiscriminationSchema":{anyOf:[{$ref:"#/definitions/file.PropertyBasedErrorDiscrimination"},{$ref:"#/definitions/file.StatusCodeBasedErrorDiscrimination"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"variables.VariableDeclarationDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"variables.VariableDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/variables.VariableDeclarationDetailed"}]},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.UriPaginationSchema":{type:"object",properties:{next_uri:{type:"string"},results:{type:"string"}},required:["next_uri","results"],additionalProperties:!1},"pagination.PathPaginationSchema":{type:"object",properties:{next_path:{type:"string"},results:{type:"string"}},required:["next_path","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"},{$ref:"#/definitions/pagination.UriPaginationSchema"},{$ref:"#/definitions/pagination.PathPaginationSchema"}]},"versioning.VersionValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionValue":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionValueDetailed"}]},"versioning.VersionDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionDeclarationHeaderObjectSchema"}]},"versioning.VersionDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/versioning.VersionValue"}},header:{$ref:"#/definitions/versioning.VersionDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1},"products.ProductValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},versions:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"products.ProductValue":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductValueDetailed"}]},"products.ProductDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"products.ProductDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductDeclarationHeaderObjectSchema"}]},"products.ProductDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/products.ProductValue"}},header:{$ref:"#/definitions/products.ProductDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},F4f={type:T4f,properties:O4f,required:P4f,additionalProperties:D4f,definitions:R4f};var Sno={};ne(Sno,{additionalProperties:()=>Q4f,default:()=>M4f,definitions:()=>j4f,properties:()=>N4f,type:()=>k4f});var k4f="object",N4f={docs:{oneOf:[{type:"string"},{type:"null"}]},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},"webhook-signature":{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureSchema"},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]}},Q4f=!1,j4f={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ListValidationSchema":{type:"object",properties:{minItems:{oneOf:[{type:"integer"},{type:"null"}]},maxItems:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.MapValidationSchema":{type:"object",properties:{minProperties:{oneOf:[{type:"integer"},{type:"null"}]},maxProperties:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"},{$ref:"#/definitions/validation.ListValidationSchema"},{$ref:"#/definitions/validation.MapValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}},"forward-compatible":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminatorContext":{type:"string",enum:["data","protocol"]},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},context:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminatorContext"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}},"default-variant":{oneOf:[{type:"string"},{type:"null"}]}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]},explode:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.UriPaginationSchema":{type:"object",properties:{next_uri:{type:"string"},results:{type:"string"}},required:["next_uri","results"],additionalProperties:!1},"pagination.PathPaginationSchema":{type:"object",properties:{next_path:{type:"string"},results:{type:"string"}},required:["next_path","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"},{$ref:"#/definitions/pagination.UriPaginationSchema"},{$ref:"#/definitions/pagination.PathPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/service.HttpEndpointAuth"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"webhooks.WebhookSignatureAlgorithmSchema":{type:"string",enum:["sha256","sha1","sha384","sha512"]},"webhooks.WebhookSignatureEncodingSchema":{type:"string",enum:["base64","hex"]},"webhooks.WebhookPayloadComponentSchema":{type:"string",enum:["body","timestamp","notification-url","message-id"]},"webhooks.WebhookPayloadBodySortSchema":{type:"string",enum:["alphabetical"]},"webhooks.WebhookPayloadFormatSchema":{type:"object",properties:{components:{type:"array",items:{$ref:"#/definitions/webhooks.WebhookPayloadComponentSchema"}},delimiter:{oneOf:[{type:"string"},{type:"null"}]},"body-sort":{oneOf:[{$ref:"#/definitions/webhooks.WebhookPayloadBodySortSchema"},{type:"null"}]}},required:["components"],additionalProperties:!1},"webhooks.WebhookTimestampFormatSchema":{type:"string",enum:["unix-seconds","unix-millis","iso8601"]},"webhooks.WebhookTimestampSchema":{type:"object",properties:{header:{type:"string"},format:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampFormatSchema"},{type:"null"}]},tolerance:{oneOf:[{type:"integer"},{type:"null"}]}},required:["header"],additionalProperties:!1},"webhooks.AsymmetricAlgorithmSchema":{type:"string",enum:["rsa-sha256","rsa-sha384","rsa-sha512","ecdsa-sha256","ecdsa-sha384","ecdsa-sha512","ed25519"]},"webhooks.WebhookSignatureSchema":{type:"object",properties:{type:{type:"string",enum:["hmac","asymmetric"]}},oneOf:[{properties:{type:{const:"hmac"},header:{type:"string"},algorithm:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureAlgorithmSchema"},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureEncodingSchema"},{type:"null"}]},"signature-prefix":{oneOf:[{type:"string"},{type:"null"}]},"payload-format":{oneOf:[{$ref:"#/definitions/webhooks.WebhookPayloadFormatSchema"},{type:"null"}]},timestamp:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampSchema"},{type:"null"}]}},required:["type","header"]},{properties:{type:{const:"asymmetric"},header:{type:"string"},"asymmetric-algorithm":{$ref:"#/definitions/webhooks.AsymmetricAlgorithmSchema"},encoding:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureEncodingSchema"},{type:"null"}]},"signature-prefix":{oneOf:[{type:"string"},{type:"null"}]},"jwks-url":{oneOf:[{type:"string"},{type:"null"}]},"key-id-header":{oneOf:[{type:"string"},{type:"null"}]},timestamp:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampSchema"},{type:"null"}]}},required:["type","header","asymmetric-algorithm"]}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},signature:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"method-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},"connect-method-name":{oneOf:[{type:"string"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1}},M4f={type:k4f,properties:N4f,additionalProperties:Q4f,definitions:j4f};var _no={};ne(_no,{additionalProperties:()=>z4f,default:()=>q4f,definitions:()=>V4f,properties:()=>U4f,type:()=>L4f});var L4f="object",U4f={imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},"webhook-signature":{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureSchema"},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/file.Navigation"},{type:"null"}]},export:{oneOf:[{$ref:"#/definitions/file.Export"},{type:"null"}]}},z4f=!1,V4f={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ListValidationSchema":{type:"object",properties:{minItems:{oneOf:[{type:"integer"},{type:"null"}]},maxItems:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.MapValidationSchema":{type:"object",properties:{minProperties:{oneOf:[{type:"integer"},{type:"null"}]},maxProperties:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"},{$ref:"#/definitions/validation.ListValidationSchema"},{$ref:"#/definitions/validation.MapValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}},"forward-compatible":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminatorContext":{type:"string",enum:["data","protocol"]},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},context:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminatorContext"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}},"default-variant":{oneOf:[{type:"string"},{type:"null"}]}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]},explode:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.UriPaginationSchema":{type:"object",properties:{next_uri:{type:"string"},results:{type:"string"}},required:["next_uri","results"],additionalProperties:!1},"pagination.PathPaginationSchema":{type:"object",properties:{next_path:{type:"string"},results:{type:"string"}},required:["next_path","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"},{$ref:"#/definitions/pagination.UriPaginationSchema"},{$ref:"#/definitions/pagination.PathPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/service.HttpEndpointAuth"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"webhooks.WebhookSignatureAlgorithmSchema":{type:"string",enum:["sha256","sha1","sha384","sha512"]},"webhooks.WebhookSignatureEncodingSchema":{type:"string",enum:["base64","hex"]},"webhooks.WebhookPayloadComponentSchema":{type:"string",enum:["body","timestamp","notification-url","message-id"]},"webhooks.WebhookPayloadBodySortSchema":{type:"string",enum:["alphabetical"]},"webhooks.WebhookPayloadFormatSchema":{type:"object",properties:{components:{type:"array",items:{$ref:"#/definitions/webhooks.WebhookPayloadComponentSchema"}},delimiter:{oneOf:[{type:"string"},{type:"null"}]},"body-sort":{oneOf:[{$ref:"#/definitions/webhooks.WebhookPayloadBodySortSchema"},{type:"null"}]}},required:["components"],additionalProperties:!1},"webhooks.WebhookTimestampFormatSchema":{type:"string",enum:["unix-seconds","unix-millis","iso8601"]},"webhooks.WebhookTimestampSchema":{type:"object",properties:{header:{type:"string"},format:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampFormatSchema"},{type:"null"}]},tolerance:{oneOf:[{type:"integer"},{type:"null"}]}},required:["header"],additionalProperties:!1},"webhooks.AsymmetricAlgorithmSchema":{type:"string",enum:["rsa-sha256","rsa-sha384","rsa-sha512","ecdsa-sha256","ecdsa-sha384","ecdsa-sha512","ed25519"]},"webhooks.WebhookSignatureSchema":{type:"object",properties:{type:{type:"string",enum:["hmac","asymmetric"]}},oneOf:[{properties:{type:{const:"hmac"},header:{type:"string"},algorithm:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureAlgorithmSchema"},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureEncodingSchema"},{type:"null"}]},"signature-prefix":{oneOf:[{type:"string"},{type:"null"}]},"payload-format":{oneOf:[{$ref:"#/definitions/webhooks.WebhookPayloadFormatSchema"},{type:"null"}]},timestamp:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampSchema"},{type:"null"}]}},required:["type","header"]},{properties:{type:{const:"asymmetric"},header:{type:"string"},"asymmetric-algorithm":{$ref:"#/definitions/webhooks.AsymmetricAlgorithmSchema"},encoding:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureEncodingSchema"},{type:"null"}]},"signature-prefix":{oneOf:[{type:"string"},{type:"null"}]},"jwks-url":{oneOf:[{type:"string"},{type:"null"}]},"key-id-header":{oneOf:[{type:"string"},{type:"null"}]},timestamp:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampSchema"},{type:"null"}]}},required:["type","header","asymmetric-algorithm"]}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},signature:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"method-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},"connect-method-name":{oneOf:[{type:"string"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1},"file.Navigation":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"file.ExportDetailed":{type:"object",properties:{dependency:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]}},required:["dependency"],additionalProperties:!1},"file.Export":{anyOf:[{type:"string"},{$ref:"#/definitions/file.ExportDetailed"}]}},q4f={type:L4f,properties:U4f,additionalProperties:z4f,definitions:V4f};var Bno=new Map,Tno=new Map,Ono=new Map;function lrc({files:e,absolutePathToDefinition:t,skipValidation:r}){let n,i={},o={},s={};for(let[a,c]of W0(e)){let u=c.contents,l=p=>{s[a]={type:Rl.JSONSCHEMA_VALIDATION,error:p}};if(a===nI){let p=Bno.get(c.rawContents);if(p!=null&&(p.validated||r))n={defaultUrl:p.value["default-url"],contents:p.value,rawContents:c.rawContents};else if(r){let d=ph.serialization.RootApiFileSchema.parseOrThrow(u);Bno.set(c.rawContents,{value:d,validated:!1}),n={defaultUrl:d["default-url"],contents:d,rawContents:c.rawContents}}else{let d=X4(u,xno);if(d.success){let f=ph.serialization.RootApiFileSchema.parseOrThrow(u);Bno.set(c.rawContents,{value:f,validated:!0}),n={defaultUrl:f["default-url"],contents:f,rawContents:c.rawContents}}else l(d)}}else if(urc.default.basename(a)===Rf){let p=Ono.get(c.rawContents);if(p!=null&&(p.validated||r))o[a]={defaultUrl:typeof p.value.export=="object"?p.value.export.url:void 0,contents:p.value,rawContents:c.rawContents};else if(r){let d=ph.serialization.PackageMarkerFileSchema.parseOrThrow(u);Ono.set(c.rawContents,{value:d,validated:!1}),o[a]={defaultUrl:typeof d.export=="object"?d.export.url:void 0,contents:d,rawContents:c.rawContents}}else{let d=X4(u,_no);if(d.success){let f=ph.serialization.PackageMarkerFileSchema.parseOrThrow(u);Ono.set(c.rawContents,{value:f,validated:!0}),o[a]={defaultUrl:typeof f.export=="object"?f.export.url:void 0,contents:f,rawContents:c.rawContents}}else l(d)}}else{let p=Tno.get(c.rawContents);if(p!=null&&(p.validated||r))i[a]={defaultUrl:void 0,contents:p.value,rawContents:c.rawContents,absoluteFilePath:Ye(t,a)};else if(r){let d=ph.serialization.DefinitionFileSchema.parseOrThrow(u);Tno.set(c.rawContents,{value:d,validated:!1}),i[a]={defaultUrl:void 0,contents:d,rawContents:c.rawContents,absoluteFilePath:Ye(t,a)}}else{let d=X4(u,Sno);if(d.success){let f=ph.serialization.DefinitionFileSchema.parseOrThrow(u);Tno.set(c.rawContents,{value:f,validated:!0}),i[a]={defaultUrl:void 0,contents:f,rawContents:c.rawContents,absoluteFilePath:Ye(t,a)}}else l(d)}}}return n==null?{didSucceed:!1,failures:{[De.of(nI)]:{type:Rl.FILE_MISSING},...s}}:Object.keys(s).length>0?{didSucceed:!1,failures:s}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:n,packageMarkers:o}}var QN=class extends SG{type="fern";context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...n}){super(n),this.context=t,this.loadAPIWorkspace=r}async getDefinition({context:t},r){let n=t||this.context;return(await this.toFernWorkspace({context:n},r)).definition}async toFernWorkspace({context:t,skipValidation:r},n,i,o){let s=(0,prc.default)(n??{}),a=this.fernWorkspaces[s];if(a==null){let c=t||this.context,u=Ye(this.absoluteFilePath,De.of(xA)),l=await Gki({absolutePathToWorkspace:this.absoluteFilePath,context:c}),p=await FYa(u,"{yml,yaml}"),d=await kYa(p);if(!d.didSucceed)return TRr(d.failures,c.logger),c.failAndThrow(void 0,void 0,{code:N.Code.ValidationError});let f=lrc({files:d.files,absolutePathToDefinition:u,skipValidation:r});if(!f.didSucceed)return TRr(f.failures,c.logger),c.failAndThrow(void 0,void 0,{code:N.Code.ValidationError});let m=await crc({dependenciesConfiguration:l,structuralValidationResult:f,context:c,cliVersion:this.cliVersion,settings:n,loadAPIWorkspace:this.loadAPIWorkspace});if(!m.didSucceed)return TRr(m.failures,c.logger),c.failAndThrow(void 0,void 0,{code:N.Code.ValidationError});let h={absoluteFilePath:u,rootApiFile:f.rootApiFile,namedDefinitionFiles:f.namedDefinitionFiles,packageMarkers:m.packageMarkers,importedDefinitions:m.importedDefinitions};n?.auth!=null&&(h={...h,rootApiFile:{...h.rootApiFile,contents:{...h.rootApiFile.contents,auth:n?.auth}}}),a=new Uk({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:l,workspaceName:this.workspaceName,definition:h,cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[s]=a}return a}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};Xt();var $sc=require("fs/promises");var Csc=we(vsc(),1);async function dF(e){try{return(await(0,Csc.convertObj)(e,{})).openapi}catch(t){throw new N({message:`Failed to convert OpenAPI v2 (Swagger) spec to OpenAPI v3: ${t instanceof Error?t.message:String(t)}`,code:N.Code.ParseError})}}var Fsc=require("fs/promises");bs();var ksc=require("path");jt();var wsc=require("fs/promises");bs();async function cZe({absoluteFilePathToOverrides:e,data:t,context:r,allowNullKeys:n}){let i=null;try{let o=(await(0,wsc.readFile)(e,"utf8")).toString();try{i=JSON.parse(o)}catch{i=Sr.load(o,{json:!0})}}catch{return r.failAndThrow(`Failed to read overrides from file ${e}`,void 0,{code:N.Code.ParseError})}return J$({data:t,overrides:i,allowNullKeys:n})}var Osc=require("fs/promises");bs();var GQt=require("path");function Psc(e){return e.startsWith("http://")||e.startsWith("https://")}async function xsc(e,t){let r=t.get(e);if(r!==void 0)return r;let n=await(0,Osc.readFile)(e,"utf-8"),i=Sr.load(n);return t.set(e,i),i}function Dsc(e,t){let r=new Map;if(e==null||typeof e!="object"||Array.isArray(e))return r;let n=e;function i(s,a){if(!(s==null||typeof s!="object"||Array.isArray(s)))for(let[c,u]of Object.entries(s)){if(!sqf(u))continue;let l=u.$ref,{jsonPointer:p,absolutePath:d}=Rsc(l,t);r.set(`${d}#${p}`,`${a}/${c}`)}}i(n.channels,"#/channels"),i(n.operations,"#/operations");let o=n.components;if(o!=null&&typeof o=="object"&&!Array.isArray(o)){let s=o;i(s.schemas,"#/components/schemas"),i(s.messages,"#/components/messages"),i(s.parameters,"#/components/parameters")}return r}function Rsc(e,t){let r=e.indexOf("#"),n=r>=0?e.slice(0,r):e,i=r>=0?e.slice(r+1):"",o=(0,GQt.resolve)(t,n);return{filePath:n,jsonPointer:i,absolutePath:o}}function sqf(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e.$ref;return typeof t=="string"&&t.length>0&&!t.startsWith("#")&&!Psc(t)}function Ssc(e){let t={},r=!1;for(let[n,i]of Object.entries(e))n!=="$ref"&&(t[n]=i,r=!0);return{siblingProperties:t,hasSiblings:r}}function _sc(e,t,r){if(t==="")return e;let n=t.split("/").filter(o=>o!==""),i=e;for(let o of n){let s=o.replace(/~1/g,"/").replace(/~0/g,"~");if(typeof i!="object"||i==null)throw new Error(`Cannot navigate JSON Pointer "${t}" in "${r}": expected an object but found ${typeof i} at key "${s}"`);let a=i[s];if(a===void 0)throw new Error(`Cannot navigate JSON Pointer "${t}" in "${r}": key "${s}" not found`);i=a}return i}function Bsc(e,t,r){return r&&e!=null&&typeof e=="object"&&!Array.isArray(e)?{...e,...t}:e}function Tsc(e,t,r,n){if(e===r)return"#"+t;let i=`${e}#${t}`,o=n.get(i);if(o!==void 0)return o;for(let[s,a]of n){let c=s.indexOf("#"),u=s.slice(0,c),l=s.slice(c+1);if(u===e&&t.startsWith(l+"/")){let p=t.slice(l.length);return a+p}}return null}async function uZe(e,t,r,n,i=!1,o=new Set,s=new Map,a){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return Promise.all(e.map(p=>uZe(p,t,r,n,i,o,s,a)));let c=e,u=c.$ref;if(typeof u=="string"&&u.startsWith("#")&&a!=null){let p=u.substring(1),{siblingProperties:d,hasSiblings:f}=Ssc(c),m=Tsc(a,p,r,n);if(m!==null)return f?{$ref:m,...d}:{$ref:m};let h=`${a}#${p}`;if(o.has(h))throw new Error(`Circular $ref detected: "${u}" (resolved to "${h}")`);let A=new Set(o);A.add(h);let b=await xsc(a,s),v=_sc(b,p,a),w=(0,GQt.dirname)(a),C=await uZe(v,w,r,n,!0,A,s,a);return Bsc(C,d,f)}if(typeof u=="string"&&!u.startsWith("#")&&!Psc(u)){let{jsonPointer:p,absolutePath:d}=Rsc(u,t),{siblingProperties:f,hasSiblings:m}=Ssc(c);if(i){let x=Tsc(d,p,r,n);if(x!==null)return{$ref:x,...f}}let h=`${d}#${p}`;if(o.has(h))throw new N({message:`Circular $ref detected: "${u}" (resolved to "${h}")`,code:N.Code.ReferenceError});let A=new Set(o);A.add(h);let b=await xsc(d,s),v=_sc(b,p,d),w=(0,GQt.dirname)(d),C=await uZe(v,w,r,n,!0,A,s,d);return Bsc(C,f,m)}let l={};for(let[p,d]of Object.entries(c))l[p]=await uZe(d,t,r,n,i,o,s,a);return l}async function Roo({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let n=(await(0,Fsc.readFile)(t)).toString(),i=await Sr.load(n),o=(0,ksc.dirname)(t),s=Dsc(i,o),a=await uZe(i,o,t,s),c=[];r!=null&&(Array.isArray(r)?c=r:c=[r]);let u=a;for(let l of c)u=await cZe({absoluteFilePathToOverrides:l,context:e,data:u});return u}var Wsc=we(require("path"),1);Xt();var joo=require("fs/promises");bs();jt();var gkr=require("fs/promises");bs();var hkr=we(require("path"),1),Nsc=we(qw(),1),Foo;async function aqf(){return Foo===void 0&&(Foo=(await Nsc.default.dir({prefix:"fern-overlay-"})).path),Foo}async function Qsc({absoluteFilePathToOverlay:e,absoluteFilePathToOpenAPI:t,data:r,context:n}){let i=await cqf(e,n);if(!uqf(i,n))return r;n.logger.debug(`Applying overlay "${i.info.title}" v${i.info.version}`);let o=T8e({data:r,overlay:i}),s=await aqf(),a=hkr.default.basename(t),c=`${hkr.default.parse(a).name}.overlaid.json`,u=hkr.default.join(s,c);return await(0,gkr.writeFile)(u,JSON.stringify(o,null,2),"utf8"),n.logger.debug(`Wrote overlaid OpenAPI spec to: ${u}`),o}async function cqf(e,t){let r;try{r=await(0,gkr.readFile)(e,"utf8")}catch(n){return t.failAndThrow(`Failed to read overlay file at ${e}: ${n}`,void 0,{code:N.Code.ConfigError})}try{try{return JSON.parse(r)}catch{return Sr.load(r,{json:!0})}}catch(n){return t.failAndThrow(`Failed to parse overlay file at ${e}: ${n}`,void 0,{code:N.Code.ParseError})}}function uqf(e,t){if(!e.overlay)return t.logger.error("Overlay file missing required 'overlay' version field"),!1;if(!e.info?.title||!e.info?.version)return t.logger.error("Overlay file missing required 'info.title' or 'info.version' field"),!1;if(!Array.isArray(e.actions)||e.actions.length===0)return t.logger.error("Overlay file must have at least one action"),!1;for(let r=0;r<e.actions.length;r++){let n=e.actions[r];if(!n?.target)return t.logger.error(`Overlay action at index ${r} missing required 'target' field`),!1;if(n.update===void 0&&!n.remove)return t.logger.error(`Overlay action at index ${r} must have either 'update' or 'remove'`),!1}return!0}var HQt=we(PCr(),1),Vsc=require("fs/promises");bs();Xt();var jsc=we(PCr(),1),WQt=we(require("path"),1),$Qt=class extends jsc.BaseResolver{absolutePathToOpenAPIOverrides;absolutePathToOpenAPIOverlays;constructor({absolutePathToOpenAPIOverrides:t,absolutePathToOpenAPIOverlays:r}){super(),this.absolutePathToOpenAPIOverrides=t,this.absolutePathToOpenAPIOverlays=r}resolveExternalRef(t,r){let n=super.resolveExternalRef(t,r);if(n.startsWith("http://")||n.startsWith("https://")||rH(Ht.of(n)))return n;if(this.absolutePathToOpenAPIOverlays!=null){let i=WQt.default.resolve(WQt.default.dirname(this.absolutePathToOpenAPIOverlays),r);if(rH(Ht.of(i)))return i}return this.absolutePathToOpenAPIOverrides!=null?WQt.default.resolve(WQt.default.dirname(this.absolutePathToOpenAPIOverrides),r):n}};function Usc(e){let t=[];if(typeof e!="object"||e==null)return t;let r=new Map;koo(e,[],r);let n=new Map,i=new Map;for(let[u,l]of r){if(!l.startsWith("#/"))continue;let p=l.slice(1),d=u.endsWith(".$ref")?u.slice(0,-5):u,f=lqf(d),m=f!=null?Lsc(f):Lsc(d),h=p;n.has(m)||n.set(m,new Set),n.get(m)?.add(h),i.has(m)||i.set(m,new Map),i.get(m)?.set(h,l)}let o=new Set,s=new Set,a=[];function c(u){if(s.has(u)){let p=a.indexOf(u),d=a.slice(p);d.push(u);let f=d[d.length-2],m=f!=null?i.get(f)?.get(u):void 0;t.push({path:Msc(u),ref:m??u,cycle:d.map(h=>Msc(h))});return}if(o.has(u))return;o.add(u),s.add(u),a.push(u);let l=n.get(u);if(l)for(let p of l)c(p);a.pop(),s.delete(u)}for(let u of n.keys())c(u);return t}function lqf(e){let t=e.split(".");if(t.length>=3&&t[0]==="components")return t.slice(0,3).join(".");if(t.length>=2&&t[0]==="definitions")return t.slice(0,2).join(".")}function koo(e,t,r){if(typeof e!="object"||e==null)return;if(Array.isArray(e)){for(let i=0;i<e.length;i++)koo(e[i],[...t,String(i)],r);return}let n=e;typeof n.$ref=="string"&&r.set([...t,"$ref"].join("."),n.$ref);for(let[i,o]of Object.entries(n))i!=="$ref"&&koo(o,[...t,i],r)}function Msc(e){return e.split("/").filter(t=>t.length>0).join(".")}function Lsc(e){return e.length===0?"/":"/"+e.split(".").join("/")}async function Akr({absolutePathToOpenAPI:e,absolutePathToOpenAPIOverrides:t,absolutePathToOpenAPIOverlays:r,parsed:n,logger:i}){try{return(n!=null?await(0,HQt.bundle)({...DCr,doc:{source:new HQt.Source(e,"<openapi>"),parsed:n},externalRefResolver:new $Qt({absolutePathToOpenAPIOverrides:t,absolutePathToOpenAPIOverlays:r})}):await(0,HQt.bundle)({...DCr,ref:e,externalRefResolver:new $Qt({absolutePathToOpenAPIOverrides:t,absolutePathToOpenAPIOverlays:r})})).bundle.parsed}catch(o){if(o instanceof Error&&o.message.includes("Self-referencing circular pointer")){let s=n??await pqf(e),a=Usc(s),c=a.length>0?a.map(u=>{let l=u.cycle.join(" -> ");return` - at ${u.path} ($ref: ${u.ref})
|
|
2574
|
+
`).reduce(CLf,Object.create(null)),CLf=(e,t)=>{let r=parseInt(t,10);if(r!==Buffer.byteLength(t)+1)return e;t=t.slice((r+" ").length);let n=t.split("="),i=n.shift();if(!i)return e;let o=i.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),s=n.join("=");return e[o]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(o)?new Date(Number(s)*1e3):/^[0-9]+$/.test(s)?+s:s,e},wLf=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Xp=wLf!=="win32"?e=>e:e=>e&&e.replaceAll(/\\/g,"/"),Otc=class extends vQe{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,t,r){switch(super({}),this.pause(),this.extended=t,this.globalExtended=r,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=Xp(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?Xp(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),r&&this.#e(r,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw new Error("writing more to entry than is appropriate");let r=this.remain,n=this.blockRemain;return this.remain=Math.max(0,r-t),this.blockRemain=Math.max(0,n-t),this.ignore?!0:r>=t?super.write(e):super.write(e.subarray(0,r))}#e(e,t=!1){e.path&&(e.path=Xp(e.path)),e.linkpath&&(e.linkpath=Xp(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([r,n])=>!(n==null||r==="path"&&t))))}},XFr=(e,t,r,n={})=>{e.file&&(n.file=e.file),e.cwd&&(n.cwd=e.cwd),n.code=r instanceof Error&&r.code||t,n.tarCode=t,!e.strict&&n.recoverable!==!1?(r instanceof Error&&(n=Object.assign(r,n),r=r.message),e.emit("warn",t,r,n)):r instanceof Error?e.emit("error",Object.assign(r,n)):e.emit("error",Object.assign(new Error(`${t}: ${r}`),n))},xLf=1024*1024,Vro=Buffer.from([31,139]),qro=Buffer.from([40,181,47,253]),SLf=Math.max(Vro.length,qro.length),UU=Symbol("state"),fQe=Symbol("writeEntry"),Nue=Symbol("readEntry"),Bro=Symbol("nextEntry"),Gec=Symbol("processEntry"),GY=Symbol("extendedHeader"),PNt=Symbol("globalExtendedHeader"),pbe=Symbol("meta"),Wec=Symbol("emitMeta"),I0=Symbol("buffer"),Que=Symbol("queue"),fbe=Symbol("ended"),Tro=Symbol("emittedEnd"),dQe=Symbol("emit"),WC=Symbol("unzip"),SFr=Symbol("consumeChunk"),_Fr=Symbol("consumeChunkSub"),Oro=Symbol("consumeBody"),$ec=Symbol("consumeMeta"),Hec=Symbol("consumeHeader"),DNt=Symbol("consuming"),Pro=Symbol("bufferConcat"),BFr=Symbol("maybeEnd"),RXe=Symbol("writing"),dbe=Symbol("aborted"),TFr=Symbol("onDone"),mQe=Symbol("sawValidEntry"),OFr=Symbol("sawNullBlock"),PFr=Symbol("sawEOF"),Kec=Symbol("closeStream"),_Lf=()=>!0,WNt=class extends Itc.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[Que]=[];[I0];[Nue];[fQe];[UU]="begin";[pbe]="";[GY];[PNt];[fbe]=!1;[WC];[dbe]=!1;[mQe];[OFr]=!1;[PFr]=!1;[RXe]=!1;[DNt]=!1;[Tro]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(TFr,()=>{(this[UU]==="begin"||this[mQe]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(TFr,e.ondone):this.on(TFr,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||xLf,this.filter=typeof e.filter=="function"?e.filter:_Lf;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:t?void 0:!1;let r=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:r?!0:void 0,this.on("end",()=>this[Kec]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,r={}){XFr(this,e,t,r)}[Hec](e,t){this[mQe]===void 0&&(this[mQe]=!1);let r;try{r=new IQe(e,t,this[GY],this[PNt])}catch(n){return this.warn("TAR_ENTRY_INVALID",n)}if(r.nullBlock)this[OFr]?(this[PFr]=!0,this[UU]==="begin"&&(this[UU]="header"),this[dQe]("eof")):(this[OFr]=!0,this[dQe]("nullBlock"));else if(this[OFr]=!1,!r.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:r});else if(!r.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:r});else{let n=r.type;if(/^(Symbolic)?Link$/.test(n)&&!r.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:r});else if(!/^(Symbolic)?Link$/.test(n)&&!/^(Global)?ExtendedHeader$/.test(n)&&r.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:r});else{let i=this[fQe]=new Otc(r,this[GY],this[PNt]);if(!this[mQe])if(i.remain){let o=()=>{i.invalid||(this[mQe]=!0)};i.on("end",o)}else this[mQe]=!0;i.meta?i.size>this.maxMetaEntrySize?(i.ignore=!0,this[dQe]("ignoredEntry",i),this[UU]="ignore",i.resume()):i.size>0&&(this[pbe]="",i.on("data",o=>this[pbe]+=o),this[UU]="meta"):(this[GY]=void 0,i.ignore=i.ignore||!this.filter(i.path,i),i.ignore?(this[dQe]("ignoredEntry",i),this[UU]=i.remain?"ignore":"header",i.resume()):(i.remain?this[UU]="body":(this[UU]="header",i.end()),this[Nue]?this[Que].push(i):(this[Que].push(i),this[Bro]())))}}}[Kec](){queueMicrotask(()=>this.emit("close"))}[Gec](e){let t=!0;if(!e)this[Nue]=void 0,t=!1;else if(Array.isArray(e)){let[r,...n]=e;this.emit(r,...n)}else this[Nue]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[Bro]()),t=!1);return t}[Bro](){do;while(this[Gec](this[Que].shift()));if(this[Que].length===0){let e=this[Nue];!e||e.flowing||e.size===e.remain?this[RXe]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[Oro](e,t){let r=this[fQe];if(!r)throw new Error("attempt to consume body without entry??");let n=r.blockRemain??0,i=n>=e.length&&t===0?e:e.subarray(t,t+n);return r.write(i),r.blockRemain||(this[UU]="header",this[fQe]=void 0,r.end()),i.length}[$ec](e,t){let r=this[fQe],n=this[Oro](e,t);return!this[fQe]&&r&&this[Wec](r),n}[dQe](e,t,r){this[Que].length===0&&!this[Nue]?this.emit(e,t,r):this[Que].push([e,t,r])}[Wec](e){switch(this[dQe]("meta",this[pbe]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[GY]=GFr.parse(this[pbe],this[GY],!1);break;case"GlobalExtendedHeader":this[PNt]=GFr.parse(this[pbe],this[PNt],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[GY]??Object.create(null);this[GY]=t,t.path=this[pbe].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[GY]||Object.create(null);this[GY]=t,t.linkpath=this[pbe].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[dbe]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,r){if(typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[dbe])return r?.(),!1;if((this[WC]===void 0||this.brotli===void 0&&this[WC]===!1)&&e){if(this[I0]&&(e=Buffer.concat([this[I0],e]),this[I0]=void 0),e.length<SLf)return this[I0]=e,r?.(),!0;for(let s=0;this[WC]===void 0&&s<Vro.length;s++)e[s]!==Vro[s]&&(this[WC]=!1);let i=!1;if(this[WC]===!1&&this.zstd!==!1){i=!0;for(let s=0;s<qro.length;s++)if(e[s]!==qro[s]){i=!1;break}}let o=this.brotli===void 0&&!i;if(this[WC]===!1&&o)if(e.length<512)if(this[fbe])this.brotli=!0;else return this[I0]=e,r?.(),!0;else try{new IQe(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[WC]===void 0||this[WC]===!1&&(this.brotli||i)){let s=this[fbe];this[fbe]=!1,this[WC]=this[WC]===void 0?new Z6f({}):i?new nLf({}):new tLf({}),this[WC].on("data",c=>this[SFr](c)),this[WC].on("error",c=>this.abort(c)),this[WC].on("end",()=>{this[fbe]=!0,this[SFr]()}),this[RXe]=!0;let a=!!this[WC][s?"end":"write"](e);return this[RXe]=!1,r?.(),a}}this[RXe]=!0,this[WC]?this[WC].write(e):this[SFr](e),this[RXe]=!1;let n=this[Que].length>0?!1:this[Nue]?this[Nue].flowing:!0;return!n&&this[Que].length===0&&this[Nue]?.once("drain",()=>this.emit("drain")),r?.(),n}[Pro](e){e&&!this[dbe]&&(this[I0]=this[I0]?Buffer.concat([this[I0],e]):e)}[BFr](){if(this[fbe]&&!this[Tro]&&!this[dbe]&&!this[DNt]){this[Tro]=!0;let e=this[fQe];if(e&&e.blockRemain){let t=this[I0]?this[I0].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[I0]&&e.write(this[I0]),e.end()}this[dQe](TFr)}}[SFr](e){if(this[DNt]&&e)this[Pro](e);else if(!e&&!this[I0])this[BFr]();else if(e){if(this[DNt]=!0,this[I0]){this[Pro](e);let t=this[I0];this[I0]=void 0,this[_Fr](t)}else this[_Fr](e);for(;this[I0]&&this[I0]?.length>=512&&!this[dbe]&&!this[PFr];){let t=this[I0];this[I0]=void 0,this[_Fr](t)}this[DNt]=!1}(!this[I0]||this[fbe])&&this[BFr]()}[_Fr](e){let t=0,r=e.length;for(;t+512<=r&&!this[dbe]&&!this[PFr];)switch(this[UU]){case"begin":case"header":this[Hec](e,t),t+=512;break;case"ignore":case"body":t+=this[Oro](e,t);break;case"meta":t+=this[$ec](e,t);break;default:throw new Error("invalid state: "+this[UU])}t<r&&(this[I0]=this[I0]?Buffer.concat([e.subarray(t),this[I0]]):e.subarray(t))}end(e,t,r){return typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t)),r&&this.once("finish",r),this[dbe]||(this[WC]?(e&&this[WC].write(e),this[WC].end()):(this[fbe]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[BFr]())),this}},LNt=e=>{let t=e.length-1,r=-1;for(;t>-1&&e.charAt(t)==="/";)r=t,t--;return r===-1?e:e.slice(0,r)},BLf=e=>{let t=e.onReadEntry;e.onReadEntry=t?r=>{t(r),r.resume()}:r=>r.resume()},Ptc=(e,t)=>{let r=new Map(t.map(o=>[LNt(o),!0])),n=e.filter,i=(o,s="")=>{let a=s||(0,JFr.parse)(o).root||".",c;if(o===a)c=!1;else{let u=r.get(o);c=u!==void 0?u:i((0,JFr.dirname)(o),a)}return r.set(o,c),c};e.filter=n?(o,s)=>n(o,s)&&i(LNt(o)):o=>i(LNt(o))},TLf=e=>{let t=new WNt(e),r=e.file,n;try{n=yQe.default.openSync(r,"r");let i=yQe.default.fstatSync(n),o=e.maxReadSize||16*1024*1024;if(i.size<o){let s=Buffer.allocUnsafe(i.size),a=yQe.default.readSync(n,s,0,i.size,0);t.end(a===s.byteLength?s:s.subarray(0,a))}else{let s=0,a=Buffer.allocUnsafe(o);for(;s<i.size;){let c=yQe.default.readSync(n,a,0,o,s);if(c===0)break;s+=c,t.write(a.subarray(0,c))}t.end()}}finally{if(typeof n=="number")try{yQe.default.closeSync(n)}catch{}}},OLf=(e,t)=>{let r=new WNt(e),n=e.maxReadSize||16*1024*1024,i=e.file;return new Promise((o,s)=>{r.on("error",s),r.on("end",o),yQe.default.stat(i,(a,c)=>{if(a)s(a);else{let u=new lno(i,{readSize:n,size:c.size});u.on("error",s),u.pipe(r)}})})},ZFr=KNt(TLf,OLf,e=>new WNt(e),e=>new WNt(e),(e,t)=>{t?.length&&Ptc(e,t),e.noResume||BLf(e)}),Dtc=(e,t,r)=>(e&=4095,r&&(e=(e|384)&-19),t&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),{isAbsolute:PLf,parse:Jec}=Rtc.win32,hno=e=>{let t="",r=Jec(e);for(;PLf(e)||r.root;){let n=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":r.root;e=e.slice(n.length),t+=n,r=Jec(e)}return[t,e]},e2r=["|","<",">","?",":"],gno=e2r.map(e=>String.fromCodePoint(61440+Number(e.codePointAt(0)))),DLf=new Map(e2r.map((e,t)=>[e,gno[t]])),RLf=new Map(gno.map((e,t)=>[e,e2r[t]])),Yec=e=>e2r.reduce((t,r)=>t.split(r).join(DLf.get(r)),e),FLf=e=>gno.reduce((t,r)=>t.split(r).join(RLf.get(r)),e),Ftc=(e,t)=>t?(e=Xp(e).replace(/^\.(\/|$)/,""),LNt(t)+"/"+e):Xp(e),kLf=16*1024*1024,Xec=Symbol("process"),Zec=Symbol("file"),etc=Symbol("directory"),Wro=Symbol("symlink"),ttc=Symbol("hardlink"),RNt=Symbol("header"),NFr=Symbol("read"),$ro=Symbol("lstat"),QFr=Symbol("onlstat"),Hro=Symbol("onread"),Kro=Symbol("onreadlink"),Jro=Symbol("openfile"),Yro=Symbol("onopenfile"),Abe=Symbol("close"),WFr=Symbol("mode"),Xro=Symbol("awaitDrain"),Dro=Symbol("ondrain"),WY=Symbol("prefix"),ktc=class extends vQe{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,t={}){let r=fno(t);super(),this.path=Xp(e),this.portable=!!r.portable,this.maxReadSize=r.maxReadSize||kLf,this.linkCache=r.linkCache||new Map,this.statCache=r.statCache||new Map,this.preservePaths=!!r.preservePaths,this.cwd=Xp(r.cwd||process.cwd()),this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.mtime=r.mtime,this.prefix=r.prefix?Xp(r.prefix):void 0,this.onWriteEntry=r.onWriteEntry,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let n=!1;if(!this.preservePaths){let[o,s]=hno(this.path);o&&typeof s=="string"&&(this.path=s,n=o)}this.win32=!!r.win32||process.platform==="win32",this.win32&&(this.path=FLf(this.path.replaceAll(/\\/g,"/")),e=e.replaceAll(/\\/g,"/")),this.absolute=Xp(r.absolute||Gro.default.resolve(this.cwd,e)),this.path===""&&(this.path="./"),n&&this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path});let i=this.statCache.get(this.absolute);i?this[QFr](i):this[$ro]()}warn(e,t,r={}){return XFr(this,e,t,r)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[$ro](){q7.default.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[QFr](t)})}[QFr](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=jLf(e),this.emit("stat",e),this[Xec]()}[Xec](){switch(this.type){case"File":return this[Zec]();case"Directory":return this[etc]();case"SymbolicLink":return this[Wro]();default:return this.end()}}[WFr](e){return Dtc(e,this.type==="Directory",this.portable)}[WY](e){return Ftc(e,this.prefix)}[RNt](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new IQe({path:this[WY](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[WY](this.linkpath):this.linkpath,mode:this[WFr](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new GFr({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[WY](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[WY](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e)}[etc](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[RNt](),this.end()}[Wro](){q7.default.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Kro](t)})}[Kro](e){this.linkpath=Xp(e),this[RNt](),this.end()}[ttc](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=Xp(Gro.default.relative(this.cwd,e)),this.stat.size=0,this[RNt](),this.end()}[Zec](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[ttc](t);this.linkCache.set(e,this.absolute)}if(this[RNt](),this.stat.size===0)return this.end();this[Jro]()}[Jro](){q7.default.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[Yro](t)})}[Yro](e){if(this.fd=e,this.#e)return this[Abe]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[NFr]()}[NFr](){let{fd:e,buf:t,offset:r,length:n,pos:i}=this;if(e===void 0||t===void 0)throw new Error("cannot read file without first opening");q7.default.read(e,t,r,n,i,(o,s)=>{if(o)return this[Abe](()=>this.emit("error",o));this[Hro](s)})}[Abe](e=()=>{}){this.fd!==void 0&&q7.default.close(this.fd,e)}[Hro](e){if(e<=0&&this.remain>0){let r=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Abe](()=>this.emit("error",r))}if(e>this.remain){let r=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Abe](()=>this.emit("error",r))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let r=e;r<this.length&&e<this.blockRemain;r++)this.buf[r+this.offset]=0,e++,this.remain++;let t=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(t)?this[Dro]():this[Xro](()=>this[Dro]())}[Xro](e){this.once("drain",e)}write(e,t,r){if(typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemain<e.length){let n=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",n)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,r)}[Dro](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[Abe](e=>e?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[NFr]()}},NLf=class extends ktc{sync=!0;[$ro](){this[QFr](q7.default.lstatSync(this.absolute))}[Wro](){this[Kro](q7.default.readlinkSync(this.absolute))}[Jro](){this[Yro](q7.default.openSync(this.absolute,"r"))}[NFr](){let e=!0;try{let{fd:t,buf:r,offset:n,length:i,pos:o}=this;if(t===void 0||r===void 0)throw new Error("fd and buf must be set in READ method");let s=q7.default.readSync(t,r,n,i,o);this[Hro](s),e=!1}finally{if(e)try{this[Abe](()=>{})}catch{}}}[Xro](e){e()}[Abe](e=()=>{}){this.fd!==void 0&&q7.default.closeSync(this.fd),e()}},QLf=class extends vQe{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,t,r={}){return XFr(this,e,t,r)}constructor(e,t={}){let r=fno(t);super(),this.preservePaths=!!r.preservePaths,this.portable=!!r.portable,this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.onWriteEntry=r.onWriteEntry,this.readEntry=e;let{type:n}=e;if(n==="Unsupported")throw new Error("writing entry that should be ignored");this.type=n,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=r.prefix,this.path=Xp(e.path),this.mode=e.mode!==void 0?this[WFr](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:r.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?Xp(e.linkpath):void 0,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let i=!1;if(!this.preservePaths){let[s,a]=hno(this.path);s&&typeof a=="string"&&(this.path=a,i=s)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new IQe({path:this[WY](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[WY](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path}),this.header.encode()&&!this.noPax&&super.write(new GFr({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[WY](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[WY](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let o=this.header?.block;if(!o)throw new Error("failed to encode header");super.write(o),e.pipe(this)}[WY](e){return Ftc(e,this.prefix)}[WFr](e){return Dtc(e,this.type==="Directory",this.portable)}write(e,t,r){typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let n=e.length;if(n>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=n,super.write(e,r)}end(e,t,r){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),r&&this.once("finish",r),e?super.end(e,r):super.end(r),this}},jLf=e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported",MLf=class MXe{tail;head;length=0;static create(t=[]){return new MXe(t)}constructor(t=[]){for(let r of t)this.push(r)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");let r=t.next,n=t.prev;return r&&(r.prev=n),n&&(n.next=r),t===this.head&&(this.head=r),t===this.tail&&(this.tail=n),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,r}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let r=this.head;t.list=this,t.next=r,r&&(r.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let r=this.tail;t.list=this,t.prev=r,r&&(r.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let r=0,n=t.length;r<n;r++)ULf(this,t[r]);return this.length}unshift(...t){for(var r=0,n=t.length;r<n;r++)zLf(this,t[r]);return this.length}pop(){if(!this.tail)return;let t=this.tail.value,r=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,r.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,r=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,r.list=void 0,this.length--,t}forEach(t,r){r=r||this;for(let n=this.head,i=0;n;i++)t.call(r,n.value,i,this),n=n.next}forEachReverse(t,r){r=r||this;for(let n=this.tail,i=this.length-1;n;i--)t.call(r,n.value,i,this),n=n.prev}get(t){let r=0,n=this.head;for(;n&&r<t;r++)n=n.next;if(r===t&&n)return n.value}getReverse(t){let r=0,n=this.tail;for(;n&&r<t;r++)n=n.prev;if(r===t&&n)return n.value}map(t,r){r=r||this;let n=new MXe;for(let i=this.head;i;)n.push(t.call(r,i.value,this)),i=i.next;return n}mapReverse(t,r){r=r||this;var n=new MXe;for(let i=this.tail;i;)n.push(t.call(r,i.value,this)),i=i.prev;return n}reduce(t,r){let n,i=this.head;if(arguments.length>1)n=r;else if(this.head)i=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;i;o++)n=t(n,i.value,o),i=i.next;return n}reduceReverse(t,r){let n,i=this.tail;if(arguments.length>1)n=r;else if(this.tail)i=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let o=this.length-1;i;o--)n=t(n,i.value,o),i=i.prev;return n}toArray(){let t=new Array(this.length);for(let r=0,n=this.head;n;r++)t[r]=n.value,n=n.next;return t}toArrayReverse(){let t=new Array(this.length);for(let r=0,n=this.tail;n;r++)t[r]=n.value,n=n.prev;return t}slice(t=0,r=this.length){r<0&&(r+=this.length),t<0&&(t+=this.length);let n=new MXe;if(r<t||r<0)return n;t<0&&(t=0),r>this.length&&(r=this.length);let i=this.head,o=0;for(o=0;i&&o<t;o++)i=i.next;for(;i&&o<r;o++,i=i.next)n.push(i.value);return n}sliceReverse(t=0,r=this.length){r<0&&(r+=this.length),t<0&&(t+=this.length);let n=new MXe;if(r<t||r<0)return n;t<0&&(t=0),r>this.length&&(r=this.length);let i=this.length,o=this.tail;for(;o&&i>r;i--)o=o.prev;for(;o&&i>t;i--,o=o.prev)n.push(o.value);return n}splice(t,r=0,...n){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let i=this.head;for(let s=0;i&&s<t;s++)i=i.next;let o=[];for(let s=0;i&&s<r;s++)o.push(i.value),i=this.removeNode(i);i?i!==this.tail&&(i=i.prev):i=this.tail;for(let s of n)i=LLf(this,i,s);return o}reverse(){let t=this.head,r=this.tail;for(let n=t;n;n=n.prev){let i=n.prev;n.prev=n.next,n.next=i}return this.head=r,this.tail=t,this}};function LLf(e,t,r){let n=t,i=t?t.next:e.head,o=new Ano(r,n,i,e);return o.next===void 0&&(e.tail=o),o.prev===void 0&&(e.head=o),e.length++,o}function ULf(e,t){e.tail=new Ano(t,e.tail,void 0,e),e.head||(e.head=e.tail),e.length++}function zLf(e,t){e.head=new Ano(t,void 0,e.head,e),e.tail||(e.tail=e.head),e.length++}var Ano=class{list;next;prev;value;constructor(e,t,r,n){this.list=n,this.value=e,t?(t.next=this,this.prev=t):this.prev=void 0,r?(r.prev=this,this.next=r):this.next=void 0}},rtc=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,t){this.path=e||"./",this.absolute=t}},ntc=Buffer.alloc(1024),jFr=Symbol("onStat"),FNt=Symbol("ended"),z7=Symbol("queue"),hQe=Symbol("current"),gQe=Symbol("process"),kNt=Symbol("processing"),Rro=Symbol("processJob"),V7=Symbol("jobs"),Fro=Symbol("jobDone"),MFr=Symbol("addFSEntry"),itc=Symbol("addTarEntry"),eno=Symbol("stat"),tno=Symbol("readdir"),LFr=Symbol("onreaddir"),UFr=Symbol("pipe"),otc=Symbol("entry"),kro=Symbol("entryOpt"),zFr=Symbol("writeEntryClass"),Ntc=Symbol("write"),Nro=Symbol("ondrain"),t2r=class extends vQe{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[zFr];onWriteEntry;[z7];[V7]=0;[kNt]=!1;[FNt]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=Xp(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[zFr]=ktc,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new X6f(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new eLf(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new rLf(e.zstd)),!this.zip)throw new Error("impossible");let t=this.zip;t.on("data",r=>super.write(r)),t.on("end",()=>super.end()),t.on("drain",()=>this[Nro]()),this.on("resume",()=>t.resume())}else this.on("drain",this[Nro]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[z7]=new MLf,this[V7]=0,this.jobs=Number(e.jobs)||4,this[kNt]=!1,this[FNt]=!1}[Ntc](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t=void 0),e&&this.add(e),this[FNt]=!0,this[gQe](),r&&r(),this}write(e){if(this[FNt])throw new Error("write after end");return e instanceof Otc?this[itc](e):this[MFr](e),this.flowing}[itc](e){let t=Xp(Zro.default.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let r=new rtc(e.path,t);r.entry=new QLf(e,this[kro](r)),r.entry.on("end",()=>this[Fro](r)),this[V7]+=1,this[z7].push(r)}this[gQe]()}[MFr](e){let t=Xp(Zro.default.resolve(this.cwd,e));this[z7].push(new rtc(e,t)),this[gQe]()}[eno](e){e.pending=!0,this[V7]+=1;let t=this.follow?"stat":"lstat";$Nt.default[t](e.absolute,(r,n)=>{e.pending=!1,this[V7]-=1,r?this.emit("error",r):this[jFr](e,n)})}[jFr](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)?t.isFile()&&t.nlink>1&&e===this[hQe]&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync&&this[Rro](e):e.ignore=!0,this[gQe]()}[tno](e){e.pending=!0,this[V7]+=1,$Nt.default.readdir(e.absolute,(t,r)=>{if(e.pending=!1,this[V7]-=1,t)return this.emit("error",t);this[LFr](e,r)})}[LFr](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[gQe]()}[gQe](){if(!this[kNt]){this[kNt]=!0;for(let e=this[z7].head;e&&this[V7]<this.jobs;e=e.next)if(this[Rro](e.value),e.value.ignore){let t=e.next;this[z7].removeNode(e),e.next=t}this[kNt]=!1,this[FNt]&&this[z7].length===0&&this[V7]===0&&(this.zip?this.zip.end(ntc):(super.write(ntc),super.end()))}}get[hQe](){return this[z7]&&this[z7].head&&this[z7].head.value}[Fro](e){this[z7].shift(),this[V7]-=1,this[gQe]()}[Rro](e){if(!e.pending){if(e.entry){e===this[hQe]&&!e.piped&&this[UFr](e);return}if(!e.stat){let t=this.statCache.get(e.absolute);t?this[jFr](e,t):this[eno](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let t=this.readdirCache.get(e.absolute);if(t?this[LFr](e,t):this[tno](e),!e.readdir)return}if(e.entry=this[otc](e),!e.entry){e.ignore=!0;return}e===this[hQe]&&!e.piped&&this[UFr](e)}}}[kro](e){return{onwarn:(t,r,n)=>this.warn(t,r,n),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[otc](e){this[V7]+=1;try{return new this[zFr](e.path,this[kro](e)).on("end",()=>this[Fro](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[Nro](){this[hQe]&&this[hQe].entry&&this[hQe].entry.resume()}[UFr](e){e.piped=!0,e.readdir&&e.readdir.forEach(n=>{let i=e.path,o=i==="./"?"":i.replace(/\/*$/,"/");this[MFr](o+n)});let t=e.entry,r=this.zip;if(!t)throw new Error("cannot pipe without source");r?t.on("data",n=>{r.write(n)||t.pause()}):t.on("data",n=>{super.write(n)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,r={}){XFr(this,e,t,r)}},yno=class extends t2r{sync=!0;constructor(e){super(e),this[zFr]=NLf}pause(){}resume(){}[eno](e){let t=this.follow?"statSync":"lstatSync";this[jFr](e,$Nt.default[t](e.absolute))}[tno](e){this[LFr](e,$Nt.default.readdirSync(e.absolute))}[UFr](e){let t=e.entry,r=this.zip;if(e.readdir&&e.readdir.forEach(n=>{let i=e.path,o=i==="./"?"":i.replace(/\/*$/,"/");this[MFr](o+n)}),!t)throw new Error("Cannot pipe without source");r?t.on("data",n=>{r.write(n)}):t.on("data",n=>{super[Ntc](n)})}},VLf=(e,t)=>{let r=new yno(e),n=new Etc(e.file,{mode:e.mode||438});r.pipe(n),Qtc(r,t)},qLf=(e,t)=>{let r=new t2r(e),n=new KFr(e.file,{mode:e.mode||438});r.pipe(n);let i=new Promise((o,s)=>{n.on("error",s),n.on("close",o),r.on("error",s)});return jtc(r,t).catch(o=>r.emit("error",o)),i},Qtc=(e,t)=>{t.forEach(r=>{r.charAt(0)==="@"?ZFr({file:pno.default.resolve(e.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>e.add(n)}):e.add(r)}),e.end()},jtc=async(e,t)=>{for(let r of t)r.charAt(0)==="@"?await ZFr({file:pno.default.resolve(String(e.cwd),r.slice(1)),noResume:!0,onReadEntry:n=>{e.add(n)}}):e.add(r);e.end()},GLf=(e,t)=>{let r=new yno(e);return Qtc(r,t),r},WLf=(e,t)=>{let r=new t2r(e);return jtc(r,t).catch(n=>r.emit("error",n)),r},Mtc=KNt(VLf,qLf,GLf,WLf,(e,t)=>{if(!t?.length)throw new TypeError("no paths specified to add to archive")}),$Lf=process.env.__FAKE_PLATFORM__||process.platform,Utc=$Lf==="win32",{O_CREAT:ztc,O_NOFOLLOW:stc,O_TRUNC:Vtc,O_WRONLY:qtc}=Ino.default.constants,Gtc=Number(process.env.__FAKE_FS_O_FILENAME__)||Ino.default.constants.UV_FS_O_FILEMAP||0,HLf=Utc&&!!Gtc,KLf=512*1024,JLf=Gtc|Vtc|ztc|qtc,atc=!Utc&&typeof stc=="number"?stc|Vtc|ztc|qtc:null,Wtc=atc!==null?()=>atc:HLf?e=>e<KLf?JLf:"w":()=>"w",rno=(e,t,r)=>{try{return JNt.default.lchownSync(e,t,r)}catch(n){if(n?.code!=="ENOENT")throw n}},$Fr=(e,t,r,n)=>{JNt.default.lchown(e,t,r,i=>{n(i&&i?.code!=="ENOENT"?i:null)})},YLf=(e,t,r,n,i)=>{if(t.isDirectory())$tc(UXe.default.resolve(e,t.name),r,n,o=>{if(o)return i(o);let s=UXe.default.resolve(e,t.name);$Fr(s,r,n,i)});else{let o=UXe.default.resolve(e,t.name);$Fr(o,r,n,i)}},$tc=(e,t,r,n)=>{JNt.default.readdir(e,{withFileTypes:!0},(i,o)=>{if(i){if(i.code==="ENOENT")return n();if(i.code!=="ENOTDIR"&&i.code!=="ENOTSUP")return n(i)}if(i||!o.length)return $Fr(e,t,r,n);let s=o.length,a=null,c=u=>{if(!a){if(u)return n(a=u);if(--s===0)return $Fr(e,t,r,n)}};for(let u of o)YLf(e,u,t,r,c)})},XLf=(e,t,r,n)=>{t.isDirectory()&&Htc(UXe.default.resolve(e,t.name),r,n),rno(UXe.default.resolve(e,t.name),r,n)},Htc=(e,t,r)=>{let n;try{n=JNt.default.readdirSync(e,{withFileTypes:!0})}catch(i){let o=i;if(o?.code==="ENOENT")return;if(o?.code==="ENOTDIR"||o?.code==="ENOTSUP")return rno(e,t,r);throw o}for(let i of n)XLf(e,i,t,r);return rno(e,t,r)},Jtc=class extends Error{path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}},r2r=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}},ZLf=(e,t)=>{NN.default.stat(e,(r,n)=>{(r||!n.isDirectory())&&(r=new Jtc(e,r?.code||"ENOTDIR")),t(r)})},e4f=(e,t,r)=>{e=Xp(e);let n=t.umask??18,i=t.mode|448,o=(i&n)!==0,s=t.uid,a=t.gid,c=typeof s=="number"&&typeof a=="number"&&(s!==t.processUid||a!==t.processGid),u=t.preserve,l=t.unlink,p=Xp(t.cwd),d=(m,h)=>{m?r(m):h&&c?$tc(h,s,a,A=>d(A)):o?NN.default.chmod(e,i,r):r()};if(e===p)return ZLf(e,d);if(u)return Ktc.default.mkdir(e,{mode:i,recursive:!0}).then(m=>d(null,m??void 0),d);let f=Xp(HNt.default.relative(p,e)).split("/");nno(p,f,i,l,p,void 0,d)},nno=(e,t,r,n,i,o,s)=>{if(t.length===0)return s(null,o);let a=t.shift(),c=Xp(HNt.default.resolve(e+"/"+a));NN.default.mkdir(c,r,Ytc(c,t,r,n,i,o,s))},Ytc=(e,t,r,n,i,o,s)=>a=>{a?NN.default.lstat(e,(c,u)=>{if(c)c.path=c.path&&Xp(c.path),s(c);else if(u.isDirectory())nno(e,t,r,n,i,o,s);else if(n)NN.default.unlink(e,l=>{if(l)return s(l);NN.default.mkdir(e,r,Ytc(e,t,r,n,i,o,s))});else{if(u.isSymbolicLink())return s(new r2r(e,e+"/"+t.join("/")));s(a)}}):(o=o||e,nno(e,t,r,n,i,o,s))},t4f=e=>{let t=!1,r;try{t=NN.default.statSync(e).isDirectory()}catch(n){r=n?.code}finally{if(!t)throw new Jtc(e,r??"ENOTDIR")}},r4f=(e,t)=>{e=Xp(e);let r=t.umask??18,n=t.mode|448,i=(n&r)!==0,o=t.uid,s=t.gid,a=typeof o=="number"&&typeof s=="number"&&(o!==t.processUid||s!==t.processGid),c=t.preserve,u=t.unlink,l=Xp(t.cwd),p=m=>{m&&a&&Htc(m,o,s),i&&NN.default.chmodSync(e,n)};if(e===l)return t4f(l),p();if(c)return p(NN.default.mkdirSync(e,{mode:n,recursive:!0})??void 0);let d=Xp(HNt.default.relative(l,e)).split("/"),f;for(let m=d.shift(),h=l;m&&(h+="/"+m);m=d.shift()){h=Xp(HNt.default.resolve(h));try{NN.default.mkdirSync(h,n),f=f||h}catch{let A=NN.default.lstatSync(h);if(A.isDirectory())continue;if(u){NN.default.unlinkSync(h),NN.default.mkdirSync(h,n),f=f||h;continue}else if(A.isSymbolicLink())return new r2r(h,h+"/"+d.join("/"))}}return p(f)},Qro=Object.create(null),ctc=1e4,FXe=new Set,n4f=e=>{FXe.has(e)?FXe.delete(e):Qro[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),FXe.add(e);let t=Qro[e],r=FXe.size-ctc;if(r>ctc/10){for(let n of FXe)if(FXe.delete(n),delete Qro[n],--r<=0)break}return t},i4f=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,o4f=i4f==="win32",s4f=e=>e.split("/").slice(0,-1).reduce((t,r)=>{let n=t.at(-1);return n!==void 0&&(r=(0,vno.join)(n,r)),t.push(r||"/"),t},[]),a4f=class{#e=new Map;#t=new Map;#r=new Set;reserve(e,t){e=o4f?["win32 parallelization disabled"]:e.map(n=>LNt((0,vno.join)(n4f(n))));let r=new Set(e.map(n=>s4f(n)).reduce((n,i)=>n.concat(i)));this.#t.set(t,{dirs:r,paths:e});for(let n of e){let i=this.#e.get(n);i?i.push(t):this.#e.set(n,[t])}for(let n of r){let i=this.#e.get(n);if(!i)this.#e.set(n,[new Set([t])]);else{let o=i.at(-1);o instanceof Set?o.add(t):i.push(new Set([t]))}}return this.#i(t)}#n(e){let t=this.#t.get(e);if(!t)throw new Error("function does not have any path reservations");return{paths:t.paths.map(r=>this.#e.get(r)),dirs:[...t.dirs].map(r=>this.#e.get(r))}}check(e){let{paths:t,dirs:r}=this.#n(e);return t.every(n=>n&&n[0]===e)&&r.every(n=>n&&n[0]instanceof Set&&n[0].has(e))}#i(e){return this.#r.has(e)||!this.check(e)?!1:(this.#r.add(e),e(()=>this.#o(e)),!0)}#o(e){if(!this.#r.has(e))return!1;let t=this.#t.get(e);if(!t)throw new Error("invalid reservation");let{paths:r,dirs:n}=t,i=new Set;for(let o of r){let s=this.#e.get(o);if(!s||s?.[0]!==e)continue;let a=s[1];if(!a){this.#e.delete(o);continue}if(s.shift(),typeof a=="function")i.add(a);else for(let c of a)i.add(c)}for(let o of n){let s=this.#e.get(o),a=s?.[0];if(!(!s||!(a instanceof Set)))if(a.size===1&&s.length===1){this.#e.delete(o);continue}else if(a.size===1){s.shift();let c=s[0];typeof c=="function"&&i.add(c)}else a.delete(e)}return this.#r.delete(e),i.forEach(o=>this.#i(o)),!0}},c4f=()=>process.umask(),utc=Symbol("onEntry"),ino=Symbol("checkFs"),ltc=Symbol("checkFs2"),ono=Symbol("isReusable"),zU=Symbol("makeFs"),sno=Symbol("file"),ano=Symbol("directory"),VFr=Symbol("link"),ptc=Symbol("symlink"),ftc=Symbol("hardlink"),jNt=Symbol("ensureNoSymlink"),dtc=Symbol("unsupported"),mtc=Symbol("checkPath"),jro=Symbol("stripAbsolutePath"),bbe=Symbol("mkdir"),p_=Symbol("onError"),DFr=Symbol("pending"),htc=Symbol("pend"),kXe=Symbol("unpend"),Mro=Symbol("ended"),Lro=Symbol("maybeClose"),cno=Symbol("skip"),UNt=Symbol("doChown"),zNt=Symbol("uid"),VNt=Symbol("gid"),qNt=Symbol("checkedCwd"),u4f=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,GNt=u4f==="win32",l4f=1024,p4f=(e,t)=>{if(!GNt)return Xf.default.unlink(e,t);let r=e+".DELETE."+(0,Eno.randomBytes)(16).toString("hex");Xf.default.rename(e,r,n=>{if(n)return t(n);Xf.default.unlink(r,t)})},f4f=e=>{if(!GNt)return Xf.default.unlinkSync(e);let t=e+".DELETE."+(0,Eno.randomBytes)(16).toString("hex");Xf.default.renameSync(e,t),Xf.default.unlinkSync(t)},gtc=(e,t,r)=>e!==void 0&&e===e>>>0?e:t!==void 0&&t===t>>>0?t:r,Cno=class extends WNt{[Mro]=!1;[qNt]=!1;[DFr]=0;reservations=new a4f;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[Mro]=!0,this[Lro]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=e.preserveOwner===void 0&&typeof e.uid!="number"?!!(process.getuid&&process.getuid()===0):!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:l4f,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||GNt,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=Xp($C.default.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:c4f():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[utc](t))}warn(e,t,r={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(r.recoverable=!1),super.warn(e,t,r)}[Lro](){this[Mro]&&this[DFr]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[jro](e,t){let r=e[t],{type:n}=e;if(!r||this.preservePaths)return!0;let[i,o]=hno(r),s=o.replaceAll(/\\/g,"/").split("/");if(s.includes("..")||GNt&&/^[a-z]:\.\.$/i.test(s[0]??"")){if(t==="path"||n==="Link")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:r}),!1;let a=$C.default.posix.dirname(e.path),c=$C.default.posix.normalize($C.default.posix.join(a,s.join("/")));if(c.startsWith("../")||c==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:r}),!1}return i&&(e[t]=String(o),this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute ${t}`,{entry:e,[t]:r})),!0}[mtc](e){let t=Xp(e.path),r=t.split("/");if(this.strip){if(r.length<this.strip)return!1;if(e.type==="Link"){let n=Xp(String(e.linkpath)).split("/");if(n.length>=this.strip)e.linkpath=n.slice(this.strip).join("/");else return!1}r.splice(0,this.strip),e.path=r.join("/")}if(isFinite(this.maxDepth)&&r.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:r.length,maxDepth:this.maxDepth}),!1;if(!this[jro](e,"path")||!this[jro](e,"linkpath"))return!1;if(e.absolute=$C.default.isAbsolute(e.path)?Xp($C.default.resolve(e.path)):Xp($C.default.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:Xp(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:n}=$C.default.win32.parse(String(e.absolute));e.absolute=n+Yec(String(e.absolute).slice(n.length));let{root:i}=$C.default.win32.parse(e.path);e.path=i+Yec(e.path.slice(i.length))}return!0}[utc](e){if(!this[mtc](e))return e.resume();switch(Ltc.default.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[ino](e);default:return this[dtc](e)}}[p_](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[kXe](),t.resume())}[bbe](e,t,r){e4f(Xp(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t},r)}[UNt](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[zNt](e){return gtc(this.uid,e.uid,this.processUid)}[VNt](e){return gtc(this.gid,e.gid,this.processGid)}[sno](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.fmode,n=new KFr(String(e.absolute),{flags:Wtc(e.size),mode:r,autoClose:!1});n.on("error",a=>{n.fd&&Xf.default.close(n.fd,()=>{}),n.write=()=>!0,this[p_](a,e),t()});let i=1,o=a=>{if(a){n.fd&&Xf.default.close(n.fd,()=>{}),this[p_](a,e),t();return}--i===0&&n.fd!==void 0&&Xf.default.close(n.fd,c=>{c?this[p_](c,e):this[kXe](),t()})};n.on("finish",()=>{let a=String(e.absolute),c=n.fd;if(typeof c=="number"&&e.mtime&&!this.noMtime){i++;let u=e.atime||new Date,l=e.mtime;Xf.default.futimes(c,u,l,p=>p?Xf.default.utimes(a,u,l,d=>o(d&&p)):o())}if(typeof c=="number"&&this[UNt](e)){i++;let u=this[zNt](e),l=this[VNt](e);typeof u=="number"&&typeof l=="number"&&Xf.default.fchown(c,u,l,p=>p?Xf.default.chown(a,u,l,d=>o(d&&p)):o())}o()});let s=this.transform&&this.transform(e)||e;s!==e&&(s.on("error",a=>{this[p_](a,e),t()}),e.pipe(s)),s.pipe(n)}[ano](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode;this[bbe](String(e.absolute),r,n=>{if(n){this[p_](n,e),t();return}let i=1,o=()=>{--i===0&&(t(),this[kXe](),e.resume())};e.mtime&&!this.noMtime&&(i++,Xf.default.utimes(String(e.absolute),e.atime||new Date,e.mtime,o)),this[UNt](e)&&(i++,Xf.default.chown(String(e.absolute),Number(this[zNt](e)),Number(this[VNt](e)),o)),o()})}[dtc](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[ptc](e,t){let r=Xp($C.default.relative(this.cwd,$C.default.resolve($C.default.dirname(String(e.absolute)),String(e.linkpath)))).split("/");this[jNt](e,this.cwd,r,()=>this[VFr](e,String(e.linkpath),"symlink",t),n=>{this[p_](n,e),t()})}[ftc](e,t){let r=Xp($C.default.resolve(this.cwd,String(e.linkpath))),n=Xp(String(e.linkpath)).split("/");this[jNt](e,this.cwd,n,()=>this[VFr](e,r,"link",t),i=>{this[p_](i,e),t()})}[jNt](e,t,r,n,i){let o=r.shift();if(this.preservePaths||o===void 0)return n();let s=$C.default.resolve(t,o);Xf.default.lstat(s,(a,c)=>{if(a)return n();if(c?.isSymbolicLink())return i(new r2r(s,$C.default.resolve(s,r.join("/"))));this[jNt](e,s,r,n,i)})}[htc](){this[DFr]++}[kXe](){this[DFr]--,this[Lro]()}[cno](e){this[kXe](),e.resume()}[ono](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!GNt}[ino](e){this[htc]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,r=>this[ltc](e,r))}[ltc](e,t){let r=s=>{t(s)},n=()=>{this[bbe](this.cwd,this.dmode,s=>{if(s){this[p_](s,e),r();return}this[qNt]=!0,i()})},i=()=>{if(e.absolute!==this.cwd){let s=Xp($C.default.dirname(String(e.absolute)));if(s!==this.cwd)return this[bbe](s,this.dmode,a=>{if(a){this[p_](a,e),r();return}o()})}o()},o=()=>{Xf.default.lstat(String(e.absolute),(s,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(e.mtime??a.mtime))){this[cno](e),r();return}if(s||this[ono](e,a))return this[zU](null,e,r);if(a.isDirectory()){if(e.type==="Directory"){let c=this.chmod&&e.mode&&(a.mode&4095)!==e.mode,u=l=>this[zU](l??null,e,r);return c?Xf.default.chmod(String(e.absolute),Number(e.mode),u):u()}if(e.absolute!==this.cwd)return Xf.default.rmdir(String(e.absolute),c=>this[zU](c??null,e,r))}if(e.absolute===this.cwd)return this[zU](null,e,r);p4f(String(e.absolute),c=>this[zU](c??null,e,r))})};this[qNt]?i():n()}[zU](e,t,r){if(e){this[p_](e,t),r();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[sno](t,r);case"Link":return this[ftc](t,r);case"SymbolicLink":return this[ptc](t,r);case"Directory":case"GNUDumpDir":return this[ano](t,r)}}[VFr](e,t,r,n){Xf.default[r](t,String(e.absolute),i=>{i?this[p_](i,e):(this[kXe](),e.resume()),n()})}},NNt=e=>{try{return[null,e()]}catch(t){return[t,null]}},Xtc=class extends Cno{sync=!0;[zU](e,t){return super[zU](e,t,()=>{})}[ino](e){if(!this[qNt]){let i=this[bbe](this.cwd,this.dmode);if(i)return this[p_](i,e);this[qNt]=!0}if(e.absolute!==this.cwd){let i=Xp($C.default.dirname(String(e.absolute)));if(i!==this.cwd){let o=this[bbe](i,this.dmode);if(o)return this[p_](o,e)}}let[t,r]=NNt(()=>Xf.default.lstatSync(String(e.absolute)));if(r&&(this.keep||this.newer&&r.mtime>(e.mtime??r.mtime)))return this[cno](e);if(t||this[ono](e,r))return this[zU](null,e);if(r.isDirectory()){if(e.type==="Directory"){let o=this.chmod&&e.mode&&(r.mode&4095)!==e.mode,[s]=o?NNt(()=>{Xf.default.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[zU](s,e)}let[i]=NNt(()=>Xf.default.rmdirSync(String(e.absolute)));this[zU](i,e)}let[n]=e.absolute===this.cwd?[]:NNt(()=>f4f(String(e.absolute)));this[zU](n,e)}[sno](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.fmode,n=s=>{let a;try{Xf.default.closeSync(i)}catch(c){a=c}(s||a)&&this[p_](s||a,e),t()},i;try{i=Xf.default.openSync(String(e.absolute),Wtc(e.size),r)}catch(s){return n(s)}let o=this.transform&&this.transform(e)||e;o!==e&&(o.on("error",s=>this[p_](s,e)),e.pipe(o)),o.on("data",s=>{try{Xf.default.writeSync(i,s,0,s.length)}catch(a){n(a)}}),o.on("end",()=>{let s=null;if(e.mtime&&!this.noMtime){let a=e.atime||new Date,c=e.mtime;try{Xf.default.futimesSync(i,a,c)}catch(u){try{Xf.default.utimesSync(String(e.absolute),a,c)}catch{s=u}}}if(this[UNt](e)){let a=this[zNt](e),c=this[VNt](e);try{Xf.default.fchownSync(i,Number(a),Number(c))}catch(u){try{Xf.default.chownSync(String(e.absolute),Number(a),Number(c))}catch{s=s||u}}}n(s)})}[ano](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode,n=this[bbe](String(e.absolute),r);if(n){this[p_](n,e),t();return}if(e.mtime&&!this.noMtime)try{Xf.default.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[UNt](e))try{Xf.default.chownSync(String(e.absolute),Number(this[zNt](e)),Number(this[VNt](e)))}catch{}t(),e.resume()}[bbe](e,t){try{return r4f(Xp(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t})}catch(r){return r}}[jNt](e,t,r,n,i){if(this.preservePaths||r.length===0)return n();let o=t;for(let s of r){o=$C.default.resolve(o,s);let[a,c]=NNt(()=>Xf.default.lstatSync(o));if(a)return n();if(c.isSymbolicLink())return i(new r2r(o,$C.default.resolve(t,r.join("/"))))}n()}[VFr](e,t,r,n){let i=`${r}Sync`;try{Xf.default[i](t,String(e.absolute)),n(),e.resume()}catch(o){return this[p_](o,e)}}},d4f=e=>{let t=new Xtc(e),r=e.file,n=bno.default.statSync(r),i=e.maxReadSize||16*1024*1024;new U6f(r,{readSize:i,size:n.size}).pipe(t)},m4f=(e,t)=>{let r=new Cno(e),n=e.maxReadSize||16*1024*1024,i=e.file;return new Promise((o,s)=>{r.on("error",s),r.on("close",o),bno.default.stat(i,(a,c)=>{if(a)s(a);else{let u=new lno(i,{readSize:n,size:c.size});u.on("error",s),u.pipe(r)}})})},Ztc=KNt(d4f,m4f,e=>new Xtc(e),e=>new Cno(e),(e,t)=>{t?.length&&Ptc(e,t)}),h4f=(e,t)=>{let r=new yno(e),n=!0,i,o;try{try{i=kN.default.openSync(e.file,"r+")}catch(c){if(c?.code==="ENOENT")i=kN.default.openSync(e.file,"w+");else throw c}let s=kN.default.fstatSync(i),a=Buffer.alloc(512);e:for(o=0;o<s.size;o+=512){for(let l=0,p=0;l<512;l+=p){if(p=kN.default.readSync(i,a,l,a.length-l,o+l),o===0&&a[0]===31&&a[1]===139)throw new Error("cannot append to compressed archives");if(!p)break e}let c=new IQe(a);if(!c.cksumValid)break;let u=512*Math.ceil((c.size||0)/512);if(o+u+512>s.size)break;o+=u,e.mtimeCache&&c.mtime&&e.mtimeCache.set(String(c.path),c.mtime)}n=!1,g4f(e,r,o,i,t)}finally{if(n)try{kN.default.closeSync(i)}catch{}}},g4f=(e,t,r,n,i)=>{let o=new Etc(e.file,{fd:n,start:r});t.pipe(o),y4f(t,i)},A4f=(e,t)=>{t=Array.from(t);let r=new t2r(e),n=(i,o,s)=>{let a=(d,f)=>{d?kN.default.close(i,m=>s(d)):s(null,f)},c=0;if(o===0)return a(null,0);let u=0,l=Buffer.alloc(512),p=(d,f)=>{if(d||f===void 0)return a(d);if(u+=f,u<512&&f)return kN.default.read(i,l,u,l.length-u,c+u,p);if(c===0&&l[0]===31&&l[1]===139)return a(new Error("cannot append to compressed archives"));if(u<512)return a(null,c);let m=new IQe(l);if(!m.cksumValid)return a(null,c);let h=512*Math.ceil((m.size??0)/512);if(c+h+512>o||(c+=h+512,c>=o))return a(null,c);e.mtimeCache&&m.mtime&&e.mtimeCache.set(String(m.path),m.mtime),u=0,kN.default.read(i,l,0,512,c,p)};kN.default.read(i,l,0,512,c,p)};return new Promise((i,o)=>{r.on("error",o);let s="r+",a=(c,u)=>{if(c&&c.code==="ENOENT"&&s==="r+")return s="w+",kN.default.open(e.file,s,a);if(c||!u)return o(c);kN.default.fstat(u,(l,p)=>{if(l)return kN.default.close(u,()=>o(l));n(u,p.size,(d,f)=>{if(d)return o(d);let m=new KFr(e.file,{fd:u,start:f});r.pipe(m),m.on("error",o),m.on("close",i),b4f(r,t)})})};kN.default.open(e.file,s,a)})},y4f=(e,t)=>{t.forEach(r=>{r.charAt(0)==="@"?ZFr({file:wno.default.resolve(e.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>e.add(n)}):e.add(r)}),e.end()},b4f=async(e,t)=>{for(let r of t)r.charAt(0)==="@"?await ZFr({file:wno.default.resolve(String(e.cwd),r.slice(1)),noResume:!0,onReadEntry:n=>e.add(n)}):e.add(r);e.end()},QNt=KNt(h4f,A4f,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(e,t)=>{if(!$6f(e))throw new TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!t?.length)throw new TypeError("no paths specified to add/replace")}),zK0=KNt(QNt.syncFile,QNt.asyncFile,QNt.syncNoFile,QNt.asyncNoFile,(e,t=[])=>{QNt.validate?.(e,t),E4f(e)}),E4f=e=>{let t=e.filter;e.mtimeCache||(e.mtimeCache=new Map),e.filter=t?(r,n)=>t(r,n)&&!((e.mtimeCache?.get(r)??n.mtime??0)>(n.mtime??0)):(r,n)=>!((e.mtimeCache?.get(r)??n.mtime??0)>(n.mtime??0))};var orc=we(qw(),1);var I4f=Bue();async function src({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:n,cliVersion:i,settings:o,loadAPIWorkspace:s}){let a,c={type:Rl.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},u=t.dependencies[e];return u==null?c={type:Rl.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${B4f(u)}`},async l=>{switch(u.type){case"version":a=await S4f({context:l,dependency:u,cliVersion:i,settings:o,loadAPIWorkspace:s});return;case"local":a=await x4f({context:l,dependency:u,cliVersion:i,settings:o,loadAPIWorkspace:s});return;default:Ce(u)}}),a!=null?{didSucceed:!0,definition:a}:{didSucceed:!1,failure:c}}var arc="dependencies";var v4f="metadata.json",C4f=".fern";function w4f(e){return Ye(Ht.of((0,rrc.homedir)()),De.of(C4f),De.of(arc),De.of(e.organization),De.of(e.apiName),De.of(e.version))}async function x4f({dependency:e,context:t,cliVersion:r,settings:n,loadAPIWorkspace:i}){if(i==null){t.failWithoutThrowing("Failed to load api definition",void 0,{code:N.Code.ResolutionError});return}t.logger.info("Parsing...");let o=await i({absolutePathToWorkspace:e.absoluteFilepath,context:t,cliVersion:r,workspaceName:void 0});if(!o.didSucceed){t.failWithoutThrowing("Failed to load api definition",o.failures,{code:N.Code.ResolutionError});return}t.logger.info("Modifying source filepath ...");let s=await o.workspace.getDefinition({context:t,relativePathToDependency:De.of(e.path)},n);return t.logger.info("Loaded..."),s}async function S4f({dependency:e,context:t,cliVersion:r,settings:n,loadAPIWorkspace:i}){let o=w4f(e),s=Ye(o,De.of(arc)),a=Ye(o,De.of(v4f)),c;if(!await ar(s)||!await ar(a)){t.logger.info("Downloading manifest...");let p=await I4f.definitionRegistry.get(Gr.OrganizationId(e.organization),Gr.ApiId(e.apiName),e.version);if(!p.ok){p.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist",void 0,{code:N.Code.ResolutionError})},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist",void 0,{code:N.Code.ResolutionError})},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist",void 0,{code:N.Code.ResolutionError})},_other:h=>{t.failWithoutThrowing("Failed to download API manifest",h,{code:N.Code.NetworkError})}});return}let d=p.body.yamlSchemaVersion!=null?parseInt(p.body.yamlSchemaVersion):void 0,f=eQe(r),m=eQe(p.body.cliVersion);if(d!=null){if(d>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${p.body.cliVersion}`,void 0,{code:N.Code.VersionError});return}else if(d<1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a lower version of fern. Upgrade it to ${r}`,void 0,{code:N.Code.VersionError});return}}else if(f.major!==m.major||f.minor!==m.minor){t.failWithoutThrowing(`CLI version is ${p.body.cliVersion}. Expected ${f.major}.${f.minor}.x (to match current workspace).`,void 0,{code:N.Code.VersionError});return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+p.body.definitionS3DownloadUrl),await(0,VXe.mkdir)(s,{recursive:!0});try{await _4f({s3PreSignedReadUrl:p.body.definitionS3DownloadUrl,absolutePathToLocalOutput:s})}catch(h){t.failWithoutThrowing("Failed to download API",h,{code:N.Code.NetworkError});return}c=p.body,await(0,VXe.writeFile)(a,JSON.stringify(c))}else c=JSON.parse((await(0,VXe.readFile)(a)).toString());if(t.logger.info("Parsing..."),i==null){t.failWithoutThrowing("Failed to load API",void 0,{code:N.Code.ResolutionError});return}let u=await i({absolutePathToWorkspace:s,context:t,cliVersion:c.cliVersion,workspaceName:void 0});if(!u.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",u.failures,{code:N.Code.ParseError});return}if(u.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.",void 0,{code:N.Code.ConfigError});return}return await u.workspace.getDefinition({context:t},n)}async function _4f({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await fy.get(e,{responseType:"stream"}),n=await orc.default.dir(),i=nrc.default.join(n.path,"api.tgz");await(0,irc.pipeline)(r.data,(0,trc.createWriteStream)(i)),await Ztc({file:i,cwd:t})}function B4f(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:Ce(e)}}async function crc({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:n,settings:i,loadAPIWorkspace:o}){let s={},a={},c={};return await Promise.all(W0(t.packageMarkers).map(async([u,l])=>{if(l.contents.export==null)s[u]=l;else{let{export:p,...d}=l.contents;if(lh(d)>0)c[u]={type:Rl.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:u};else{let f=Sn(u);if(UT(t.namedDefinitionFiles).some(h=>h!==u&&h.startsWith(f)))c[u]={type:Rl.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:f};else{let h=await src({dependencyName:typeof l.contents.export=="string"?l.contents.export:l.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:n,settings:i,loadAPIWorkspace:o});h.didSucceed?a[Sn(u)]={definition:h.definition,url:typeof l.contents.export=="object"?l.contents.export.url:void 0}:c[u]=h.failure}}}})),lh(c)>0?{didSucceed:!1,failures:c}:{didSucceed:!0,packageMarkers:s,importedDefinitions:a}}jt();Xt();var urc=we(require("path"),1);var xno={};ne(xno,{additionalProperties:()=>D4f,default:()=>F4f,definitions:()=>R4f,properties:()=>O4f,required:()=>P4f,type:()=>T4f});var T4f="object",O4f={docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"default-environment":{oneOf:[{type:"string"},{type:"null"}]},environments:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/environments.EnvironmentSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/auth.ApiAuthSchema"},{type:"null"}]},"auth-schemes":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/auth.AuthSchemeDeclarationSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},name:{type:"string"},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"error-discrimination":{oneOf:[{$ref:"#/definitions/file.ErrorDiscriminationSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},errors:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"idempotency-headers":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/variables.VariableDeclarationSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"null"}]},product:{oneOf:[{$ref:"#/definitions/products.ProductDeclarationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},P4f=["name"],D4f=!1,R4f={"environments.ServerVariableSchema":{type:"object",properties:{id:{type:"string"},default:{oneOf:[{type:"string"},{type:"null"}]},values:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]}},required:["id"],additionalProperties:!1},"environments.SingleBaseUrlEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"url-template":{oneOf:[{type:"string"},{type:"null"}]},variables:{oneOf:[{type:"array",items:{$ref:"#/definitions/environments.ServerVariableSchema"}},{type:"null"}]}},required:["url"],additionalProperties:!1},"environments.MultipleBaseUrlsEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},urls:{type:"object",additionalProperties:{type:"string"}},"url-templates":{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"default-urls":{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/environments.ServerVariableSchema"}}},{type:"null"}]}},required:["urls"],additionalProperties:!1},"environments.EnvironmentSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/environments.SingleBaseUrlEnvironmentSchema"},{$ref:"#/definitions/environments.MultipleBaseUrlsEnvironmentSchema"}]},"auth.AuthSchemeReferenceSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{type:"string"}},required:["scheme"],additionalProperties:!1},"auth.AnyAuthItem":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"}]},"auth.AnyAuthSchemesSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},any:{type:"array",items:{$ref:"#/definitions/auth.AnyAuthItem"}}},required:["any"],additionalProperties:!1},"auth.EndpointSecuritySchemaDetails":{type:"object",additionalProperties:!1},"auth.EndpointSecuritySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"endpoint-security":{$ref:"#/definitions/auth.EndpointSecuritySchemaDetails"}},required:["endpoint-security"],additionalProperties:!1},"auth.ApiAuthSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"},{$ref:"#/definitions/auth.AnyAuthSchemesSchema"},{$ref:"#/definitions/auth.EndpointSecuritySchema"}]},"auth.AuthScope":{type:"string"},"auth.OAuthAccessTokenRequestPropertiesSchema":{type:"object",properties:{"client-id":{oneOf:[{type:"string"},{type:"null"}]},"client-secret":{oneOf:[{type:"string"},{type:"null"}]},scopes:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthAccessTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthGetTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthRefreshTokenRequestPropertiesSchema":{type:"object",properties:{"refresh-token":{type:"string"}},required:["refresh-token"],additionalProperties:!1},"auth.OAuthRefreshTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthRefreshTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"oauth"},type:{const:"client-credentials"},scopes:{oneOf:[{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}},{type:"null"}]},"client-id-env":{oneOf:[{type:"string"},{type:"null"}]},"client-secret-env":{oneOf:[{type:"string"},{type:"null"}]},"token-prefix":{oneOf:[{type:"string"},{type:"null"}]},"token-header":{oneOf:[{type:"string"},{type:"null"}]},"get-token":{$ref:"#/definitions/auth.OAuthGetTokenEndpointSchema"},"refresh-token":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenEndpointSchema"},{type:"null"}]}},required:["scheme","type","get-token"],additionalProperties:!1},"auth.HeaderAuthSchemeSchema":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},header:{type:"string"},type:{oneOf:[{type:"string"},{type:"null"}]},prefix:{oneOf:[{type:"string"},{type:"null"}]},placeholder:{oneOf:[{type:"string"},{type:"null"}]}},required:["header"],additionalProperties:!1},"auth.AuthVariable":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},omit:{oneOf:[{type:"boolean"},{type:"null"}]},placeholder:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.BasicAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"basic"},username:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]},password:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.TokenBearerAuthSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},token:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.InferredAuthenticatedRequestHeader":{type:"object",properties:{"response-property":{type:"string"},"header-name":{type:"string"},"value-prefix":{oneOf:[{type:"string"},{type:"null"}]}},required:["response-property","header-name"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchemaObject":{type:"object",properties:{endpoint:{type:"string"},"expiry-response-property":{oneOf:[{type:"string"},{type:"null"}]},"authenticated-request-headers":{oneOf:[{type:"array",items:{$ref:"#/definitions/auth.InferredAuthenticatedRequestHeader"}},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.InferredGetTokenEndpointSchemaObject"}]},"auth.InferredBearerAuthSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},"get-token":{$ref:"#/definitions/auth.InferredGetTokenEndpointSchema"}},required:["scheme","get-token"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{anyOf:[{$ref:"#/definitions/auth.TokenBearerAuthSchema"},{$ref:"#/definitions/auth.InferredBearerAuthSchema"}]},"auth.AuthSchemeDeclarationSchema":{anyOf:[{$ref:"#/definitions/auth.OAuthSchemeSchema"},{$ref:"#/definitions/auth.HeaderAuthSchemeSchema"},{$ref:"#/definitions/auth.BasicAuthSchemeSchema"},{$ref:"#/definitions/auth.BearerAuthSchemeSchema"}]},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ListValidationSchema":{type:"object",properties:{minItems:{oneOf:[{type:"integer"},{type:"null"}]},maxItems:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.MapValidationSchema":{type:"object",properties:{minProperties:{oneOf:[{type:"integer"},{type:"null"}]},maxProperties:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"},{$ref:"#/definitions/validation.ListValidationSchema"},{$ref:"#/definitions/validation.MapValidationSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"file.PropertyBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"property"},"property-name":{type:"string"}},required:["strategy","property-name"],additionalProperties:!1},"file.StatusCodeBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"status-code"}},required:["strategy"],additionalProperties:!1},"file.ErrorDiscriminationSchema":{anyOf:[{$ref:"#/definitions/file.PropertyBasedErrorDiscrimination"},{$ref:"#/definitions/file.StatusCodeBasedErrorDiscrimination"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"variables.VariableDeclarationDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"variables.VariableDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/variables.VariableDeclarationDetailed"}]},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.UriPaginationSchema":{type:"object",properties:{next_uri:{type:"string"},results:{type:"string"}},required:["next_uri","results"],additionalProperties:!1},"pagination.PathPaginationSchema":{type:"object",properties:{next_path:{type:"string"},results:{type:"string"}},required:["next_path","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"},{$ref:"#/definitions/pagination.UriPaginationSchema"},{$ref:"#/definitions/pagination.PathPaginationSchema"}]},"versioning.VersionValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionValue":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionValueDetailed"}]},"versioning.VersionDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionDeclarationHeaderObjectSchema"}]},"versioning.VersionDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/versioning.VersionValue"}},header:{$ref:"#/definitions/versioning.VersionDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1},"products.ProductValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},versions:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"products.ProductValue":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductValueDetailed"}]},"products.ProductDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"products.ProductDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductDeclarationHeaderObjectSchema"}]},"products.ProductDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/products.ProductValue"}},header:{$ref:"#/definitions/products.ProductDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},F4f={type:T4f,properties:O4f,required:P4f,additionalProperties:D4f,definitions:R4f};var Sno={};ne(Sno,{additionalProperties:()=>Q4f,default:()=>M4f,definitions:()=>j4f,properties:()=>N4f,type:()=>k4f});var k4f="object",N4f={docs:{oneOf:[{type:"string"},{type:"null"}]},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},"webhook-signature":{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureSchema"},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]}},Q4f=!1,j4f={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ListValidationSchema":{type:"object",properties:{minItems:{oneOf:[{type:"integer"},{type:"null"}]},maxItems:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.MapValidationSchema":{type:"object",properties:{minProperties:{oneOf:[{type:"integer"},{type:"null"}]},maxProperties:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"},{$ref:"#/definitions/validation.ListValidationSchema"},{$ref:"#/definitions/validation.MapValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}},"forward-compatible":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminatorContext":{type:"string",enum:["data","protocol"]},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},context:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminatorContext"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}},"default-variant":{oneOf:[{type:"string"},{type:"null"}]}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]},explode:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.UriPaginationSchema":{type:"object",properties:{next_uri:{type:"string"},results:{type:"string"}},required:["next_uri","results"],additionalProperties:!1},"pagination.PathPaginationSchema":{type:"object",properties:{next_path:{type:"string"},results:{type:"string"}},required:["next_path","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"},{$ref:"#/definitions/pagination.UriPaginationSchema"},{$ref:"#/definitions/pagination.PathPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/service.HttpEndpointAuth"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"webhooks.WebhookSignatureAlgorithmSchema":{type:"string",enum:["sha256","sha1","sha384","sha512"]},"webhooks.WebhookSignatureEncodingSchema":{type:"string",enum:["base64","hex"]},"webhooks.WebhookPayloadComponentSchema":{type:"string",enum:["body","timestamp","notification-url","message-id"]},"webhooks.WebhookPayloadBodySortSchema":{type:"string",enum:["alphabetical"]},"webhooks.WebhookPayloadFormatSchema":{type:"object",properties:{components:{type:"array",items:{$ref:"#/definitions/webhooks.WebhookPayloadComponentSchema"}},delimiter:{oneOf:[{type:"string"},{type:"null"}]},"body-sort":{oneOf:[{$ref:"#/definitions/webhooks.WebhookPayloadBodySortSchema"},{type:"null"}]}},required:["components"],additionalProperties:!1},"webhooks.WebhookTimestampFormatSchema":{type:"string",enum:["unix-seconds","unix-millis","iso8601"]},"webhooks.WebhookTimestampSchema":{type:"object",properties:{header:{type:"string"},format:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampFormatSchema"},{type:"null"}]},tolerance:{oneOf:[{type:"integer"},{type:"null"}]}},required:["header"],additionalProperties:!1},"webhooks.AsymmetricAlgorithmSchema":{type:"string",enum:["rsa-sha256","rsa-sha384","rsa-sha512","ecdsa-sha256","ecdsa-sha384","ecdsa-sha512","ed25519"]},"webhooks.WebhookSignatureSchema":{type:"object",properties:{type:{type:"string",enum:["hmac","asymmetric"]}},oneOf:[{properties:{type:{const:"hmac"},header:{type:"string"},algorithm:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureAlgorithmSchema"},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureEncodingSchema"},{type:"null"}]},"signature-prefix":{oneOf:[{type:"string"},{type:"null"}]},"payload-format":{oneOf:[{$ref:"#/definitions/webhooks.WebhookPayloadFormatSchema"},{type:"null"}]},timestamp:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampSchema"},{type:"null"}]}},required:["type","header"]},{properties:{type:{const:"asymmetric"},header:{type:"string"},"asymmetric-algorithm":{$ref:"#/definitions/webhooks.AsymmetricAlgorithmSchema"},encoding:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureEncodingSchema"},{type:"null"}]},"signature-prefix":{oneOf:[{type:"string"},{type:"null"}]},"jwks-url":{oneOf:[{type:"string"},{type:"null"}]},"key-id-header":{oneOf:[{type:"string"},{type:"null"}]},timestamp:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampSchema"},{type:"null"}]}},required:["type","header","asymmetric-algorithm"]}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},signature:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"method-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},"connect-method-name":{oneOf:[{type:"string"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1}},M4f={type:k4f,properties:N4f,additionalProperties:Q4f,definitions:j4f};var _no={};ne(_no,{additionalProperties:()=>z4f,default:()=>q4f,definitions:()=>V4f,properties:()=>U4f,type:()=>L4f});var L4f="object",U4f={imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},"webhook-signature":{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureSchema"},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/file.Navigation"},{type:"null"}]},export:{oneOf:[{$ref:"#/definitions/file.Export"},{type:"null"}]}},z4f=!1,V4f={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ListValidationSchema":{type:"object",properties:{minItems:{oneOf:[{type:"integer"},{type:"null"}]},maxItems:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.MapValidationSchema":{type:"object",properties:{minProperties:{oneOf:[{type:"integer"},{type:"null"}]},maxProperties:{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"},{$ref:"#/definitions/validation.ListValidationSchema"},{$ref:"#/definitions/validation.MapValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}},"forward-compatible":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminatorContext":{type:"string",enum:["data","protocol"]},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},context:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminatorContext"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}},"default-variant":{oneOf:[{type:"string"},{type:"null"}]}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]},explode:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},"client-default":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.UriPaginationSchema":{type:"object",properties:{next_uri:{type:"string"},results:{type:"string"}},required:["next_uri","results"],additionalProperties:!1},"pagination.PathPaginationSchema":{type:"object",properties:{next_path:{type:"string"},results:{type:"string"}},required:["next_path","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"},{$ref:"#/definitions/pagination.UriPaginationSchema"},{$ref:"#/definitions/pagination.PathPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/service.HttpEndpointAuth"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"webhooks.WebhookSignatureAlgorithmSchema":{type:"string",enum:["sha256","sha1","sha384","sha512"]},"webhooks.WebhookSignatureEncodingSchema":{type:"string",enum:["base64","hex"]},"webhooks.WebhookPayloadComponentSchema":{type:"string",enum:["body","timestamp","notification-url","message-id"]},"webhooks.WebhookPayloadBodySortSchema":{type:"string",enum:["alphabetical"]},"webhooks.WebhookPayloadFormatSchema":{type:"object",properties:{components:{type:"array",items:{$ref:"#/definitions/webhooks.WebhookPayloadComponentSchema"}},delimiter:{oneOf:[{type:"string"},{type:"null"}]},"body-sort":{oneOf:[{$ref:"#/definitions/webhooks.WebhookPayloadBodySortSchema"},{type:"null"}]}},required:["components"],additionalProperties:!1},"webhooks.WebhookTimestampFormatSchema":{type:"string",enum:["unix-seconds","unix-millis","iso8601"]},"webhooks.WebhookTimestampSchema":{type:"object",properties:{header:{type:"string"},format:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampFormatSchema"},{type:"null"}]},tolerance:{oneOf:[{type:"integer"},{type:"null"}]}},required:["header"],additionalProperties:!1},"webhooks.AsymmetricAlgorithmSchema":{type:"string",enum:["rsa-sha256","rsa-sha384","rsa-sha512","ecdsa-sha256","ecdsa-sha384","ecdsa-sha512","ed25519"]},"webhooks.WebhookSignatureSchema":{type:"object",properties:{type:{type:"string",enum:["hmac","asymmetric"]}},oneOf:[{properties:{type:{const:"hmac"},header:{type:"string"},algorithm:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureAlgorithmSchema"},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureEncodingSchema"},{type:"null"}]},"signature-prefix":{oneOf:[{type:"string"},{type:"null"}]},"payload-format":{oneOf:[{$ref:"#/definitions/webhooks.WebhookPayloadFormatSchema"},{type:"null"}]},timestamp:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampSchema"},{type:"null"}]}},required:["type","header"]},{properties:{type:{const:"asymmetric"},header:{type:"string"},"asymmetric-algorithm":{$ref:"#/definitions/webhooks.AsymmetricAlgorithmSchema"},encoding:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureEncodingSchema"},{type:"null"}]},"signature-prefix":{oneOf:[{type:"string"},{type:"null"}]},"jwks-url":{oneOf:[{type:"string"},{type:"null"}]},"key-id-header":{oneOf:[{type:"string"},{type:"null"}]},timestamp:{oneOf:[{$ref:"#/definitions/webhooks.WebhookTimestampSchema"},{type:"null"}]}},required:["type","header","asymmetric-algorithm"]}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},signature:{oneOf:[{$ref:"#/definitions/webhooks.WebhookSignatureSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"method-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},"connect-method-name":{oneOf:[{type:"string"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1},"file.Navigation":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"file.ExportDetailed":{type:"object",properties:{dependency:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]}},required:["dependency"],additionalProperties:!1},"file.Export":{anyOf:[{type:"string"},{$ref:"#/definitions/file.ExportDetailed"}]}},q4f={type:L4f,properties:U4f,additionalProperties:z4f,definitions:V4f};var Bno=new Map,Tno=new Map,Ono=new Map;function lrc({files:e,absolutePathToDefinition:t,skipValidation:r}){let n,i={},o={},s={};for(let[a,c]of W0(e)){let u=c.contents,l=p=>{s[a]={type:Rl.JSONSCHEMA_VALIDATION,error:p}};if(a===nI){let p=Bno.get(c.rawContents);if(p!=null&&(p.validated||r))n={defaultUrl:p.value["default-url"],contents:p.value,rawContents:c.rawContents};else if(r){let d=ph.serialization.RootApiFileSchema.parseOrThrow(u);Bno.set(c.rawContents,{value:d,validated:!1}),n={defaultUrl:d["default-url"],contents:d,rawContents:c.rawContents}}else{let d=X4(u,xno);if(d.success){let f=ph.serialization.RootApiFileSchema.parseOrThrow(u);Bno.set(c.rawContents,{value:f,validated:!0}),n={defaultUrl:f["default-url"],contents:f,rawContents:c.rawContents}}else l(d)}}else if(urc.default.basename(a)===Rf){let p=Ono.get(c.rawContents);if(p!=null&&(p.validated||r))o[a]={defaultUrl:typeof p.value.export=="object"?p.value.export.url:void 0,contents:p.value,rawContents:c.rawContents};else if(r){let d=ph.serialization.PackageMarkerFileSchema.parseOrThrow(u);Ono.set(c.rawContents,{value:d,validated:!1}),o[a]={defaultUrl:typeof d.export=="object"?d.export.url:void 0,contents:d,rawContents:c.rawContents}}else{let d=X4(u,_no);if(d.success){let f=ph.serialization.PackageMarkerFileSchema.parseOrThrow(u);Ono.set(c.rawContents,{value:f,validated:!0}),o[a]={defaultUrl:typeof f.export=="object"?f.export.url:void 0,contents:f,rawContents:c.rawContents}}else l(d)}}else{let p=Tno.get(c.rawContents);if(p!=null&&(p.validated||r))i[a]={defaultUrl:void 0,contents:p.value,rawContents:c.rawContents,absoluteFilePath:Ye(t,a)};else if(r){let d=ph.serialization.DefinitionFileSchema.parseOrThrow(u);Tno.set(c.rawContents,{value:d,validated:!1}),i[a]={defaultUrl:void 0,contents:d,rawContents:c.rawContents,absoluteFilePath:Ye(t,a)}}else{let d=X4(u,Sno);if(d.success){let f=ph.serialization.DefinitionFileSchema.parseOrThrow(u);Tno.set(c.rawContents,{value:f,validated:!0}),i[a]={defaultUrl:void 0,contents:f,rawContents:c.rawContents,absoluteFilePath:Ye(t,a)}}else l(d)}}}return n==null?{didSucceed:!1,failures:{[De.of(nI)]:{type:Rl.FILE_MISSING},...s}}:Object.keys(s).length>0?{didSucceed:!1,failures:s}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:n,packageMarkers:o}}var QN=class extends SG{type="fern";context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...n}){super(n),this.context=t,this.loadAPIWorkspace=r}async getDefinition({context:t},r){let n=t||this.context;return(await this.toFernWorkspace({context:n},r)).definition}async toFernWorkspace({context:t,skipValidation:r},n,i,o){let s=(0,prc.default)(n??{}),a=this.fernWorkspaces[s];if(a==null){let c=t||this.context,u=Ye(this.absoluteFilePath,De.of(xA)),l=await Gki({absolutePathToWorkspace:this.absoluteFilePath,context:c}),p=await FYa(u,"{yml,yaml}"),d=await kYa(p);if(!d.didSucceed)return TRr(d.failures,c.logger),c.failAndThrow(void 0,void 0,{code:N.Code.ValidationError});let f=lrc({files:d.files,absolutePathToDefinition:u,skipValidation:r});if(!f.didSucceed)return TRr(f.failures,c.logger),c.failAndThrow(void 0,void 0,{code:N.Code.ValidationError});let m=await crc({dependenciesConfiguration:l,structuralValidationResult:f,context:c,cliVersion:this.cliVersion,settings:n,loadAPIWorkspace:this.loadAPIWorkspace});if(!m.didSucceed)return TRr(m.failures,c.logger),c.failAndThrow(void 0,void 0,{code:N.Code.ValidationError});let h={absoluteFilePath:u,rootApiFile:f.rootApiFile,namedDefinitionFiles:f.namedDefinitionFiles,packageMarkers:m.packageMarkers,importedDefinitions:m.importedDefinitions};n?.auth!=null&&(h={...h,rootApiFile:{...h.rootApiFile,contents:{...h.rootApiFile.contents,auth:n?.auth}}}),a=new Uk({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:l,workspaceName:this.workspaceName,definition:h,cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[s]=a}return a}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};Xt();var $sc=require("fs/promises");var Csc=we(vsc(),1);async function dF(e){try{return(await(0,Csc.convertObj)(e,{})).openapi}catch(t){throw new N({message:`Failed to convert OpenAPI v2 (Swagger) spec to OpenAPI v3: ${t instanceof Error?t.message:String(t)}`,code:N.Code.ParseError})}}var Fsc=require("fs/promises");bs();var ksc=require("path");jt();var wsc=require("fs/promises");bs();async function cZe({absoluteFilePathToOverrides:e,data:t,context:r,allowNullKeys:n}){let i=null;try{let o=(await(0,wsc.readFile)(e,"utf8")).toString();try{i=JSON.parse(o)}catch{i=Sr.load(o,{json:!0})}}catch{return r.failAndThrow(`Failed to read overrides from file ${e}`,void 0,{code:N.Code.ParseError})}return J$({data:t,overrides:i,allowNullKeys:n})}var Osc=require("fs/promises");bs();var GQt=require("path");function Psc(e){return e.startsWith("http://")||e.startsWith("https://")}async function xsc(e,t){let r=t.get(e);if(r!==void 0)return r;let n=await(0,Osc.readFile)(e,"utf-8"),i=Sr.load(n);return t.set(e,i),i}function Dsc(e,t){let r=new Map;if(e==null||typeof e!="object"||Array.isArray(e))return r;let n=e;function i(s,a){if(!(s==null||typeof s!="object"||Array.isArray(s)))for(let[c,u]of Object.entries(s)){if(!sqf(u))continue;let l=u.$ref,{jsonPointer:p,absolutePath:d}=Rsc(l,t);r.set(`${d}#${p}`,`${a}/${c}`)}}i(n.channels,"#/channels"),i(n.operations,"#/operations");let o=n.components;if(o!=null&&typeof o=="object"&&!Array.isArray(o)){let s=o;i(s.schemas,"#/components/schemas"),i(s.messages,"#/components/messages"),i(s.parameters,"#/components/parameters")}return r}function Rsc(e,t){let r=e.indexOf("#"),n=r>=0?e.slice(0,r):e,i=r>=0?e.slice(r+1):"",o=(0,GQt.resolve)(t,n);return{filePath:n,jsonPointer:i,absolutePath:o}}function sqf(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e.$ref;return typeof t=="string"&&t.length>0&&!t.startsWith("#")&&!Psc(t)}function Ssc(e){let t={},r=!1;for(let[n,i]of Object.entries(e))n!=="$ref"&&(t[n]=i,r=!0);return{siblingProperties:t,hasSiblings:r}}function _sc(e,t,r){if(t==="")return e;let n=t.split("/").filter(o=>o!==""),i=e;for(let o of n){let s=o.replace(/~1/g,"/").replace(/~0/g,"~");if(typeof i!="object"||i==null)throw new Error(`Cannot navigate JSON Pointer "${t}" in "${r}": expected an object but found ${typeof i} at key "${s}"`);let a=i[s];if(a===void 0)throw new Error(`Cannot navigate JSON Pointer "${t}" in "${r}": key "${s}" not found`);i=a}return i}function Bsc(e,t,r){return r&&e!=null&&typeof e=="object"&&!Array.isArray(e)?{...e,...t}:e}function Tsc(e,t,r,n){if(e===r)return"#"+t;let i=`${e}#${t}`,o=n.get(i);if(o!==void 0)return o;for(let[s,a]of n){let c=s.indexOf("#"),u=s.slice(0,c),l=s.slice(c+1);if(u===e&&t.startsWith(l+"/")){let p=t.slice(l.length);return a+p}}return null}async function uZe(e,t,r,n,i=!1,o=new Set,s=new Map,a){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return Promise.all(e.map(p=>uZe(p,t,r,n,i,o,s,a)));let c=e,u=c.$ref;if(typeof u=="string"&&u.startsWith("#")&&a!=null){let p=u.substring(1),{siblingProperties:d,hasSiblings:f}=Ssc(c),m=Tsc(a,p,r,n);if(m!==null)return f?{$ref:m,...d}:{$ref:m};let h=`${a}#${p}`;if(o.has(h))throw new Error(`Circular $ref detected: "${u}" (resolved to "${h}")`);let A=new Set(o);A.add(h);let b=await xsc(a,s),v=_sc(b,p,a),w=(0,GQt.dirname)(a),C=await uZe(v,w,r,n,!0,A,s,a);return Bsc(C,d,f)}if(typeof u=="string"&&!u.startsWith("#")&&!Psc(u)){let{jsonPointer:p,absolutePath:d}=Rsc(u,t),{siblingProperties:f,hasSiblings:m}=Ssc(c);if(i){let x=Tsc(d,p,r,n);if(x!==null)return{$ref:x,...f}}let h=`${d}#${p}`;if(o.has(h))throw new N({message:`Circular $ref detected: "${u}" (resolved to "${h}")`,code:N.Code.ReferenceError});let A=new Set(o);A.add(h);let b=await xsc(d,s),v=_sc(b,p,d),w=(0,GQt.dirname)(d),C=await uZe(v,w,r,n,!0,A,s,d);return Bsc(C,f,m)}let l={};for(let[p,d]of Object.entries(c))l[p]=await uZe(d,t,r,n,i,o,s,a);return l}async function Roo({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let n=(await(0,Fsc.readFile)(t)).toString(),i=await Sr.load(n),o=(0,ksc.dirname)(t),s=Dsc(i,o),a=await uZe(i,o,t,s),c=[];r!=null&&(Array.isArray(r)?c=r:c=[r]);let u=a;for(let l of c)u=await cZe({absoluteFilePathToOverrides:l,context:e,data:u});return u}var Wsc=we(require("path"),1);Xt();var joo=require("fs/promises");bs();jt();var gkr=require("fs/promises");bs();var hkr=we(require("path"),1),Nsc=we(qw(),1),Foo;async function aqf(){return Foo===void 0&&(Foo=(await Nsc.default.dir({prefix:"fern-overlay-"})).path),Foo}async function Qsc({absoluteFilePathToOverlay:e,absoluteFilePathToOpenAPI:t,data:r,context:n}){let i=await cqf(e,n);if(!uqf(i,n))return r;n.logger.debug(`Applying overlay "${i.info.title}" v${i.info.version}`);let o=T8e({data:r,overlay:i}),s=await aqf(),a=hkr.default.basename(t),c=`${hkr.default.parse(a).name}.overlaid.json`,u=hkr.default.join(s,c);return await(0,gkr.writeFile)(u,JSON.stringify(o,null,2),"utf8"),n.logger.debug(`Wrote overlaid OpenAPI spec to: ${u}`),o}async function cqf(e,t){let r;try{r=await(0,gkr.readFile)(e,"utf8")}catch(n){return t.failAndThrow(`Failed to read overlay file at ${e}: ${n}`,void 0,{code:N.Code.ConfigError})}try{try{return JSON.parse(r)}catch{return Sr.load(r,{json:!0})}}catch(n){return t.failAndThrow(`Failed to parse overlay file at ${e}: ${n}`,void 0,{code:N.Code.ParseError})}}function uqf(e,t){if(!e.overlay)return t.logger.error("Overlay file missing required 'overlay' version field"),!1;if(!e.info?.title||!e.info?.version)return t.logger.error("Overlay file missing required 'info.title' or 'info.version' field"),!1;if(!Array.isArray(e.actions)||e.actions.length===0)return t.logger.error("Overlay file must have at least one action"),!1;for(let r=0;r<e.actions.length;r++){let n=e.actions[r];if(!n?.target)return t.logger.error(`Overlay action at index ${r} missing required 'target' field`),!1;if(n.update===void 0&&!n.remove)return t.logger.error(`Overlay action at index ${r} must have either 'update' or 'remove'`),!1}return!0}var HQt=we(PCr(),1),Vsc=require("fs/promises");bs();Xt();var jsc=we(PCr(),1),WQt=we(require("path"),1),$Qt=class extends jsc.BaseResolver{absolutePathToOpenAPIOverrides;absolutePathToOpenAPIOverlays;constructor({absolutePathToOpenAPIOverrides:t,absolutePathToOpenAPIOverlays:r}){super(),this.absolutePathToOpenAPIOverrides=t,this.absolutePathToOpenAPIOverlays=r}resolveExternalRef(t,r){let n=super.resolveExternalRef(t,r);if(n.startsWith("http://")||n.startsWith("https://")||rH(Ht.of(n)))return n;if(this.absolutePathToOpenAPIOverlays!=null){let i=WQt.default.resolve(WQt.default.dirname(this.absolutePathToOpenAPIOverlays),r);if(rH(Ht.of(i)))return i}return this.absolutePathToOpenAPIOverrides!=null?WQt.default.resolve(WQt.default.dirname(this.absolutePathToOpenAPIOverrides),r):n}};function Usc(e){let t=[];if(typeof e!="object"||e==null)return t;let r=new Map;koo(e,[],r);let n=new Map,i=new Map;for(let[u,l]of r){if(!l.startsWith("#/"))continue;let p=l.slice(1),d=u.endsWith(".$ref")?u.slice(0,-5):u,f=lqf(d),m=f!=null?Lsc(f):Lsc(d),h=p;n.has(m)||n.set(m,new Set),n.get(m)?.add(h),i.has(m)||i.set(m,new Map),i.get(m)?.set(h,l)}let o=new Set,s=new Set,a=[];function c(u){if(s.has(u)){let p=a.indexOf(u),d=a.slice(p);d.push(u);let f=d[d.length-2],m=f!=null?i.get(f)?.get(u):void 0;t.push({path:Msc(u),ref:m??u,cycle:d.map(h=>Msc(h))});return}if(o.has(u))return;o.add(u),s.add(u),a.push(u);let l=n.get(u);if(l)for(let p of l)c(p);a.pop(),s.delete(u)}for(let u of n.keys())c(u);return t}function lqf(e){let t=e.split(".");if(t.length>=3&&t[0]==="components")return t.slice(0,3).join(".");if(t.length>=2&&t[0]==="definitions")return t.slice(0,2).join(".")}function koo(e,t,r){if(typeof e!="object"||e==null)return;if(Array.isArray(e)){for(let i=0;i<e.length;i++)koo(e[i],[...t,String(i)],r);return}let n=e;typeof n.$ref=="string"&&r.set([...t,"$ref"].join("."),n.$ref);for(let[i,o]of Object.entries(n))i!=="$ref"&&koo(o,[...t,i],r)}function Msc(e){return e.split("/").filter(t=>t.length>0).join(".")}function Lsc(e){return e.length===0?"/":"/"+e.split(".").join("/")}async function Akr({absolutePathToOpenAPI:e,absolutePathToOpenAPIOverrides:t,absolutePathToOpenAPIOverlays:r,parsed:n,logger:i}){try{return(n!=null?await(0,HQt.bundle)({...DCr,doc:{source:new HQt.Source(e,"<openapi>"),parsed:n},externalRefResolver:new $Qt({absolutePathToOpenAPIOverrides:t,absolutePathToOpenAPIOverlays:r})}):await(0,HQt.bundle)({...DCr,ref:e,externalRefResolver:new $Qt({absolutePathToOpenAPIOverrides:t,absolutePathToOpenAPIOverlays:r})})).bundle.parsed}catch(o){if(o instanceof Error&&o.message.includes("Self-referencing circular pointer")){let s=n??await pqf(e),a=Usc(s),c=a.length>0?a.map(u=>{let l=u.cycle.join(" -> ");return` - at ${u.path} ($ref: ${u.ref})
|
|
2575
2575
|
cycle: ${l}`}).join(`
|
|
2576
2576
|
`):" (unable to determine exact location \u2014 check your spec for $ref cycles)";return i&&i.warn([`Circular $ref detected in ${e}.`,"The following references form a cycle:",c,"Continuing without full reference resolution."].join(`
|
|
2577
2577
|
`)),a.length>0&&fqf(s,a),s}throw o}}async function pqf(e){let t=await(0,Vsc.readFile)(e,"utf-8");return e.toLowerCase().endsWith(".json")?JSON.parse(t):Sr.load(t)}function fqf(e,t){if(typeof e!="object"||e==null)return;let r=new Set;for(let n of t)n.ref.startsWith("#/")&&r.add(n.ref);Noo(e,r)}function Noo(e,t){if(typeof e!="object"||e==null)return;if(Array.isArray(e)){for(let n=0;n<e.length;n++){let i=e[n];zsc(i,t)?e[n]={type:"object","x-fern-circular-ref":!0}:Noo(i,t)}return}let r=e;for(let n of Object.keys(r)){let i=r[n];zsc(i,t)?r[n]={type:"object","x-fern-circular-ref":!0}:Noo(i,t)}}function zsc(e,t){if(typeof e!="object"||e==null||Array.isArray(e))return!1;let r=e;return typeof r.$ref=="string"&&t.has(r.$ref)}jt();var qsc=require("fs/promises"),Gsc=require("path");async function Qoo(e,t,r){await ykr(e,t,r,"",void 0)}var dqf=new Set(["properties","patternProperties"]);async function ykr(e,t,r,n,i){if(Array.isArray(e)){await Promise.all(e.map((o,s)=>ykr(o,t,r,`${n}[${s}]`,i)));return}if(Lo(e))for(let[o,s]of Object.entries(e)){let a=n===""?o:`${n}.${o}`;if(o==="description"&&!(i!=null&&dqf.has(i))){if(typeof s=="string"||s==null)continue;if(mqf(s)){e[o]=await Aqf(s.$ref,t,r,a);continue}if(hqf(s)){r.logger.warn(`OpenAPI description at "${a}" is a \`$ref\` object we can't resolve (${gqf(s)}). Descriptions must be plain strings, and we only inline relative \`.md\` file refs. Coercing to empty string so generation can continue.`),e[o]="";continue}await ykr(s,t,r,a,o)}else await ykr(s,t,r,a,o)}}function mqf(e){if(!Lo(e))return!1;let t=Object.keys(e);if(t.length!==1||t[0]!=="$ref")return!1;let r=e.$ref;return typeof r!="string"||r.length===0||r.startsWith("#")||r.startsWith("http://")||r.startsWith("https://")?!1:r.toLowerCase().endsWith(".md")}function hqf(e){return Lo(e)&&typeof e.$ref=="string"&&e.$ref.length>0}function gqf(e){let t=e.$ref,r=Object.keys(e).filter(i=>i!=="$ref"),n=r.length>0?`, sibling keys: ${r.map(i=>`"${i}"`).join(", ")}`:"";return`target="${t}"${n}`}async function Aqf(e,t,r,n){let i=(0,Gsc.resolve)(t,e);try{return(await(0,qsc.readFile)(i,"utf-8")).trimEnd()}catch(o){return r.logger.warn(`Failed to resolve markdown description $ref at "${n}" \u2192 "${e}" (${i}): ${o instanceof Error?o.message:String(o)}. Coercing to empty string so generation can continue.`),""}}function yqf(e,t){if(t.includes(e))return e;for(let r of t){let n=r.replace(/\{[^}]+\}/g,"([^/]+)");if(new RegExp(`^${n}$`).test(e))return r}}var bqf=["examples","example",On.EXAMPLES,lB.REDOCLY_CODE_SAMPLES_CAMEL,lB.REDOCLY_CODE_SAMPLES_KEBAB];async function KQt({context:e,absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r,absolutePathToOpenAPIOverlays:n,loadAiExamples:i=!1}){let o=await(0,joo.readFile)(t,"utf-8"),s;try{s=Sr.load(o)}catch(p){if(!(p instanceof Sr.YAMLException))throw p;let f=`Failed to parse ${Wsc.default.relative(process.cwd(),t)}: ${p.reason}`;throw p.mark!=null&&(f+=`
|
|
@@ -2687,7 +2687,7 @@ ${Ovc.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&qfo(th
|
|
|
2687
2687
|
`+wje.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?wje.default.cyan(Mvc(t,this.opt.mask)):wje.default.italic(wje.default.dim("[hidden]")):this.opt.mask?Mvc(t,this.opt.mask):wje.default.italic(wje.default.dim("[input is hidden] "))}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var D3r=we(yx(),1);var jCc=we(xdo(),1),O3r=require("child_process"),Att=require("fs"),T3r=we(require("path"),1),MCc=we(require("os"),1),LCc=require("crypto"),umo=we(NCc(),1);var S3r=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var S6t=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var _3r=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var B3r=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function P3r(e="",t,r){let n=new lmo(e,r);n.runAsync((i,o)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,o)}catch(s){setImmediate(t,s,void 0)}})}function QCc(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function _wd(e){let t=[],r="";for(let n=0;n<e.length;n++){let i=e.charAt(n);n>0&&i===" "&&e[n-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${i}`}return r.length>0&&t.push(r),t}var lmo=class{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(t="",r){this.text=t,r&&(this.fileOptions=r),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(t){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(t,void 0,this.text)}catch(r){setImmediate(t,r,void 0)}})}catch(r){setImmediate(t,r,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim",r=_wd(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??MCc.default.tmpdir(),r=(0,LCc.randomUUID)(),n=QCc(this.fileOptions.prefix),i=QCc(this.fileOptions.postfix),o=`${n}${r}${i}`,s=T3r.default.resolve(t,o),a=T3r.default.resolve(t)+T3r.default.sep;if(!s.startsWith(a))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=s;let c={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(c.mode=this.fileOptions.mode),(0,Att.writeFileSync)(this.tempFile,this.text,c)}catch(t){throw new S3r(t)}}readTemporaryFile(){try{let t=(0,Att.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,jCc.detect)(t)??"utf8";umo.default.encodingExists(r)||(r="utf8"),this.text=umo.default.decode(t,r)}}catch(t){throw new _3r(t)}}removeTemporaryFile(){try{(0,Att.unlinkSync)(this.tempFile)}catch(t){throw new B3r(t)}}launchEditor(){try{let t=(0,O3r.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new S6t(t)}}launchEditorAsync(t){try{(0,O3r.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new S6t(r)}}};var UCc=we(Y6(),1);var _6t=class extends bx{_run(t){this.done=t,this.editorResult=new UCc.Subject;let r=HB(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,i=this.handleSubmitEvents(this.editorResult);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,n?this.render():this.startExternalEditor(),this}render(t){let r="",n=this.getQuestion();n+=this.status==="answered"?D3r.default.dim("Received"):D3r.default.dim("Press <enter> to launch your preferred editor."),t&&(r=D3r.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),P3r(this.currentText,this.endExternalEditor.bind(this),{postfix:this.opt.postfix??".txt"})}endExternalEditor(t,r){this.rl.resume(),t?this.editorResult.error(t):this.editorResult.next(r)}onEnd(t){this.editorResult.unsubscribe(),this.lineSubscription.unsubscribe(),this.answer=t.value,this.status="answered",this.render(),this.screen.done(),this.done(this.answer)}onError(t){this.render(t.isValid)}};var WCc=require("stream");var qCc=we(require("readline"),1),GCc=we(VCc(),1),Bje=class{constructor(t){this.rl||=qCc.default.createInterface(Twd(t)),this.rl.resume(),this.onForceClose=this.onForceClose.bind(this),process.on("exit",this.onForceClose),this.rl.on("SIGINT",this.onForceClose)}onForceClose(){this.close(),process.kill(process.pid,"SIGINT"),console.log("")}close(){this.rl.removeListener("SIGINT",this.onForceClose),process.removeListener("exit",this.onForceClose),this.rl.output.unmute(),this.activePrompt&&typeof this.activePrompt.close=="function"&&this.activePrompt.close(),this.rl.output.end(),this.rl.pause(),this.rl.close()}};function Twd(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new GCc.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var B6t=class extends Bje{constructor(t={}){super(t),this.log=new WCc.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return p6t(this.rl,this.bottomBar.split(`
|
|
2688
2688
|
`).length),this}updateBottomBar(t){return p6t(this.rl,1),this.rl.output.unmute(),this.clean(),this.bottomBar=t,this.render(),this.rl.output.mute(),this}writeLog(t){return this.rl.output.unmute(),this.clean(),this.rl.output.write(this.enforceLF(t.toString())),this.render(),this.rl.output.mute(),this}enforceLF(t){return/[\n\r]$/.test(t)?t:t+`
|
|
2689
2689
|
`}write(t){let r=t.split(/\n/);this.height=r.length,this.rl.setPrompt(r.at(-1)),this.rl.output.rows===0&&this.rl.output.columns===0&&e3r(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var Id=we(Y6(),1),KCc=we(zMt(),1);var R3r=we(Y6(),1),$Cc=we(zMt(),1),F3r=function(e,t,r){return typeof e[t]!="function"?(0,R3r.of)(e):(0,R3r.from)((0,$Cc.default)(e[t])(r).then(n=>(e[t]=n,e)))};var HCc={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,o,s)=>{i==="__proto__"||i==="constructor"||(o===s.length-1?n[i]=r:(!(i in n)||typeof n[i]!="object")&&(n[i]={}),n=n[i])})},get:(e,t="",r)=>{let n=o=>String.prototype.split.call(t,o).filter(Boolean).reduce((s,a)=>s!=null?s[a]:s,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},ytt=class extends Bje{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let n;return Array.isArray(t)?n=(0,Id.from)(t):(0,Id.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,Id.from)(Object.entries(t).map(([i,o])=>({name:i,...o}))):n=(0,Id.from)([t]),this.process=n.pipe((0,Id.concatMap)(this.processQuestion.bind(this)),(0,Id.publish)()),this.process.connect(),this.process.pipe((0,Id.reduce)((i,o)=>(HCc.set(i,o.name,o.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,Id.defer)(()=>(0,Id.of)(t).pipe((0,Id.concatMap)(this.setDefaultType.bind(this)),(0,Id.concatMap)(this.filterIfRunnable.bind(this)),(0,Id.concatMap)(()=>F3r(t,"message",this.answers)),(0,Id.concatMap)(()=>F3r(t,"default",this.answers)),(0,Id.concatMap)(()=>F3r(t,"choices",this.answers)),(0,Id.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,Id.defer)(()=>(0,Id.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,Id.defer)(()=>(0,Id.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&HCc.get(this.answers,t.name)!==void 0)return Id.EMPTY;if(t.when===!1)return Id.EMPTY;if(typeof t.when!="function")return(0,Id.of)(t);let{answers:r}=this;return(0,Id.defer)(()=>(0,Id.from)((0,KCc.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,Id.filter)(n=>n!=null)))}};function JCc(e){let t=function(r,n){let i;try{i=new ytt(t.prompts,e)}catch(s){return Promise.reject(s)}let o=i.run(r,n);return o.ui=i,o};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",d6t),this.registerPrompt("input",Cje),this.registerPrompt("number",m6t),this.registerPrompt("confirm",h6t),this.registerPrompt("rawlist",g6t),this.registerPrompt("expand",A6t),this.registerPrompt("checkbox",y6t),this.registerPrompt("password",b6t),this.registerPrompt("editor",_6t)},t.restoreDefaultPrompts(),t}var fmo=JCc();function Pwd(e,t){fmo.registerPrompt(e,t)}function Dwd(){fmo.restoreDefaultPrompts()}var Rwd={prompt:fmo,ui:{BottomBar:B6t,Prompt:ytt},createPromptModule:JCc,registerPrompt:Pwd,restoreDefaultPrompts:Dwd,Separator:XN},jp=Rwd;var btt=require("path");function XCc(){let e=Fwd();return async t=>{for(let r of t)r.module=e(r.filename);return t}}function Fwd(e=process.argv[1]?(0,btt.dirname)(process.argv[1]):process.cwd(),t=btt.sep==="\\"){let r=t?YCc(e):e;return n=>{if(!n)return;let i=t?YCc(n):n,{dir:o,base:s,ext:a}=btt.posix.parse(i);(a===".js"||a===".mjs"||a===".cjs")&&(s=s.slice(0,-1*a.length));let c=decodeURIComponent(s);o||(o=".");let u=o.lastIndexOf("/node_modules");if(u>-1)return`${o.slice(u+14).replace(/\//g,".")}:${c}`;if(o.startsWith(r)){let l=o.slice(r.length+1).replace(/\//g,".");return l?`${l}:${c}`:c}return c}}function YCc(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var dmo=e=>{if("flags"in e){let t=ZCc(e.flags),r=ewc(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,o])=>[i,mmo(o)])),n=Object.fromEntries(Object.entries(t).map(([i,o])=>[i,kwd(i,o,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function kwd(e,t,r){return{key:e,enabled:typeof t=="string"?!0:t,variant:typeof t=="string"?t:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:r?JSON.stringify(r):void 0,description:void 0}}}var ZCc=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,T6t(r)]).filter(([,t])=>t!==void 0)),ewc=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let n=t[r];return n.enabled&&n.metadata&&n.metadata.payload!==void 0}).map(r=>{let n=t[r].metadata?.payload;return[r,n?mmo(n):void 0]}))};var T6t=e=>e===void 0?void 0:e.variant??e.enabled,mmo=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function twc(){return"CompressionStream"in globalThis}async function k3r(e,t=!0){try{let n=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(n).blob()}catch(r){return t&&console.error("Failed to gzip compress data",r),null}}var N3r="0123456789abcdef",Q3r=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length===16)return new e(t);throw new TypeError("not 128-bit length")}static fromFieldsV7(t,r,n,i){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||t<0||r<0||n<0||i<0||t>0xffffffffffff||r>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");let o=new Uint8Array(16);return o[0]=t/2**40,o[1]=t/2**32,o[2]=t/2**24,o[3]=t/2**16,o[4]=t/256,o[5]=t,o[6]=112|r>>>8,o[7]=r,o[8]=128|n>>>24,o[9]=n>>>16,o[10]=n>>>8,o[11]=n,o[12]=i>>>24,o[13]=i>>>16,o[14]=i>>>8,o[15]=i,new e(o)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;default:break}if(r){let n=new Uint8Array(16);for(let i=0;i<16;i+=4){let o=parseInt(r.substring(2*i,2*i+8),16);n[i+0]=o>>>24,n[i+1]=o>>>16,n[i+2]=o>>>8,n[i+3]=o}return new e(n)}throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=N3r.charAt(this.bytes[r]>>>4),t+=N3r.charAt(15&this.bytes[r]),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=N3r.charAt(this.bytes[r]>>>4),t+=N3r.charAt(15&this.bytes[r]);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let n=this.bytes[r]-t.bytes[r];if(n!==0)return Math.sign(n)}return 0}},hmo=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??Nwd()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let n=this.generateOrAbortCore(t,r);return n===void 0&&(this.timestamp=0,n=this.generateOrAbortCore(t,r)),n}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+r>=this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return Q3r.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}generateV4(){let t=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return t[6]=64|t[6]>>>4,t[8]=128|t[8]>>>2,Q3r.ofInner(t)}},Nwd=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),rwc,UEe=()=>Qwd().toString(),Qwd=()=>(rwc||(rwc=new hmo)).generate();var eQ=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({});var jwd=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],nwc=function(e,t=[]){if(!e)return!1;let r=e.toLowerCase();return jwd.concat(t).some(n=>{let i=n.toLowerCase();return r.indexOf(i)!==-1})};var Lwd=Array.isArray,iwc=Object.prototype,cOb=iwc.hasOwnProperty,gmo=iwc.toString,Amo=Lwd||function(e){return gmo.call(e)==="[object Array]"};var ymo=e=>e===Object(e)&&!Amo(e);var O6t=e=>e===void 0,P6t=e=>gmo.call(e)=="[object String]",owc=e=>P6t(e)&&e.trim().length===0;var swc=e=>gmo.call(e)=="[object Number]"&&e===e;var bmo=e=>e instanceof Error;function j3r(e){return e===null||typeof e!="object"}function Tje(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function awc(e){return Tje(e,"ErrorEvent")}function Ett(e){return typeof Event<"u"&&Uwd(e,Event)}function cwc(e){return Tje(e,"Object")}function Uwd(e,t){try{return e instanceof t}catch{return!1}}function D6t(e,t,r,n,i){return t>r&&(n.warn("min cannot be greater than max."),t=r),swc(e)?e>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e<t?(n.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+i),D6t(i||r,t,r,n))}var zwd=864e5,M3r=class{constructor(t){this._buckets={},this._onBucketRateLimited=t._onBucketRateLimited,this._bucketSize=D6t(t.bucketSize,0,100,t._logger),this._refillRate=D6t(t.refillRate,0,this._bucketSize,t._logger),this._refillInterval=D6t(t.refillInterval,0,zwd,t._logger)}_applyRefill(t,r){let n=r-t.lastAccess,i=Math.floor(n/this._refillInterval);if(i>0){let o=i*this._refillRate;t.tokens=Math.min(t.tokens+o,this._bucketSize),t.lastAccess=t.lastAccess+i*this._refillInterval}}consumeRateLimit(t){let r=Date.now(),n=String(t),i=this._buckets[n];return i?this._applyRefill(i,r):(i={tokens:this._bucketSize,lastAccess:r},this._buckets[n]=i),i.tokens===0?!0:(i.tokens--,i.tokens===0&&this._onBucketRateLimited?.(t),i.tokens===0)}stop(){this._buckets={}}};var L3r=class{add(t){let r=UEe();return this.promiseByIds[r]=t,t.catch(()=>{}).finally(()=>{delete this.promiseByIds[r]}),t}async join(){let t=Object.values(this.promiseByIds),r=t.length;for(;r>0;)await Promise.all(t),t=Object.values(this.promiseByIds),r=t.length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}};function Vwd(e=console){return{log:e.log.bind(e),warn:e.warn.bind(e),error:e.error.bind(e),debug:e.debug.bind(e)}}var uwc=(e,t,r)=>{function n(o,...s){t(()=>{let a=r[o];a(e,...s)})}return{info:(...o)=>{n("log",...o)},warn:(...o)=>{n("warn",...o)},error:(...o)=>{n("error",...o)},critical:(...o)=>{r.error(e,...o)},createLogger:o=>uwc(`${e} ${o}`,t,r)}},qwd=e=>e();function lwc(e,t=qwd){return uwc(e,t,Vwd())}var vtt="Mobile",z3r="iOS",Itt="Android",pwc="Tablet",EOb=Itt+" "+pwc;var Gwd="Apple",IOb=Gwd+" Watch",fwc="Safari",V3r="BlackBerry",dwc="Samsung",Wwd=dwc+"Browser",$wd=dwc+" Internet",q3r="Chrome",Hwd=q3r+" OS",Kwd=q3r+" "+z3r,mwc="Internet Explorer",Jwd=mwc+" "+vtt,Imo="Opera",vOb=Imo+" Mini",hwc="Edge",Ywd="Microsoft "+hwc,vmo="Firefox",Xwd=vmo+" "+z3r,Cmo="Nintendo",wmo="PlayStation",U3r="Xbox",Zwd=Itt+" "+vtt,exd=vtt+" "+fwc,R6t="Windows",txd=R6t+" Phone";var gwc="Generic",COb=gwc+" "+vtt.toLowerCase(),wOb=gwc+" "+pwc.toLowerCase(),rxd="Konqueror",bF="(\\d+(\\.\\d+)?)",Emo=new RegExp("Version/"+bF),xOb=new RegExp(U3r,"i"),SOb=new RegExp(wmo+" \\w+","i"),_Ob=new RegExp(Cmo+" \\w+","i"),nxd=new RegExp(V3r+"|PlayBook|BB10","i"),ixd={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000","5.1":"XP","5.2":"XP","6.0":"Vista","6.1":"7","6.2":"8","6.3":"8.1","6.4":"10","10.0":"10"};var BOb={[Jwd]:[new RegExp("rv:"+bF)],[Ywd]:[new RegExp(hwc+"?\\/"+bF)],[q3r]:[new RegExp("("+q3r+"|CrMo)\\/"+bF)],[Kwd]:[new RegExp("CriOS\\/"+bF)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+bF)],[fwc]:[Emo],[exd]:[Emo],[Imo]:[new RegExp("("+Imo+"|OPR)\\/"+bF)],[vmo]:[new RegExp(vmo+"\\/"+bF)],[Xwd]:[new RegExp("FxiOS\\/"+bF)],[rxd]:[new RegExp("Konqueror[:/]?"+bF,"i")],[V3r]:[new RegExp(V3r+" "+bF),Emo],[Zwd]:[new RegExp("android\\s"+bF,"i")],[$wd]:[new RegExp(Wwd+"\\/"+bF)],[mwc]:[new RegExp("(rv:|MSIE )"+bF)],Mozilla:[new RegExp("rv:"+bF)]};var TOb=[[new RegExp(U3r+"; "+U3r+" (.*?)[);]","i"),e=>[U3r,e&&e[1]||""]],[new RegExp(Cmo,"i"),[Cmo,""]],[new RegExp(wmo,"i"),[wmo,""]],[nxd,[V3r,""]],[new RegExp(R6t,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[txd,""];if(new RegExp(vtt).test(t)&&!/IEMobile\b/.test(t))return[R6t+" "+vtt,""];let r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let n=r[1],i=ixd[n]||"";return/arm/i.test(t)&&(i="RT"),[R6t,i]}return[R6t,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){let t=[e[3],e[4],e[5]||"0"];return[z3r,t.join(".")]}return[z3r,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=O6t(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Itt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Itt+")","i"),e=>{if(e&&e[2]){let t=[e[2],e[3],e[4]||"0"];return[Itt,t.join(".")]}return[Itt,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];if(e&&e[1]){let r=[e[1],e[2],e[3]||"0"];t[1]=r.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Hwd,""]],[/Linux|debian/i,["Linux",""]]];var Awc="utf8";function ywc(e,t){if(!e||typeof e!="string"||oxd(e))throw new Error(t)}function oxd(e){return e.trim().length===0}function bwc(e){return e?.replace(/\/+$/,"")}async function Ewc(e,t){let r=null;for(let n=0;n<t.retryCount+1;n++){n>0&&await new Promise(i=>setTimeout(i,t.retryDelay));try{return await e()}catch(i){if(r=i,!t.retryCheck(i))throw i}}throw r}function G3r(){return new Date().toISOString()}function Ale(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var Iwc=e=>e instanceof Error;function xmo(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var W3r=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(n=>n!==r)}}emit(t,r){for(let n of this.events[t]||[])n(r);for(let n of this.events["*"]||[])n(t,r)}};var Oje=class extends Error{constructor(t,r){super("HTTP error while fetching PostHog: status="+t.status+", reqByteLength="+r),this.response=t,this.reqByteLength=r,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}},Ctt=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function vwc(e){if(e instanceof Oje){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function Smo(e){return typeof e=="object"&&(e instanceof Oje||e instanceof Ctt)}function Cwc(e){return typeof e=="object"&&e instanceof Oje&&e.status===413}var F6t=class{constructor(t,r={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new L3r,this._events=new W3r,this._isInitialized=!1,ywc(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=bwc(r.host||"https://us.i.posthog.com"),this.flushAt=r.flushAt?Math.max(r.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,r.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,r.maxQueueSize??1e3),this.flushInterval=r.flushInterval??1e4,this.preloadFeatureFlags=r.preloadFeatureFlags??!0,this.defaultOptIn=r.defaultOptIn??!0,this.disableSurveys=r.disableSurveys??!1,this._retryOptions={retryCount:r.fetchRetryCount??3,retryDelay:r.fetchRetryDelay??3e3,retryCheck:Smo},this.requestTimeout=r.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=r.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=r.disableGeoip??!0,this.disabled=r.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0,this._logger=lwc("[PostHog]",this.logMsgIfDebug.bind(this)),this.evaluationContexts=r?.evaluationContexts??r?.evaluationEnvironments,r?.evaluationEnvironments&&!r?.evaluationContexts&&this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version."),this.disableCompression=!twc()||(r?.disableCompression??!1)}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(eQ.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(eQ.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(eQ.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(n,i)=>this._logger.info(n,i));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){return this.promiseQueue.add(t)}identifyStateless(t,r,n){this.wrap(()=>{let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",i,n)})}async identifyStatelessImmediate(t,r,n){let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",i,n)}captureStateless(t,r,n,i){this.wrap(()=>{let o=this.buildPayload({distinct_id:t,event:r,properties:n});this.enqueue("capture",o,i)})}async captureStatelessImmediate(t,r,n,i){let o=this.buildPayload({distinct_id:t,event:r,properties:n});await this.sendImmediate("capture",o,i)}aliasStateless(t,r,n,i){this.wrap(()=>{let o=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});this.enqueue("alias",o,i)})}async aliasStatelessImmediate(t,r,n,i){let o=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",o,i)}groupIdentifyStateless(t,r,n,i,o,s){this.wrap(()=>{let a=this.buildPayload({distinct_id:o||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...s||{}}});this.enqueue("capture",a,i)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,n,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(i=>i.json()).catch(i=>{this._logger.error("Remote config could not be loaded",i),this._events.emit("error",i)})}async getFlags(t,r={},n={},i={},o={},s=!1){await this._initPromise;let a=s?"&config=true":"",c=`${this.host}/flags/?v=2${a}`,u={token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...o};this.evaluationContexts&&this.evaluationContexts.length>0&&(u.evaluation_contexts=this.evaluationContexts);let l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(u)};return this._logger.info("Flags URL",c),this.fetchWithRetry(c,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(p=>p.json()).then(p=>({success:!0,response:dmo(p)})).catch(p=>(this._events.emit("error",p),{success:!1,error:this.categorizeRequestError(p)}))}categorizeRequestError(t){if(t instanceof Oje)return{type:"api_error",statusCode:t.status};if(t instanceof Ctt){let r=t.error;return r instanceof Error&&(r.name==="AbortError"||r.name==="TimeoutError")?{type:"timeout"}:{type:"connection_error"}}return{type:"unknown_error"}}async getFeatureFlagStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagDetailStateless(t,r,n,i,o,s);if(a===void 0)return{response:void 0,requestId:void 0};let c=T6t(a.response);return c===void 0&&(c=!1),{response:c,requestId:a.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(r,n,i,o,s,[t]);return a===void 0?void 0:{response:a.flags[t],requestId:a.requestId,evaluatedAt:a.evaluatedAt}}async getFeatureFlagPayloadStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagPayloadsStateless(r,n,i,o,s,[t]);if(!a)return;let c=a[t];return c===void 0?null:c}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},o,s){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,s)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},o,s){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,s)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},o,s){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(t,r,n,i,o,s);return a?{flags:a.featureFlags,payloads:a.featureFlagPayloads,requestId:a.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},o,s){await this._initPromise;let a={};(o??this.disableGeoip)&&(a.geoip_disable=!0),s&&(a.flag_keys_to_evaluate=s);let c=await this.getFlags(t,r,n,i,a);if(!c.success)return;let u=c.response;return u.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),u.quotaLimited?.includes("feature_flags")?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:u?.requestId,quotaLimited:u.quotaLimited}):u}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this._logger.info("Loading surveys is disabled."),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},i=(await this.fetchWithRetry(t,r).then(o=>{if(o.status!==200||!o.json){let s=`Surveys API could not be loaded: ${o.status}`,a=new Error(s);this._logger.error(a),this._events.emit("error",new Error(s));return}return o.json()}).catch(o=>{this._logger.error("Surveys API could not be loaded",o),this._events.emit("error",o)}))?.surveys;return i&&this._logger.info("Surveys fetched from API: ",JSON.stringify(i)),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(eQ.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(eQ.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(eQ.Props,this.props)})}processBeforeEnqueue(t){return t}async flushStorage(){}enqueue(t,r,n){this.wrap(()=>{if(this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(t,r,n);if(i=this.processBeforeEnqueue(i),i===null)return;let o=this.getPersistedProperty(eQ.Queue)||[];o.length>=this.maxQueueSize&&(o.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),o.push({message:i}),this.setPersistedProperty(eQ.Queue,o),this._events.emit(t,i),o.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Ale(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,n){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized||await this._initPromise,this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(t,r,n);if(i=this.processBeforeEnqueue(i),i===null)return;let o={api_key:this.apiKey,batch:[i],sent_at:G3r()};this.historicalMigration&&(o.historical_migration=!0);let s=JSON.stringify(o),a=`${this.host}/batch/`,c=this.disableCompression?null:await k3r(s,this.isDebug),u={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...c!==null&&{"Content-Encoding":"gzip"}},body:c||s};try{await this.fetchWithRetry(a,u)}catch(l){this._events.emit("error",l)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:G3r(),uuid:n?.uuid?n.uuid:UEe()};return(n?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await vwc(t)})}async flush(){let t=xmo([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),xmo([t]).then(()=>{this.flushPromise===t&&(this.flushPromise=null)}),t}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(eQ.Queue)||[];if(!t.length)return;let r=[],n=t.length;for(;t.length>0&&r.length<n;){let i=t.slice(0,this.maxBatchSize),o=i.map(f=>f.message),s=async()=>{let m=(this.getPersistedProperty(eQ.Queue)||[]).slice(i.length);this.setPersistedProperty(eQ.Queue,m),t=m,await this.flushStorage()},a={api_key:this.apiKey,batch:o,sent_at:G3r()};this.historicalMigration&&(a.historical_migration=!0);let c=JSON.stringify(a),u=`${this.host}/batch/`,l=this.disableCompression?null:await k3r(c,this.isDebug),p={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...l!==null&&{"Content-Encoding":"gzip"}},body:l||c},d={retryCheck:f=>Cwc(f)?!1:Smo(f)};try{await this.fetchWithRetry(u,p,d)}catch(f){if(Cwc(f)&&o.length>1){this.maxBatchSize=Math.max(1,Math.floor(o.length/2)),this._logger.warn(`Received 413 when sending batch of size ${o.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw f instanceof Ctt||await s(),this._events.emit("error",f),f}await s(),r.push(...o)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){let o=r.body?r.body:"",s=-1;try{s=o instanceof Blob?o.size:Buffer.byteLength(o,Awc)}catch{o instanceof Blob?s=o.size:s=new TextEncoder().encode(o).length}return await Ewc(async()=>{let a=new AbortController,c=i??this.requestTimeout,u=Ale(()=>a.abort(),c),l=null;try{l=await this.fetch(t,{signal:a.signal,...r})}catch(d){throw new Ctt(d)}finally{clearTimeout(u)}if(!(r.mode==="no-cors")&&(l.status<200||l.status>=400))throw new Oje(l,s);return l},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let n=async()=>{try{for(await this.promiseQueue.join();!((this.getPersistedProperty(eQ.Queue)||[]).length===0||(await this.flush(),r)););}catch(o){if(!Smo(o))throw o;await vwc(o)}},i;try{return await Promise.race([new Promise((o,s)=>{i=Ale(()=>{this._logger.error("Timed out while shutting down PostHog"),r=!0,s("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),n()])}finally{clearTimeout(i)}}async shutdown(t=3e4){return this.shutdownPromise?this._logger.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup"):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}};var tQ={};ne(tQ,{DOMExceptionCoercer:()=>Omo,ErrorCoercer:()=>Pmo,ErrorEventCoercer:()=>Dmo,ErrorPropertiesBuilder:()=>_mo,EventCoercer:()=>kmo,ObjectCoercer:()=>Fmo,PrimitiveCoercer:()=>Nmo,PromiseRejectionEventCoercer:()=>Qmo,ReduceableCache:()=>jmo,StringCoercer:()=>Rmo,chromeStackLineParser:()=>Bmo,createDefaultStackParser:()=>Exd,createStackParser:()=>Fwc,geckoStackLineParser:()=>Tmo,nodeStackLineParser:()=>Owc,opera10StackLineParser:()=>_wc,opera11StackLineParser:()=>Bwc,reverseAndStripFrames:()=>Rwc,winjsStackLineParser:()=>Swc});var $3r,wwc,H3r;function xwc(e){let t=globalThis._posthogChunkIds;if(!t)return;let r=Object.keys(t);return H3r&&r.length===wwc||(wwc=r.length,H3r=r.reduce((n,i)=>{$3r||($3r={});let o=$3r[i];if(o)n[o[0]]=o[1];else{let s=e(i);for(let a=s.length-1;a>=0;a--){let u=s[a]?.filename,l=t[i];if(u&&l){n[u]=l,$3r[i]=[u,l];break}}}return n},{})),H3r}var axd=4,_mo=class{constructor(t,r,n=[]){this.coercers=t,this.stackParser=r,this.modifiers=n}buildFromUnknown(t,r={}){let i=r&&r.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,r,0).apply(t),a=this.buildParsingContext(r),c=this.parseStacktrace(s,a);return{$exception_list:this.convertToExceptionList(c,i),$exception_level:"error"}}async modifyFrames(t){for(let r of t)r.stacktrace&&r.stacktrace.frames&&Amo(r.stacktrace.frames)&&(r.stacktrace.frames=await this.applyModifiers(r.stacktrace.frames));return t}coerceFallback(t){return{type:"Error",value:"Unknown error",stack:t.syntheticException?.stack,synthetic:!0}}parseStacktrace(t,r){let n;t.cause!=null&&(n=this.parseStacktrace(t.cause,r));let i;return t.stack!=""&&t.stack!=null&&(i=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?r.skipFirstLines:0),r.chunkIdMap)),{...t,cause:n,stack:i}}applyChunkIds(t,r){return t.map(n=>(n.filename&&r&&(n.chunk_id=r[n.filename]),n))}applyCoercers(t,r){for(let n of this.coercers)if(n.match(t))return n.coerce(t,r);return this.coerceFallback(r)}async applyModifiers(t){let r=t;for(let n of this.modifiers)r=await n(r);return r}convertToExceptionList(t,r){let n={type:t.type,value:t.value,mechanism:{type:r.type??"generic",handled:r.handled??!0,synthetic:t.synthetic??!1}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});let i=[n];return t.cause!=null&&i.push(...this.convertToExceptionList(t.cause,{...r,handled:!0})),i}buildParsingContext(t){return{chunkIdMap:xwc(this.stackParser),skipFirstLines:t.skipFirstLines??1}}buildCoercingContext(t,r,n=0){let i=(s,a)=>{if(a<=axd){let c=this.buildCoercingContext(t,r,a);return this.applyCoercers(s,c)}};return{...r,syntheticException:n==0?r.syntheticException:void 0,mechanism:t,apply:s=>i(s,n),next:s=>i(s,n+1)}}};var JB="?";function bX(e,t,r,n,i){let o={platform:e,filename:t,function:r==="<anonymous>"?JB:r,in_app:!0};return O6t(n)||(o.lineno=n),O6t(i)||(o.colno=i),o}var K3r=(e,t)=>{let r=e.indexOf("safari-extension")!==-1,n=e.indexOf("safari-web-extension")!==-1;return r||n?[e.indexOf("@")!==-1?e.split("@")[0]:JB,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};var cxd=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,uxd=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,lxd=/\((\S*)(?::(\d+))(?::(\d+))\)/,Bmo=(e,t)=>{let r=cxd.exec(e);if(r){let[,i,o,s]=r;return bX(t,i,JB,+o,+s)}let n=uxd.exec(e);if(n){if(n[2]&&n[2].indexOf("eval")===0){let a=lxd.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}let[o,s]=K3r(n[1]||JB,n[2]);return bX(t,s,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}};var pxd=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,fxd=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Tmo=(e,t)=>{let r=pxd.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){let s=fxd.exec(r[3]);s&&(r[1]=r[1]||"eval",r[3]=s[1],r[4]=s[2],r[5]="")}let i=r[3],o=r[1]||JB;return[o,i]=K3r(o,i),bX(t,i,o,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}};var dxd=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Swc=(e,t)=>{let r=dxd.exec(e);return r?bX(t,r[2],r[1]||JB,+r[3],r[4]?+r[4]:void 0):void 0};var mxd=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,_wc=(e,t)=>{let r=mxd.exec(e);return r?bX(t,r[2],r[3]||JB,+r[1]):void 0},hxd=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,Bwc=(e,t)=>{let r=hxd.exec(e);return r?bX(t,r[5],r[3]||r[4]||JB,+r[1],+r[2]):void 0};var gxd=/^\s*[-]{4,}$/,Axd=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,Owc=(e,t)=>{let r=e.match(Axd);if(r){let n,i,o,s,a;if(r[1]){o=r[1];let l=o.lastIndexOf(".");if(o[l-1]==="."&&l--,l>0){n=o.slice(0,l),i=o.slice(l+1);let p=n.indexOf(".Module");p>0&&(o=o.slice(p+1),n=n.slice(0,p))}s=void 0}i&&(s=n,a=i),i==="<anonymous>"&&(a=void 0,o=void 0),o===void 0&&(a=a||JB,o=s?`${s}.${a}`:a);let c=r[2]?.startsWith("file://")?r[2].slice(7):r[2],u=r[5]==="native";return c?.match(/\/[A-Z]:/)&&(c=c.slice(1)),!c&&r[5]&&!u&&(c=r[5]),{filename:c?decodeURI(c):void 0,module:void 0,function:o,lineno:Twc(r[3]),colno:Twc(r[4]),in_app:yxd(c||"",u),platform:t}}if(e.match(gxd))return{filename:e,platform:t}};function yxd(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function Twc(e){return parseInt(e||"",10)||void 0}var Pwc=/\(error: (.*)\)/,Dwc=50;function Rwc(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,Dwc).map(r=>({...r,filename:r.filename||bxd(t).filename,function:r.function||JB}))}function bxd(e){return e[e.length-1]||{}}function Exd(){return Fwc("web:javascript",Bmo,Tmo)}function Fwc(e,...t){return(r,n=0)=>{let i=[],o=r.split(`
|
|
2690
|
-
`);for(let s=n;s<o.length;s++){let a=o[s];if(a.length>1024)continue;let c=Pwc.test(a)?a.replace(Pwc,"$1"):a;if(!c.match(/\S*Error: /)){for(let u of t){let l=u(c,e);if(l){i.push(l);break}}if(i.length>=Dwc)break}}return Rwc(i)}}var Omo=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=P6t(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:n?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return Tje(t,"DOMException")}isDOMError(t){return Tje(t,"DOMError")}};var Pmo=class{match(t){return bmo(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let n=t.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(t){return t.stacktrace||t.stack||void 0}};var Dmo=class{constructor(){}match(t){return awc(t)&&t.error!=null}coerce(t,r){let n=r.apply(t.error);return n||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var Ixd=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Rmo=class{match(t){return typeof t=="string"}coerce(t,r){let[n,i]=this.getInfos(t);return{type:n??"Error",value:i??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",n=t,i=t.match(Ixd);return i&&(r=i[1],n=i[2]),[r,n]}};var kwc=["fatal","error","warning","log","info","debug"];function J3r(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){let i=r.slice(0,n).join(", ");if(!(i.length>t))return n===r.length||i.length<=t?i:`${i.slice(0,t)}...`}return""}var Fmo=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let n=this.getErrorPropertyFromObject(t);return n?r.apply(n):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Ett(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let i=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(i+=` with message: '${t.message}'`),i}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),n=J3r(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return P6t(t)&&!owc(t)&&kwc.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(Iwc(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var kmo=class{match(t){return Ett(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${J3r(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var Nmo=class{match(t){return j3r(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var Qmo=class{match(t){return Tje(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ett(t))return!1;try{let r=t.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return j3r(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var jmo=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}};var jwc=require("fs"),Mwc=require("readline"),Y3r=new tQ.ReduceableCache(25),Lwc=new tQ.ReduceableCache(20),Mmo=7,vxd=1e3,Cxd=1e4;async function Uwc(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],s=o?.filename;if(!o||typeof s!="string"||typeof o.lineno!="number"||_xd(s)||Bxd(o))continue;t[s]||(t[s]=[]),t[s].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(Lwc.get(i))continue;let o=t[i];if(!o)continue;o.sort((c,u)=>c-u);let s=Oxd(o);if(s.every(c=>Txd(i,c)))continue;let a=Pxd(Y3r,i,{});n.push(wxd(i,s,a))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&xxd(e,Y3r),Y3r.reduce(),e}function wxd(e,t,r){return new Promise(n=>{let i=(0,jwc.createReadStream)(e),o=(0,Mwc.createInterface)({input:i});function s(){i.destroy(),n()}let a=0,c=0,u=t[c];if(u===void 0)return void s();let l=u[0],p=u[1];function d(){Lwc.set(e,1),o.close(),o.removeAllListeners(),s()}i.on("error",d),o.on("error",d),o.on("close",s),o.on("line",f=>{if(a++,!(a<l)&&(r[a]=Dxd(f,0),a>=p)){if(c===t.length-1){o.close(),o.removeAllListeners();return}c++;let m=t[c];if(m===void 0){o.close(),o.removeAllListeners();return}l=m[0],p=m[1]}})})}function xxd(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;Sxd(r.lineno,r,n)}}function Sxd(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=zwc(e);i<e;i++){let o=r[i];if(o===void 0)return void Nwc(t);t.pre_context.push(o)}if(r[e]===void 0)return void Nwc(t);t.context_line=r[e];let n=Vwc(e);t.post_context=[];for(let i=e+1;i<=n;i++){let o=r[i];if(o===void 0)break;t.post_context.push(o)}}function Nwc(e){delete e.pre_context,delete e.context_line,delete e.post_context}function _xd(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function Bxd(e){return e.lineno!==void 0&&e.lineno>Cxd||e.colno!==void 0&&e.colno>vxd}function Txd(e,t){let r=Y3r.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function Oxd(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=Qwc(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let o=e[t+1];if(typeof o!="number")break;o<=n[1]?n[1]=o+Mmo:(i.push(n),n=Qwc(o)),t++}return i}function Qwc(e){return[zwc(e),Vwc(e)]}function zwc(e){return Math.max(1,e-Mmo)}function Vwc(e){return e+Mmo}function Pxd(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function Dxd(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,n);return o>n-5&&(o=n),o===n&&(i=Math.max(o-140,0)),r=r.slice(i,o),i>0&&(r=`...${r}`),o<n&&(r+="..."),r}function Rxd(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(s=>s.name!=="domainUncaughtExceptionClear"&&s._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function qwc(e,t){globalThis.process?.on("uncaughtException",Rxd(e,t))}function Gwc(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var Fxd=2e3,y9=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new M3r({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return ymo(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i},s=this.errorPropertiesBuilder.buildFromUnknown(t,r);return s.$exception_list=await this.errorPropertiesBuilder.modifyFrames(s.$exception_list),{event:"$exception",distinctId:n,properties:{...s,...o},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){this.isEnabled()&&(qwc(this.onException.bind(this),this.onFatalError.bind(this)),Gwc(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{if(!e.isPreviouslyCapturedError(t)){let n=await e.buildEventMessage(t,r),o=n.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(o)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:o}):this.client.capture(n)}})())}async onFatalError(t){console.error(t),await this.client.shutdown(Fxd),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var Wwc="5.29.1";var k6t={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function $wc(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}var kxd=6e4,Nxd=1152921504606847e3,Qxd=["is_not"],wtt=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},vd=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},EX=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},X3r=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:s,...a}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=o,this.poller=void 0,this.fetch=a.fetch||fetch,this.onError=a.onError,this.customHeaders=s,this.onLoad=a.onLoad,this.cacheProvider=a.cacheProvider,this.strictLocalEvaluation=a.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}createEvaluationContext(t,r={},n={},i={},o={}){return{distinctId:t,groups:r,personProperties:n,groupProperties:i,evaluationCache:o}}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let s,a;if(!this.loadedSuccessfullyOnce)return s;if(a=this.featureFlagsByKey[t],a!==void 0){let c=this.createEvaluationContext(r,n,i,o);try{s=(await this.computeFlagAndPayloadLocally(a,c)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${s}`))}catch(u){u instanceof EX||u instanceof vd?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${t}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${u}`))}}return s}async getAllFlagsAndPayloads(t,r){await this.loadFeatureFlags();let n={},i={},o=this.featureFlags.length==0,s=r?r.map(c=>this.featureFlagsByKey[c]).filter(Boolean):this.featureFlags,a={...t,evaluationCache:t.evaluationCache??{}};return await Promise.all(s.map(async c=>{try{let{value:u,payload:l}=await this.computeFlagAndPayloadLocally(c,a);n[c.key]=u,l&&(i[c.key]=l)}catch(u){u instanceof EX||u instanceof vd?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${c.key}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${c.key}: ${u}`)),o=!0}})),{response:n,payloads:i,fallbackToFlags:o}}async computeFlagAndPayloadLocally(t,r,n={}){let{matchValue:i,skipLoadCheck:o=!1}=n;if(o||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=i!==void 0?i:await this.computeFlagValueLocally(t,r);let a=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:a}}async computeFlagValueLocally(t,r){let{distinctId:n,groups:i,personProperties:o,groupProperties:s}=r;if(t.ensure_experience_continuity)throw new vd("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let u=this.groupTypeMapping[String(c)];if(!u)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new vd("Flag has unknown group type index");if(!(u in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;t.bucketing_identifier==="device_id"&&(o?.$device_id===void 0||o?.$device_id===null||o?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${t.key}`));let l=s[u];return await this.matchFeatureFlagProperties(t,i[u],l,r)}{let u=this.getBucketingValueForFlag(t,n,o);if(u===void 0)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${t.key} without $device_id, falling back to server evaluation`)),new vd(`Can't compute feature flag: ${t.key} without $device_id`);return await this.matchFeatureFlagProperties(t,u,o,r)}}getBucketingValueForFlag(t,r,n){if(t.filters?.aggregation_group_type_index!=null)return r;if(t.bucketing_identifier==="device_id"){let i=n?.$device_id;return i==null||i===""?void 0:i}return r}getFeatureFlagPayload(t,r){let n=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),n!=null)){if(typeof n=="object")return n;if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}return null}async evaluateFlagDependency(t,r,n){let{evaluationCache:i}=n,o=t.key;if(!this.featureFlagsByKey)throw new vd("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new vd(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let s=t.dependency_chain;if(!Array.isArray(s))throw new vd(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof s})`);if(s.length===0)throw new vd(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let c of s){if(!(c in i)){let l=this.featureFlagsByKey[c];if(l)if(l.active)try{let p=await this.computeFlagValueLocally(l,n);i[c]=p}catch(p){throw new vd(`Error evaluating flag dependency '${c}' for flag '${o}': ${p}`)}else i[c]=!1;else throw new vd(`Missing flag dependency '${c}' for flag '${o}'`)}if(i[c]==null)throw new vd(`Dependency '${c}' could not be evaluated`)}let a=i[o];return this.flagEvaluatesToExpectedValue(t.value,a)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,n,i){let o=t.filters||{},s=o.groups||[],a=!1,c;for(let u of s)try{if(await this.isConditionMatch(t,r,u,n,i)){let l=u.variant,p=o.multivariate?.variants||[];c=l&&p.some(d=>d.key===l)?l:await this.getMatchingVariant(t,r)||!0;break}}catch(l){if(l instanceof EX)throw l;if(l instanceof vd)a=!0;else throw l}if(c!==void 0)return c;if(a)throw new vd("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o){let s=n.rollout_percentage,a=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let u=c.type,l=!1;if(l=u==="cohort"?Xwc(c,i,this.cohorts,this.debugMode):u==="flag"?await this.evaluateFlagDependency(c,i,o):Ywc(c,i,a),!l)return!1}if(s==null)return!0}return!(s!=null&&await Hwc(t.key,r)>s/100)}async getMatchingVariant(t,r){let n=await Hwc(t.key,r,"variant"),i=this.variantLookupTable(t).find(o=>n>=o.valueMin&&n<o.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(a=>{i=n+a.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:a.key}),n=i}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,n)=>(r[n.key]=n,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(t){if(this.strictLocalEvaluation)return;let r=t.filter(n=>n.ensure_experience_continuity);r.length>0&&console.warn(`[PostHog] You are using local evaluation but ${r.length} flag(s) have experience continuity enabled: ${r.map(n=>n.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(r.flags),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return!t&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(kxd,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(n){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${n}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new wtt(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new wtt(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new wtt(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let n=await r.json()??{};if(!("flags"in n))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let i={flags:n.flags??[],groupTypeMapping:n.group_type_mapping||{},cohorts:n.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(o){this.onError?.(new Error(`Failed to store in cache: ${o}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(t){t instanceof wtt&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let n={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(n["If-None-Match"]=r),{method:t,headers:n}}_requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=Ale(()=>{i.abort()},this.timeout),r.signal=i.signal}try{let i=this.fetch;return i(t,r)}finally{clearTimeout(n)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((n,i)=>setTimeout(()=>i(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function Hwc(e,t,r=""){let n=await $wc(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/Nxd}function Ywc(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")throw new vd("Operator is_not_set is not supported")}else throw new vd(`Property ${n} not found in propertyValues`);let s=t[n];if(s==null&&!Qxd.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function a(u,l){return Array.isArray(u)?u.map(p=>String(p).toLowerCase()).includes(String(l).toLowerCase()):String(u).toLowerCase()===String(l).toLowerCase()}function c(u,l,p){if(p==="gt")return u>l;if(p==="gte")return u>=l;if(p==="lt")return u<l;if(p==="lte")return u<=l;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return a(i,s);case"is_not":return!a(i,s);case"is_set":return n in t;case"icontains":return String(s).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(s).toLowerCase().includes(String(i).toLowerCase());case"regex":return Kwc(String(i))&&String(s).match(String(i))!==null;case"not_regex":return Kwc(String(i))&&String(s).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let u=typeof i=="number"?i:null;if(typeof i=="string")try{u=parseFloat(i)}catch{}return u==null||s==null?c(String(s),String(i),o):typeof s=="string"?c(s,String(i),o):c(s,u,o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new vd("Date operations cannot be performed on boolean values");let u=zxd(String(i));if(u==null&&(u=Jwc(i)),u==null)throw new vd(`Invalid date: ${i}`);let l=Jwc(s);return["is_date_before"].includes(o)?l<u:l>u}case"semver_eq":return fz(YB(String(s)),YB(String(i)))===0;case"semver_neq":return fz(YB(String(s)),YB(String(i)))!==0;case"semver_gt":return fz(YB(String(s)),YB(String(i)))>0;case"semver_gte":return fz(YB(String(s)),YB(String(i)))>=0;case"semver_lt":return fz(YB(String(s)),YB(String(i)))<0;case"semver_lte":return fz(YB(String(s)),YB(String(i)))<=0;case"semver_tilde":{let u=YB(String(s)),{lower:l,upper:p}=Mxd(String(i));return fz(u,l)>=0&&fz(u,p)<0}case"semver_caret":{let u=YB(String(s)),{lower:l,upper:p}=Lxd(String(i));return fz(u,l)>=0&&fz(u,p)<0}case"semver_wildcard":{let u=YB(String(s)),{lower:l,upper:p}=Uxd(String(i));return fz(u,l)>=0&&fz(u,p)<0}default:throw new vd(`Unknown operator: ${o}`)}}function jxd(e,t){if(!(e in t))throw new EX(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function Xwc(e,t,r,n=!1){let i=String(e.value);jxd(i,r);let o=r[i];return Zwc(o,t,r,n)}function Zwc(e,t,r,n=!1){if(!e)return!0;let i=e.type,o=e.values;if(!o||o.length===0)return!0;let s=!1;if("values"in o[0]){for(let a of o)try{let c=Zwc(a,t,r,n);if(i==="AND"){if(!c)return!1}else if(c)return!0}catch(c){if(c instanceof EX)throw c;if(c instanceof vd)n&&console.debug(`Failed to compute property ${a} locally: ${c}`),s=!0;else throw c}if(s)throw new vd("Can't match cohort without a given cohort property value");return i==="AND"}for(let a of o)try{let c;if(a.type==="cohort")c=Xwc(a,t,r,n);else if(a.type==="flag"){n&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${a.key||"unknown"}'`);continue}else c=Ywc(a,t);let u=a.negation||!1;if(i==="AND"){if(!c&&!u||c&&u)return!1}else if(c&&!u||!c&&u)return!0}catch(c){if(c instanceof EX)throw c;if(c instanceof vd)n&&console.debug(`Failed to compute property ${a} locally: ${c}`),s=!0;else throw c}if(s)throw new vd("can't match cohort without a given cohort property value");return i==="AND"}function Kwc(e){try{return new RegExp(e),!0}catch{return!1}}function YB(e){let r=String(e).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!r||r.startsWith("."))throw new vd(`Invalid semver: ${e}`);let n=r.split("."),i=c=>{if(c===void 0||c==="")return 0;if(!/^\d+$/.test(c))throw new vd(`Invalid semver: ${e}`);return parseInt(c,10)},o=i(n[0]),s=i(n[1]),a=i(n[2]);return[o,s,a]}function fz(e,t){for(let r=0;r<3;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0}function Mxd(e){let t=YB(e),r=[t[0],t[1],t[2]],n=[t[0],t[1]+1,0];return{lower:r,upper:n}}function Lxd(e){let t=YB(e),[r,n,i]=t,o=[r,n,i],s;return s=r>0?[r+1,0,0]:n>0?[0,n+1,0]:[0,0,i+1],{lower:o,upper:s}}function Uxd(e){let r=String(e).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!r)throw new vd(`Invalid wildcard semver: ${e}`);let n=r.split("."),i=parseInt(n[0],10);if(isNaN(i))throw new vd(`Invalid wildcard semver: ${e}`);let o,s;if(n.length===1)o=[i,0,0],s=[i+1,0,0];else{let a=parseInt(n[1],10);if(isNaN(a))throw new vd(`Invalid wildcard semver: ${e}`);o=[i,a,0],s=[i,a+1,0]}return{lower:o,upper:s}}function Jwc(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new vd(`${e} is in an invalid date format`)}throw new vd(`The date provided ${e} must be a string, number, or date object`)}function zxd(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(!r)return null;{if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let o=r.groups.interval;if(o=="h")n.setUTCHours(n.getUTCHours()-i);else if(o=="d")n.setUTCDate(n.getUTCDate()-i);else if(o=="w")n.setUTCDate(n.getUTCDate()-7*i);else if(o=="m")n.setUTCMonth(n.getUTCMonth()-i);else{if(o!="y")return null;n.setUTCFullYear(n.getUTCFullYear()-i)}return n}}var Z3r=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var Vxd=100,exc=3e4,qxd=5e4,Gxd=50,Wxd=500,eUr=class extends F6t{constructor(t,r={}){if(super(t,r),this._memoryStorage=new Z3r,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,Vxd):exc,typeof r.waitUntilDebounceMs=="number"&&(this.options.waitUntilDebounceMs=Math.max(r.waitUntilDebounceMs,0)),typeof r.waitUntilMaxWaitMs=="number"&&(this.options.waitUntilMaxWaitMs=Math.max(r.waitUntilMaxWaitMs,0)),r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new X3r({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider,strictLocalEvaluation:r.strictLocalEvaluation}))}this.errorTracking=new y9(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||qxd}enqueue(t,r,n){super.enqueue(t,r,n),this.scheduleDebouncedFlush()}async flush(){let t=super.flush(),r=this.options.waitUntil;if(r&&!this._waitUntilCycle)try{r(t.catch(()=>{}))}catch{}return t}scheduleDebouncedFlush(){let t=this.options.waitUntil;if(!t||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let s,a=new Promise(c=>{s=c});try{t(a)}catch{return}this._waitUntilCycle={resolve:s,startedAt:Date.now(),timer:void 0}}let r=Date.now()-this._waitUntilCycle.startedAt,n=this.options.waitUntilMaxWaitMs??Wxd,i=r>=n;if(this._waitUntilCycle.timer!==void 0&&clearTimeout(this._waitUntilCycle.timer),i)return void this.resolveWaitUntilFlush();let o=this.options.waitUntilDebounceMs??Gxd;this._waitUntilCycle.timer=Ale(()=>{this.resolveWaitUntilFlush()},o)}_consumeWaitUntilCycle(){let t=this._waitUntilCycle;return t&&(clearTimeout(t.timer),this._waitUntilCycle=void 0),t?.resolve}async resolveWaitUntilFlush(){let t=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{t?.()}}getPersistedProperty(t){return this._memoryStorage.getProperty(t)}setPersistedProperty(t,r){return this._memoryStorage.setProperty(t,r)}fetch(t,r){return this.options.fetch?this.options.fetch(t,r):fetch(t,r)}getLibraryVersion(){return Wwc}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStateless(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStatelessImmediate(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStateless(t,l,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStatelessImmediate(t,l,{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=exc){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",o=>{clearTimeout(n),i(),r(o>0)})})}_resolveDistinctId(t,r){return typeof t=="string"?{distinctId:t,options:r}:{distinctId:this.context?.get()?.distinctId,options:t}}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let B=this._flagOverrides[t];if(B===void 0)return;let O=this._payloadOverrides?.[t];return{key:t,enabled:B!==!1,variant:typeof B=="string"?B:void 0,payload:O}}let{groups:s,disableGeoip:a}=n,{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=n,p=this.addLocalPersonAndGroupProperties(r,s,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(r,s,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f,m=!1,h,A,b,v,w,C;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let B=this.featureFlagsPoller?.featureFlagsByKey[t];if(B)try{let O=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(B,d,{matchValue:i});if(O){m=!0;let F=O.value;v=B.id,C="Evaluated locally",f={key:t,enabled:F!==!1,variant:typeof F=="string"?F:void 0,payload:O.payload??void 0}}}catch(O){if(O instanceof EX||O instanceof vd)this._logger?.info(`${O.name} when computing flag locally: ${t}: ${O.message}`);else throw O}}if(!m&&!c){let B=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,a,[t]);if(B===void 0)b=k6t.UNKNOWN_ERROR;else{h=B.requestId,A=B.evaluatedAt;let O=[];B.errorsWhileComputingFlags&&O.push(k6t.ERRORS_WHILE_COMPUTING),B.quotaLimited?.includes("feature_flags")&&O.push(k6t.QUOTA_LIMITED);let F=B.flags[t];if(F===void 0)O.push(k6t.FLAG_MISSING);else{v=F.metadata?.id,w=F.metadata?.version,C=F.reason?.description??F.reason?.code;let T;if(F.metadata?.payload!==void 0)try{T=JSON.parse(F.metadata.payload)}catch{T=F.metadata.payload}f={key:t,enabled:F.enabled,variant:F.variant,payload:T}}O.length>0&&(b=O.join(","))}}if(o){let B=f===void 0?void 0:f.enabled===!1?!1:f.variant??!0,O=`${t}_${B}`;if(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(O)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(O):this.distinctIdHasSentFlagCalls[r]=[O];let F={$feature_flag:t,$feature_flag_response:B,$feature_flag_id:v,$feature_flag_version:w,$feature_flag_reason:C,locally_evaluated:m,[`$feature/${t}`]:B,$feature_flag_request_id:h,$feature_flag_evaluated_at:m?Date.now():A};if(m&&this.featureFlagsPoller){let T=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();T!==void 0&&(F.$feature_flag_definitions_loaded_at=T)}b&&(F.$feature_flag_error=b),this.capture({distinctId:r,event:"$feature_flag_called",properties:F,groups:s,disableGeoip:a})}}return f!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(f={...f,payload:this._payloadOverrides[t]}),f}async getFeatureFlag(t,r,n){let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(i!==void 0)return i.enabled===!1?!1:i.variant??!0}async getFeatureFlagPayload(t,r,n,i){if(this._payloadOverrides!==void 0&&t in this._payloadOverrides)return this._payloadOverrides[t];let o=await this._getFeatureFlagResult(t,r,{...i,sendFeatureFlagEvents:!1},n);if(o!==void 0)return o.payload??null}async getFeatureFlagResult(t,r,n){let{distinctId:i,options:o}=this._resolveDistinctId(r,n);return i?this._getFeatureFlagResult(t,i,{...o,sendFeatureFlagEvents:o?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()")}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let n=await r.json();if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);return n?(await this.getAllFlagsAndPayloads(n,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),m={},h={},A=!0;if(f&&(m=f.response,h=f.payloads,A=f.fallbackToFlags),A&&!c){let b=await super.getFeatureFlagsAndPayloadsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);m={...m,...b.flags||{}},h={...h,...b.payloads||{}}}return this._flagOverrides!==void 0&&(m={...m,...this._flagOverrides}),this._payloadOverrides!==void 0&&(h={...h,...this._payloadOverrides}),{featureFlags:m,featureFlagPayloads:h}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:o}){super.groupIdentifyStateless(t,r,n,{disableGeoip:o},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(t){let r=n=>Object.fromEntries(n.map(i=>[i,!0]));if(t===!1){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(t)){this._flagOverrides=r(t);return}if(this._isFeatureFlagOverrideOptions(t)){"flags"in t&&(t.flags===!1?this._flagOverrides=void 0:Array.isArray(t.flags)?this._flagOverrides=r(t.flags):t.flags!==void 0&&(this._flagOverrides={...t.flags})),"payloads"in t&&(t.payloads===!1?this._payloadOverrides=void 0:t.payloads!==void 0&&(this._payloadOverrides={...t.payloads}));return}this._flagOverrides={...t}}_isFeatureFlagOverrideOptions(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let r=t;if("flags"in r){let n=r.flags;if(n===!1||Array.isArray(n)||typeof n=="object"&&n!==null)return!0}if("payloads"in r){let n=r.payloads;if(n===!1||typeof n=="object"&&n!==null)return!0}return!1}withContext(t,r,n){return this.context?this.context.run(t,r,n):r()}getContext(){return this.context?.get()}enterContext(t,r){this.context?.enter(t,r)}async _shutdown(t){let r=this._consumeWaitUntilCycle();await this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown();try{return await super._shutdown(t)}finally{r?.()}}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let o=new AbortController;i=Ale(()=>{o.abort()},this.options.requestTimeout),n.signal=o.signal}try{return await this.fetch(r,n)}catch(o){this._events.emit("error",o);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let n={},i={};for(let[o,s]of Object.entries(t))if(cwc(s)&&r&&o in r){let a={};for(let[c,u]of Object.entries(s))a[String(c)]=String(u);i[String(o)]=a}else n[String(o)]=String(s);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},s=i?.groupProperties||{},a=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}return(await super.getFeatureFlagsStateless(t,r,o,s,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},s={};if(r)for(let a of Object.keys(r))s[a]={$group_key:r[a],...i?.[a]||{}};return{allPersonProperties:o,allGroupProperties:s}}createFeatureFlagEvaluationContext(t,r,n,i){return{distinctId:t,groups:r||{},personProperties:n||{},groupProperties:i||{},evaluationCache:{}}}captureException(t,r,n,i){if(!y9.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");this.addPendingPromise(y9.buildEventMessage(t,{syntheticException:o},r,n).then(s=>this.capture({...s,uuid:i})))}}async captureExceptionImmediate(t,r,n){if(!y9.isPreviouslyCapturedError(t)){let i=new Error("PostHog syntheticException");return this.addPendingPromise(y9.buildEventMessage(t,{syntheticException:i},r,n).then(o=>this.captureImmediate(o)))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:c,uuid:u}=t,l=this.context?.get(),p=r||l?.distinctId,d={...this.props,...l?.properties||{},...i||{}};p||(p=UEe(),d.$process_person_profile=!1),l?.sessionId&&!d.$session_id&&(d.$session_id=l.sessionId);let f=this._runBeforeSend({distinctId:p,event:n,properties:d,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:c,uuid:u});if(!f)return Promise.reject(null);let m=await Promise.resolve().then(async()=>{if(s){let h=typeof s=="object"?s:void 0;return await this.getFeatureFlagsForEvent(f.distinctId,o,c,h)}return f.event,{}}).then(h=>{let A={};if(h)for(let[v,w]of Object.entries(h))A[`$feature/${v}`]=w;let b=Object.keys(h||{}).filter(v=>h?.[v]!==!1).sort();return b.length>0&&(A.$active_feature_flags=b),A}).catch(()=>({})).then(h=>({...h,...f.properties||{},$groups:f.groups||o}));return f.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof m.$raw_user_agent=="string"&&nwc(m.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(f.event="$bot_pageview",m.$browser_type="bot"),{distinctId:f.distinctId,event:f.event,properties:m,options:{timestamp:f.timestamp,disableGeoip:f.disableGeoip,uuid:f.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let n=Array.isArray(r)?r:[r],i=t;for(let o of n){if(i=o(i),!i)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!i.properties||Object.keys(i.properties).length===0){let s=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(s)}}return i}};var txc=require("async_hooks"),tUr=class{constructor(){this.storage=new txc.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){return this.storage.run(this.resolve(t,n),r)}enter(t,r){this.storage.enterWith(this.resolve(t,r))}resolve(t,r){if(r?.fresh===!0)return t;let n=this.get()||{};return{distinctId:t.distinctId??n.distinctId,sessionId:t.sessionId??n.sessionId,properties:{...n.properties||{},...t.properties||{}}}}};var rxc="posthog-node";function $xd(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return s=>{if(!(i==="*"||i.includes(s.level)))return s;s.tags||(s.tags={});let c=s.tags[Lmo.POSTHOG_ID_TAG];if(c===void 0)return s;let u=e.options.host??"https://us.i.posthog.com",l=new URL(`/project/${e.apiKey}/person/${c}`,u).toString();s.tags["PostHog Person URL"]=l;let p=s.exception?.values||[],d=p.map(m=>({...m,stacktrace:m.stacktrace?{...m.stacktrace,type:"raw",frames:(m.stacktrace.frames||[]).map(h=>({...h,platform:"node:javascript"}))}:void 0})),f={$exception_message:p[0]?.value||s.message,$exception_type:p[0]?.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:p[0]?.value||s.message,$sentry_exception_type:p[0]?.type,$sentry_tags:s.tags};return t&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+s.event_id),o&&e.capture({event:"$exception",distinctId:c,properties:f}),s}}var Lmo=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=rxc,this.name=rxc,this.setupOnce=function(s,a){let c=a()?.getClient()?.getDsn()?.projectId;s($xd(t,{organization:r,projectId:c,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};y9.errorPropertiesBuilder=new tQ.ErrorPropertiesBuilder([new tQ.EventCoercer,new tQ.ErrorCoercer,new tQ.ObjectCoercer,new tQ.StringCoercer,new tQ.PrimitiveCoercer],tQ.createStackParser("node:javascript",tQ.nodeStackLineParser),[XCc(),Uwc]);var zEe=class extends eUr{getLibraryId(){return"posthog-node"}initializeContext(){return new tUr}};var rUr=class{posthog;constructor({posthogApiKey:t}){this.posthog=new zEe(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"5.3.0",usingAccessToken:!0}})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}};var N6t=class{async sendEvent(){}async identify(){}async flush(){}};Xt();var xtt=require("fs/promises"),nxc=require("os"),ixc=require("path");var Hxd="id",Kxd=".fern",Q6t=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new zEe(r),this.userId=t==null?void 0:nco(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"5.3.0",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await Cf({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ye(Ht.of((0,nxc.homedir)()),De.of(Kxd),De.of(Hxd));await ar(t)||(await(0,xtt.mkdir)((0,ixc.dirname)(t),{recursive:!0}),await(0,xtt.writeFile)(t,XO())),this.persistedDistinctId=(await(0,xtt.readFile)(t)).toString()}return this.persistedDistinctId}};var Umo;async function j6t(){return Umo==null&&(Umo=await Jxd()),Umo}async function Jxd(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new N6t;let r=await dQr();return r!=null?new Q6t({token:r,posthogApiKey:e}):await rX()!=null?new rUr({posthogApiKey:e}):new Q6t({token:void 0,posthogApiKey:e})}catch{return new N6t}}jt();var M6t=we(require("process"),1);X5e();var axc=we(nZi(),1),cxc=we(sxc(),1);function b_(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=tG(e),e.length===0))return 0;e=e.replace((0,cxc.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let o=i.codePointAt(0);if(o<=31||o>=127&&o<=159||o>=768&&o<=879)continue;switch(axc.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function nUr(e){let t=0;for(let r of e.split(`
|
|
2690
|
+
`);for(let s=n;s<o.length;s++){let a=o[s];if(a.length>1024)continue;let c=Pwc.test(a)?a.replace(Pwc,"$1"):a;if(!c.match(/\S*Error: /)){for(let u of t){let l=u(c,e);if(l){i.push(l);break}}if(i.length>=Dwc)break}}return Rwc(i)}}var Omo=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=P6t(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:n?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return Tje(t,"DOMException")}isDOMError(t){return Tje(t,"DOMError")}};var Pmo=class{match(t){return bmo(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let n=t.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(t){return t.stacktrace||t.stack||void 0}};var Dmo=class{constructor(){}match(t){return awc(t)&&t.error!=null}coerce(t,r){let n=r.apply(t.error);return n||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var Ixd=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Rmo=class{match(t){return typeof t=="string"}coerce(t,r){let[n,i]=this.getInfos(t);return{type:n??"Error",value:i??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",n=t,i=t.match(Ixd);return i&&(r=i[1],n=i[2]),[r,n]}};var kwc=["fatal","error","warning","log","info","debug"];function J3r(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){let i=r.slice(0,n).join(", ");if(!(i.length>t))return n===r.length||i.length<=t?i:`${i.slice(0,t)}...`}return""}var Fmo=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let n=this.getErrorPropertyFromObject(t);return n?r.apply(n):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Ett(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let i=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(i+=` with message: '${t.message}'`),i}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),n=J3r(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return P6t(t)&&!owc(t)&&kwc.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(Iwc(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var kmo=class{match(t){return Ett(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${J3r(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var Nmo=class{match(t){return j3r(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var Qmo=class{match(t){return Tje(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ett(t))return!1;try{let r=t.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return j3r(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var jmo=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}};var jwc=require("fs"),Mwc=require("readline"),Y3r=new tQ.ReduceableCache(25),Lwc=new tQ.ReduceableCache(20),Mmo=7,vxd=1e3,Cxd=1e4;async function Uwc(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],s=o?.filename;if(!o||typeof s!="string"||typeof o.lineno!="number"||_xd(s)||Bxd(o))continue;t[s]||(t[s]=[]),t[s].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(Lwc.get(i))continue;let o=t[i];if(!o)continue;o.sort((c,u)=>c-u);let s=Oxd(o);if(s.every(c=>Txd(i,c)))continue;let a=Pxd(Y3r,i,{});n.push(wxd(i,s,a))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&xxd(e,Y3r),Y3r.reduce(),e}function wxd(e,t,r){return new Promise(n=>{let i=(0,jwc.createReadStream)(e),o=(0,Mwc.createInterface)({input:i});function s(){i.destroy(),n()}let a=0,c=0,u=t[c];if(u===void 0)return void s();let l=u[0],p=u[1];function d(){Lwc.set(e,1),o.close(),o.removeAllListeners(),s()}i.on("error",d),o.on("error",d),o.on("close",s),o.on("line",f=>{if(a++,!(a<l)&&(r[a]=Dxd(f,0),a>=p)){if(c===t.length-1){o.close(),o.removeAllListeners();return}c++;let m=t[c];if(m===void 0){o.close(),o.removeAllListeners();return}l=m[0],p=m[1]}})})}function xxd(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;Sxd(r.lineno,r,n)}}function Sxd(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=zwc(e);i<e;i++){let o=r[i];if(o===void 0)return void Nwc(t);t.pre_context.push(o)}if(r[e]===void 0)return void Nwc(t);t.context_line=r[e];let n=Vwc(e);t.post_context=[];for(let i=e+1;i<=n;i++){let o=r[i];if(o===void 0)break;t.post_context.push(o)}}function Nwc(e){delete e.pre_context,delete e.context_line,delete e.post_context}function _xd(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function Bxd(e){return e.lineno!==void 0&&e.lineno>Cxd||e.colno!==void 0&&e.colno>vxd}function Txd(e,t){let r=Y3r.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function Oxd(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=Qwc(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let o=e[t+1];if(typeof o!="number")break;o<=n[1]?n[1]=o+Mmo:(i.push(n),n=Qwc(o)),t++}return i}function Qwc(e){return[zwc(e),Vwc(e)]}function zwc(e){return Math.max(1,e-Mmo)}function Vwc(e){return e+Mmo}function Pxd(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function Dxd(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,n);return o>n-5&&(o=n),o===n&&(i=Math.max(o-140,0)),r=r.slice(i,o),i>0&&(r=`...${r}`),o<n&&(r+="..."),r}function Rxd(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(s=>s.name!=="domainUncaughtExceptionClear"&&s._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function qwc(e,t){globalThis.process?.on("uncaughtException",Rxd(e,t))}function Gwc(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var Fxd=2e3,y9=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new M3r({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return ymo(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i},s=this.errorPropertiesBuilder.buildFromUnknown(t,r);return s.$exception_list=await this.errorPropertiesBuilder.modifyFrames(s.$exception_list),{event:"$exception",distinctId:n,properties:{...s,...o},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){this.isEnabled()&&(qwc(this.onException.bind(this),this.onFatalError.bind(this)),Gwc(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{if(!e.isPreviouslyCapturedError(t)){let n=await e.buildEventMessage(t,r),o=n.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(o)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:o}):this.client.capture(n)}})())}async onFatalError(t){console.error(t),await this.client.shutdown(Fxd),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var Wwc="5.29.1";var k6t={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function $wc(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}var kxd=6e4,Nxd=1152921504606847e3,Qxd=["is_not"],wtt=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},vd=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},EX=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},X3r=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:s,...a}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=o,this.poller=void 0,this.fetch=a.fetch||fetch,this.onError=a.onError,this.customHeaders=s,this.onLoad=a.onLoad,this.cacheProvider=a.cacheProvider,this.strictLocalEvaluation=a.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}createEvaluationContext(t,r={},n={},i={},o={}){return{distinctId:t,groups:r,personProperties:n,groupProperties:i,evaluationCache:o}}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let s,a;if(!this.loadedSuccessfullyOnce)return s;if(a=this.featureFlagsByKey[t],a!==void 0){let c=this.createEvaluationContext(r,n,i,o);try{s=(await this.computeFlagAndPayloadLocally(a,c)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${s}`))}catch(u){u instanceof EX||u instanceof vd?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${t}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${u}`))}}return s}async getAllFlagsAndPayloads(t,r){await this.loadFeatureFlags();let n={},i={},o=this.featureFlags.length==0,s=r?r.map(c=>this.featureFlagsByKey[c]).filter(Boolean):this.featureFlags,a={...t,evaluationCache:t.evaluationCache??{}};return await Promise.all(s.map(async c=>{try{let{value:u,payload:l}=await this.computeFlagAndPayloadLocally(c,a);n[c.key]=u,l&&(i[c.key]=l)}catch(u){u instanceof EX||u instanceof vd?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${c.key}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${c.key}: ${u}`)),o=!0}})),{response:n,payloads:i,fallbackToFlags:o}}async computeFlagAndPayloadLocally(t,r,n={}){let{matchValue:i,skipLoadCheck:o=!1}=n;if(o||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=i!==void 0?i:await this.computeFlagValueLocally(t,r);let a=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:a}}async computeFlagValueLocally(t,r){let{distinctId:n,groups:i,personProperties:o,groupProperties:s}=r;if(t.ensure_experience_continuity)throw new vd("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let u=this.groupTypeMapping[String(c)];if(!u)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new vd("Flag has unknown group type index");if(!(u in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;t.bucketing_identifier==="device_id"&&(o?.$device_id===void 0||o?.$device_id===null||o?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${t.key}`));let l=s[u];return await this.matchFeatureFlagProperties(t,i[u],l,r)}{let u=this.getBucketingValueForFlag(t,n,o);if(u===void 0)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${t.key} without $device_id, falling back to server evaluation`)),new vd(`Can't compute feature flag: ${t.key} without $device_id`);return await this.matchFeatureFlagProperties(t,u,o,r)}}getBucketingValueForFlag(t,r,n){if(t.filters?.aggregation_group_type_index!=null)return r;if(t.bucketing_identifier==="device_id"){let i=n?.$device_id;return i==null||i===""?void 0:i}return r}getFeatureFlagPayload(t,r){let n=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),n!=null)){if(typeof n=="object")return n;if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}return null}async evaluateFlagDependency(t,r,n){let{evaluationCache:i}=n,o=t.key;if(!this.featureFlagsByKey)throw new vd("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new vd(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let s=t.dependency_chain;if(!Array.isArray(s))throw new vd(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof s})`);if(s.length===0)throw new vd(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let c of s){if(!(c in i)){let l=this.featureFlagsByKey[c];if(l)if(l.active)try{let p=await this.computeFlagValueLocally(l,n);i[c]=p}catch(p){throw new vd(`Error evaluating flag dependency '${c}' for flag '${o}': ${p}`)}else i[c]=!1;else throw new vd(`Missing flag dependency '${c}' for flag '${o}'`)}if(i[c]==null)throw new vd(`Dependency '${c}' could not be evaluated`)}let a=i[o];return this.flagEvaluatesToExpectedValue(t.value,a)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,n,i){let o=t.filters||{},s=o.groups||[],a=!1,c;for(let u of s)try{if(await this.isConditionMatch(t,r,u,n,i)){let l=u.variant,p=o.multivariate?.variants||[];c=l&&p.some(d=>d.key===l)?l:await this.getMatchingVariant(t,r)||!0;break}}catch(l){if(l instanceof EX)throw l;if(l instanceof vd)a=!0;else throw l}if(c!==void 0)return c;if(a)throw new vd("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o){let s=n.rollout_percentage,a=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let u=c.type,l=!1;if(l=u==="cohort"?Xwc(c,i,this.cohorts,this.debugMode):u==="flag"?await this.evaluateFlagDependency(c,i,o):Ywc(c,i,a),!l)return!1}if(s==null)return!0}return!(s!=null&&await Hwc(t.key,r)>s/100)}async getMatchingVariant(t,r){let n=await Hwc(t.key,r,"variant"),i=this.variantLookupTable(t).find(o=>n>=o.valueMin&&n<o.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(a=>{i=n+a.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:a.key}),n=i}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,n)=>(r[n.key]=n,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(t){if(this.strictLocalEvaluation)return;let r=t.filter(n=>n.ensure_experience_continuity);r.length>0&&console.warn(`[PostHog] You are using local evaluation but ${r.length} flag(s) have experience continuity enabled: ${r.map(n=>n.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(r.flags),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return!t&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(kxd,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(n){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${n}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new wtt(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new wtt(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new wtt(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let n=await r.json()??{};if(!("flags"in n))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let i={flags:n.flags??[],groupTypeMapping:n.group_type_mapping||{},cohorts:n.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(o){this.onError?.(new Error(`Failed to store in cache: ${o}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(t){t instanceof wtt&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let n={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(n["If-None-Match"]=r),{method:t,headers:n}}_requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=Ale(()=>{i.abort()},this.timeout),r.signal=i.signal}try{let i=this.fetch;return i(t,r)}finally{clearTimeout(n)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((n,i)=>setTimeout(()=>i(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function Hwc(e,t,r=""){let n=await $wc(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/Nxd}function Ywc(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")throw new vd("Operator is_not_set is not supported")}else throw new vd(`Property ${n} not found in propertyValues`);let s=t[n];if(s==null&&!Qxd.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function a(u,l){return Array.isArray(u)?u.map(p=>String(p).toLowerCase()).includes(String(l).toLowerCase()):String(u).toLowerCase()===String(l).toLowerCase()}function c(u,l,p){if(p==="gt")return u>l;if(p==="gte")return u>=l;if(p==="lt")return u<l;if(p==="lte")return u<=l;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return a(i,s);case"is_not":return!a(i,s);case"is_set":return n in t;case"icontains":return String(s).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(s).toLowerCase().includes(String(i).toLowerCase());case"regex":return Kwc(String(i))&&String(s).match(String(i))!==null;case"not_regex":return Kwc(String(i))&&String(s).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let u=typeof i=="number"?i:null;if(typeof i=="string")try{u=parseFloat(i)}catch{}return u==null||s==null?c(String(s),String(i),o):typeof s=="string"?c(s,String(i),o):c(s,u,o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new vd("Date operations cannot be performed on boolean values");let u=zxd(String(i));if(u==null&&(u=Jwc(i)),u==null)throw new vd(`Invalid date: ${i}`);let l=Jwc(s);return["is_date_before"].includes(o)?l<u:l>u}case"semver_eq":return fz(YB(String(s)),YB(String(i)))===0;case"semver_neq":return fz(YB(String(s)),YB(String(i)))!==0;case"semver_gt":return fz(YB(String(s)),YB(String(i)))>0;case"semver_gte":return fz(YB(String(s)),YB(String(i)))>=0;case"semver_lt":return fz(YB(String(s)),YB(String(i)))<0;case"semver_lte":return fz(YB(String(s)),YB(String(i)))<=0;case"semver_tilde":{let u=YB(String(s)),{lower:l,upper:p}=Mxd(String(i));return fz(u,l)>=0&&fz(u,p)<0}case"semver_caret":{let u=YB(String(s)),{lower:l,upper:p}=Lxd(String(i));return fz(u,l)>=0&&fz(u,p)<0}case"semver_wildcard":{let u=YB(String(s)),{lower:l,upper:p}=Uxd(String(i));return fz(u,l)>=0&&fz(u,p)<0}default:throw new vd(`Unknown operator: ${o}`)}}function jxd(e,t){if(!(e in t))throw new EX(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function Xwc(e,t,r,n=!1){let i=String(e.value);jxd(i,r);let o=r[i];return Zwc(o,t,r,n)}function Zwc(e,t,r,n=!1){if(!e)return!0;let i=e.type,o=e.values;if(!o||o.length===0)return!0;let s=!1;if("values"in o[0]){for(let a of o)try{let c=Zwc(a,t,r,n);if(i==="AND"){if(!c)return!1}else if(c)return!0}catch(c){if(c instanceof EX)throw c;if(c instanceof vd)n&&console.debug(`Failed to compute property ${a} locally: ${c}`),s=!0;else throw c}if(s)throw new vd("Can't match cohort without a given cohort property value");return i==="AND"}for(let a of o)try{let c;if(a.type==="cohort")c=Xwc(a,t,r,n);else if(a.type==="flag"){n&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${a.key||"unknown"}'`);continue}else c=Ywc(a,t);let u=a.negation||!1;if(i==="AND"){if(!c&&!u||c&&u)return!1}else if(c&&!u||!c&&u)return!0}catch(c){if(c instanceof EX)throw c;if(c instanceof vd)n&&console.debug(`Failed to compute property ${a} locally: ${c}`),s=!0;else throw c}if(s)throw new vd("can't match cohort without a given cohort property value");return i==="AND"}function Kwc(e){try{return new RegExp(e),!0}catch{return!1}}function YB(e){let r=String(e).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!r||r.startsWith("."))throw new vd(`Invalid semver: ${e}`);let n=r.split("."),i=c=>{if(c===void 0||c==="")return 0;if(!/^\d+$/.test(c))throw new vd(`Invalid semver: ${e}`);return parseInt(c,10)},o=i(n[0]),s=i(n[1]),a=i(n[2]);return[o,s,a]}function fz(e,t){for(let r=0;r<3;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0}function Mxd(e){let t=YB(e),r=[t[0],t[1],t[2]],n=[t[0],t[1]+1,0];return{lower:r,upper:n}}function Lxd(e){let t=YB(e),[r,n,i]=t,o=[r,n,i],s;return s=r>0?[r+1,0,0]:n>0?[0,n+1,0]:[0,0,i+1],{lower:o,upper:s}}function Uxd(e){let r=String(e).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!r)throw new vd(`Invalid wildcard semver: ${e}`);let n=r.split("."),i=parseInt(n[0],10);if(isNaN(i))throw new vd(`Invalid wildcard semver: ${e}`);let o,s;if(n.length===1)o=[i,0,0],s=[i+1,0,0];else{let a=parseInt(n[1],10);if(isNaN(a))throw new vd(`Invalid wildcard semver: ${e}`);o=[i,a,0],s=[i,a+1,0]}return{lower:o,upper:s}}function Jwc(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new vd(`${e} is in an invalid date format`)}throw new vd(`The date provided ${e} must be a string, number, or date object`)}function zxd(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(!r)return null;{if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let o=r.groups.interval;if(o=="h")n.setUTCHours(n.getUTCHours()-i);else if(o=="d")n.setUTCDate(n.getUTCDate()-i);else if(o=="w")n.setUTCDate(n.getUTCDate()-7*i);else if(o=="m")n.setUTCMonth(n.getUTCMonth()-i);else{if(o!="y")return null;n.setUTCFullYear(n.getUTCFullYear()-i)}return n}}var Z3r=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var Vxd=100,exc=3e4,qxd=5e4,Gxd=50,Wxd=500,eUr=class extends F6t{constructor(t,r={}){if(super(t,r),this._memoryStorage=new Z3r,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,Vxd):exc,typeof r.waitUntilDebounceMs=="number"&&(this.options.waitUntilDebounceMs=Math.max(r.waitUntilDebounceMs,0)),typeof r.waitUntilMaxWaitMs=="number"&&(this.options.waitUntilMaxWaitMs=Math.max(r.waitUntilMaxWaitMs,0)),r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new X3r({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider,strictLocalEvaluation:r.strictLocalEvaluation}))}this.errorTracking=new y9(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||qxd}enqueue(t,r,n){super.enqueue(t,r,n),this.scheduleDebouncedFlush()}async flush(){let t=super.flush(),r=this.options.waitUntil;if(r&&!this._waitUntilCycle)try{r(t.catch(()=>{}))}catch{}return t}scheduleDebouncedFlush(){let t=this.options.waitUntil;if(!t||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let s,a=new Promise(c=>{s=c});try{t(a)}catch{return}this._waitUntilCycle={resolve:s,startedAt:Date.now(),timer:void 0}}let r=Date.now()-this._waitUntilCycle.startedAt,n=this.options.waitUntilMaxWaitMs??Wxd,i=r>=n;if(this._waitUntilCycle.timer!==void 0&&clearTimeout(this._waitUntilCycle.timer),i)return void this.resolveWaitUntilFlush();let o=this.options.waitUntilDebounceMs??Gxd;this._waitUntilCycle.timer=Ale(()=>{this.resolveWaitUntilFlush()},o)}_consumeWaitUntilCycle(){let t=this._waitUntilCycle;return t&&(clearTimeout(t.timer),this._waitUntilCycle=void 0),t?.resolve}async resolveWaitUntilFlush(){let t=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{t?.()}}getPersistedProperty(t){return this._memoryStorage.getProperty(t)}setPersistedProperty(t,r){return this._memoryStorage.setProperty(t,r)}fetch(t,r){return this.options.fetch?this.options.fetch(t,r):fetch(t,r)}getLibraryVersion(){return Wwc}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStateless(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStatelessImmediate(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStateless(t,l,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStatelessImmediate(t,l,{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=exc){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",o=>{clearTimeout(n),i(),r(o>0)})})}_resolveDistinctId(t,r){return typeof t=="string"?{distinctId:t,options:r}:{distinctId:this.context?.get()?.distinctId,options:t}}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let B=this._flagOverrides[t];if(B===void 0)return;let O=this._payloadOverrides?.[t];return{key:t,enabled:B!==!1,variant:typeof B=="string"?B:void 0,payload:O}}let{groups:s,disableGeoip:a}=n,{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=n,p=this.addLocalPersonAndGroupProperties(r,s,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(r,s,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f,m=!1,h,A,b,v,w,C;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let B=this.featureFlagsPoller?.featureFlagsByKey[t];if(B)try{let O=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(B,d,{matchValue:i});if(O){m=!0;let F=O.value;v=B.id,C="Evaluated locally",f={key:t,enabled:F!==!1,variant:typeof F=="string"?F:void 0,payload:O.payload??void 0}}}catch(O){if(O instanceof EX||O instanceof vd)this._logger?.info(`${O.name} when computing flag locally: ${t}: ${O.message}`);else throw O}}if(!m&&!c){let B=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,a,[t]);if(B===void 0)b=k6t.UNKNOWN_ERROR;else{h=B.requestId,A=B.evaluatedAt;let O=[];B.errorsWhileComputingFlags&&O.push(k6t.ERRORS_WHILE_COMPUTING),B.quotaLimited?.includes("feature_flags")&&O.push(k6t.QUOTA_LIMITED);let F=B.flags[t];if(F===void 0)O.push(k6t.FLAG_MISSING);else{v=F.metadata?.id,w=F.metadata?.version,C=F.reason?.description??F.reason?.code;let T;if(F.metadata?.payload!==void 0)try{T=JSON.parse(F.metadata.payload)}catch{T=F.metadata.payload}f={key:t,enabled:F.enabled,variant:F.variant,payload:T}}O.length>0&&(b=O.join(","))}}if(o){let B=f===void 0?void 0:f.enabled===!1?!1:f.variant??!0,O=`${t}_${B}`;if(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(O)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(O):this.distinctIdHasSentFlagCalls[r]=[O];let F={$feature_flag:t,$feature_flag_response:B,$feature_flag_id:v,$feature_flag_version:w,$feature_flag_reason:C,locally_evaluated:m,[`$feature/${t}`]:B,$feature_flag_request_id:h,$feature_flag_evaluated_at:m?Date.now():A};if(m&&this.featureFlagsPoller){let T=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();T!==void 0&&(F.$feature_flag_definitions_loaded_at=T)}b&&(F.$feature_flag_error=b),this.capture({distinctId:r,event:"$feature_flag_called",properties:F,groups:s,disableGeoip:a})}}return f!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(f={...f,payload:this._payloadOverrides[t]}),f}async getFeatureFlag(t,r,n){let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(i!==void 0)return i.enabled===!1?!1:i.variant??!0}async getFeatureFlagPayload(t,r,n,i){if(this._payloadOverrides!==void 0&&t in this._payloadOverrides)return this._payloadOverrides[t];let o=await this._getFeatureFlagResult(t,r,{...i,sendFeatureFlagEvents:!1},n);if(o!==void 0)return o.payload??null}async getFeatureFlagResult(t,r,n){let{distinctId:i,options:o}=this._resolveDistinctId(r,n);return i?this._getFeatureFlagResult(t,i,{...o,sendFeatureFlagEvents:o?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()")}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let n=await r.json();if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);return n?(await this.getAllFlagsAndPayloads(n,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),m={},h={},A=!0;if(f&&(m=f.response,h=f.payloads,A=f.fallbackToFlags),A&&!c){let b=await super.getFeatureFlagsAndPayloadsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);m={...m,...b.flags||{}},h={...h,...b.payloads||{}}}return this._flagOverrides!==void 0&&(m={...m,...this._flagOverrides}),this._payloadOverrides!==void 0&&(h={...h,...this._payloadOverrides}),{featureFlags:m,featureFlagPayloads:h}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:o}){super.groupIdentifyStateless(t,r,n,{disableGeoip:o},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(t){let r=n=>Object.fromEntries(n.map(i=>[i,!0]));if(t===!1){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(t)){this._flagOverrides=r(t);return}if(this._isFeatureFlagOverrideOptions(t)){"flags"in t&&(t.flags===!1?this._flagOverrides=void 0:Array.isArray(t.flags)?this._flagOverrides=r(t.flags):t.flags!==void 0&&(this._flagOverrides={...t.flags})),"payloads"in t&&(t.payloads===!1?this._payloadOverrides=void 0:t.payloads!==void 0&&(this._payloadOverrides={...t.payloads}));return}this._flagOverrides={...t}}_isFeatureFlagOverrideOptions(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let r=t;if("flags"in r){let n=r.flags;if(n===!1||Array.isArray(n)||typeof n=="object"&&n!==null)return!0}if("payloads"in r){let n=r.payloads;if(n===!1||typeof n=="object"&&n!==null)return!0}return!1}withContext(t,r,n){return this.context?this.context.run(t,r,n):r()}getContext(){return this.context?.get()}enterContext(t,r){this.context?.enter(t,r)}async _shutdown(t){let r=this._consumeWaitUntilCycle();await this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown();try{return await super._shutdown(t)}finally{r?.()}}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let o=new AbortController;i=Ale(()=>{o.abort()},this.options.requestTimeout),n.signal=o.signal}try{return await this.fetch(r,n)}catch(o){this._events.emit("error",o);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let n={},i={};for(let[o,s]of Object.entries(t))if(cwc(s)&&r&&o in r){let a={};for(let[c,u]of Object.entries(s))a[String(c)]=String(u);i[String(o)]=a}else n[String(o)]=String(s);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},s=i?.groupProperties||{},a=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}return(await super.getFeatureFlagsStateless(t,r,o,s,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},s={};if(r)for(let a of Object.keys(r))s[a]={$group_key:r[a],...i?.[a]||{}};return{allPersonProperties:o,allGroupProperties:s}}createFeatureFlagEvaluationContext(t,r,n,i){return{distinctId:t,groups:r||{},personProperties:n||{},groupProperties:i||{},evaluationCache:{}}}captureException(t,r,n,i){if(!y9.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");this.addPendingPromise(y9.buildEventMessage(t,{syntheticException:o},r,n).then(s=>this.capture({...s,uuid:i})))}}async captureExceptionImmediate(t,r,n){if(!y9.isPreviouslyCapturedError(t)){let i=new Error("PostHog syntheticException");return this.addPendingPromise(y9.buildEventMessage(t,{syntheticException:i},r,n).then(o=>this.captureImmediate(o)))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:c,uuid:u}=t,l=this.context?.get(),p=r||l?.distinctId,d={...this.props,...l?.properties||{},...i||{}};p||(p=UEe(),d.$process_person_profile=!1),l?.sessionId&&!d.$session_id&&(d.$session_id=l.sessionId);let f=this._runBeforeSend({distinctId:p,event:n,properties:d,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:c,uuid:u});if(!f)return Promise.reject(null);let m=await Promise.resolve().then(async()=>{if(s){let h=typeof s=="object"?s:void 0;return await this.getFeatureFlagsForEvent(f.distinctId,o,c,h)}return f.event,{}}).then(h=>{let A={};if(h)for(let[v,w]of Object.entries(h))A[`$feature/${v}`]=w;let b=Object.keys(h||{}).filter(v=>h?.[v]!==!1).sort();return b.length>0&&(A.$active_feature_flags=b),A}).catch(()=>({})).then(h=>({...h,...f.properties||{},$groups:f.groups||o}));return f.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof m.$raw_user_agent=="string"&&nwc(m.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(f.event="$bot_pageview",m.$browser_type="bot"),{distinctId:f.distinctId,event:f.event,properties:m,options:{timestamp:f.timestamp,disableGeoip:f.disableGeoip,uuid:f.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let n=Array.isArray(r)?r:[r],i=t;for(let o of n){if(i=o(i),!i)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!i.properties||Object.keys(i.properties).length===0){let s=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(s)}}return i}};var txc=require("async_hooks"),tUr=class{constructor(){this.storage=new txc.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){return this.storage.run(this.resolve(t,n),r)}enter(t,r){this.storage.enterWith(this.resolve(t,r))}resolve(t,r){if(r?.fresh===!0)return t;let n=this.get()||{};return{distinctId:t.distinctId??n.distinctId,sessionId:t.sessionId??n.sessionId,properties:{...n.properties||{},...t.properties||{}}}}};var rxc="posthog-node";function $xd(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return s=>{if(!(i==="*"||i.includes(s.level)))return s;s.tags||(s.tags={});let c=s.tags[Lmo.POSTHOG_ID_TAG];if(c===void 0)return s;let u=e.options.host??"https://us.i.posthog.com",l=new URL(`/project/${e.apiKey}/person/${c}`,u).toString();s.tags["PostHog Person URL"]=l;let p=s.exception?.values||[],d=p.map(m=>({...m,stacktrace:m.stacktrace?{...m.stacktrace,type:"raw",frames:(m.stacktrace.frames||[]).map(h=>({...h,platform:"node:javascript"}))}:void 0})),f={$exception_message:p[0]?.value||s.message,$exception_type:p[0]?.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:p[0]?.value||s.message,$sentry_exception_type:p[0]?.type,$sentry_tags:s.tags};return t&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+s.event_id),o&&e.capture({event:"$exception",distinctId:c,properties:f}),s}}var Lmo=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=rxc,this.name=rxc,this.setupOnce=function(s,a){let c=a()?.getClient()?.getDsn()?.projectId;s($xd(t,{organization:r,projectId:c,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};y9.errorPropertiesBuilder=new tQ.ErrorPropertiesBuilder([new tQ.EventCoercer,new tQ.ErrorCoercer,new tQ.ObjectCoercer,new tQ.StringCoercer,new tQ.PrimitiveCoercer],tQ.createStackParser("node:javascript",tQ.nodeStackLineParser),[XCc(),Uwc]);var zEe=class extends eUr{getLibraryId(){return"posthog-node"}initializeContext(){return new tUr}};var rUr=class{posthog;constructor({posthogApiKey:t}){this.posthog=new zEe(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"5.4.0",usingAccessToken:!0}})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}};var N6t=class{async sendEvent(){}async identify(){}async flush(){}};Xt();var xtt=require("fs/promises"),nxc=require("os"),ixc=require("path");var Hxd="id",Kxd=".fern",Q6t=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new zEe(r),this.userId=t==null?void 0:nco(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"5.4.0",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await Cf({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ye(Ht.of((0,nxc.homedir)()),De.of(Kxd),De.of(Hxd));await ar(t)||(await(0,xtt.mkdir)((0,ixc.dirname)(t),{recursive:!0}),await(0,xtt.writeFile)(t,XO())),this.persistedDistinctId=(await(0,xtt.readFile)(t)).toString()}return this.persistedDistinctId}};var Umo;async function j6t(){return Umo==null&&(Umo=await Jxd()),Umo}async function Jxd(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new N6t;let r=await dQr();return r!=null?new Q6t({token:r,posthogApiKey:e}):await rX()!=null?new rUr({posthogApiKey:e}):new Q6t({token:void 0,posthogApiKey:e})}catch{return new N6t}}jt();var M6t=we(require("process"),1);X5e();var axc=we(nZi(),1),cxc=we(sxc(),1);function b_(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=tG(e),e.length===0))return 0;e=e.replace((0,cxc.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let o=i.codePointAt(0);if(o<=31||o>=127&&o<=159||o>=768&&o<=879)continue;switch(axc.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function nUr(e){let t=0;for(let r of e.split(`
|
|
2691
2691
|
`))t=Math.max(t,b_(r));return t}var Bxc=we(Vmo(),1);var Xxd=/[\p{Lu}]/u,Zxd=/[\p{Ll}]/u,pxc=/^[\p{Lu}](?![\p{Lu}])/gu,mxc=/([\p{Alpha}\p{N}_]|$)/u,qmo=/[_.\- ]+/,eSd=new RegExp("^"+qmo.source),fxc=new RegExp(qmo.source+mxc.source,"gu"),dxc=new RegExp("\\d+"+mxc.source,"gu"),tSd=(e,t,r,n)=>{let i=!1,o=!1,s=!1,a=!1;for(let c=0;c<e.length;c++){let u=e[c];a=c>2?e[c-3]==="-":!0,i&&Xxd.test(u)?(e=e.slice(0,c)+"-"+e.slice(c),i=!1,s=o,o=!0,c++):o&&s&&Zxd.test(u)&&(!a||n)?(e=e.slice(0,c-1)+"-"+e.slice(c-1),s=o,o=!1,i=!0):(i=t(u)===u&&r(u)!==u,s=o,o=r(u)===u&&t(u)!==u)}return e},rSd=(e,t)=>(pxc.lastIndex=0,e.replace(pxc,r=>t(r))),nSd=(e,t)=>(fxc.lastIndex=0,dxc.lastIndex=0,e.replace(fxc,(r,n)=>t(n)).replace(dxc,r=>t(r)));function Gmo(e,t){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";let r=t.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(t.locale),n=t.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(t.locale);return e.length===1?qmo.test(e)?"":t.pascalCase?n(e):r(e):(e!==r(e)&&(e=tSd(e,r,n,t.preserveConsecutiveUppercase)),e=e.replace(eSd,""),e=t.preserveConsecutiveUppercase?rSd(e,r):r(e),t.pascalCase&&(e=n(e.charAt(0))+e.slice(1)),nSd(e,n))}var Kmo=we(gxc(),1);X5e();var Axc=(e=0)=>t=>`\x1B[${t+e}m`,yxc=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,bxc=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,yb={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},QRb=Object.keys(yb.modifier),aSd=Object.keys(yb.color),cSd=Object.keys(yb.bgColor),jRb=[...aSd,...cSd];function uSd(){let e=new Map;for(let[t,r]of Object.entries(yb)){for(let[n,i]of Object.entries(r))yb[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=yb[n],e.set(i[0],i[1]);Object.defineProperty(yb,t,{value:r,enumerable:!1})}return Object.defineProperty(yb,"codes",{value:e,enumerable:!1}),yb.color.close="\x1B[39m",yb.bgColor.close="\x1B[49m",yb.color.ansi=Axc(),yb.color.ansi256=yxc(),yb.color.ansi16m=bxc(),yb.bgColor.ansi=Axc(10),yb.bgColor.ansi256=yxc(10),yb.bgColor.ansi16m=bxc(10),Object.defineProperties(yb,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>yb.rgbToAnsi256(...yb.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>yb.ansi256ToAnsi(yb.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>yb.ansi256ToAnsi(yb.hexToAnsi256(t)),enumerable:!1}}),yb}var lSd=uSd(),Exc=lSd;var iUr=new Set(["\x1B","\x9B"]),pSd=39,$mo="\x07",Cxc="[",fSd="]",wxc="m",Hmo=`${fSd}8;;`,Ixc=e=>`${iUr.values().next().value}${Cxc}${e}${wxc}`,vxc=e=>`${iUr.values().next().value}${Hmo}${e}${$mo}`,dSd=e=>e.split(" ").map(t=>b_(t)),Wmo=(e,t,r)=>{let n=[...t],i=!1,o=!1,s=b_(tG(e[e.length-1]));for(let[a,c]of n.entries()){let u=b_(c);if(s+u<=r?e[e.length-1]+=c:(e.push(c),s=0),iUr.has(c)&&(i=!0,o=n.slice(a+1).join("").startsWith(Hmo)),i){o?c===$mo&&(i=!1,o=!1):c===wxc&&(i=!1);continue}s+=u,s===r&&a<n.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},mSd=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(b_(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},hSd=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",i,o,s=dSd(e),a=[""];for(let[u,l]of e.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let p=b_(a[a.length-1]);if(u!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),p=0),(p>0||r.trim===!1)&&(a[a.length-1]+=" ",p++)),r.hard&&s[u]>t){let d=t-p,f=1+Math.floor((s[u]-d-1)/t);Math.floor((s[u]-1)/t)<f&&a.push(""),Wmo(a,l,t);continue}if(p+s[u]>t&&p>0&&s[u]>0){if(r.wordWrap===!1&&p<t){Wmo(a,l,t);continue}a.push("")}if(p+s[u]>t&&r.wordWrap===!1){Wmo(a,l,t);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(u=>mSd(u)));let c=[...a.join(`
|
|
2692
2692
|
`)];for(let[u,l]of c.entries()){if(n+=l,iUr.has(l)){let{groups:d}=new RegExp(`(?:\\${Cxc}(?<code>\\d+)m|\\${Hmo}(?<uri>.*)${$mo})`).exec(c.slice(u).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===pSd?void 0:f}else d.uri!==void 0&&(o=d.uri.length===0?void 0:d.uri)}let p=Exc.codes.get(Number(i));c[u+1]===`
|
|
2693
2693
|
`?(o&&(n+=vxc("")),i&&p&&(n+=Ixc(p))):l===`
|
|
@@ -3239,7 +3239,7 @@ Hint: Values starting with "@" (such as scoped npm packages) must be wrapped in
|
|
|
3239
3239
|
`)}var CUt=class{cwd;logger;deleteOriginals;constructor(t){this.cwd=t.cwd,this.logger=t.logger,this.deleteOriginals=t.deleteOriginals??!0}async migrate(){let t=[],r=[],n=await this.findFernDirectory();if(n==null)return{success:!1,warnings:[{type:"conflict",message:"Could not find fern directory",suggestion:"Run this command from a directory containing a 'fern' folder"}],migratedFiles:r};let o=await new vUt({cwd:n}).migrate();if(t.push(...o.warnings),!o.success||o.org==null)return{success:!1,warnings:[...t,{type:"conflict",message:"Failed to migrate fern.config.json - organization is required"}],migratedFiles:r};o.absoluteFilePath!=null&&r.push(o.absoluteFilePath);let s=Ye(n,De.of(_R)),a=await ar(s,"directory"),c;if(a){let d=await this.migrateMultiApi({fernDir:n,apisDir:s,org:o.org,warnings:t,migratedFiles:r});if(!d.success)return{success:!1,warnings:t,migratedFiles:r};c=d.fernYml}else{let d=await this.migrateSingleApi({fernDir:n,org:o.org,warnings:t,migratedFiles:r});if(!d.success)return{success:!1,warnings:t,migratedFiles:r};c=d.fernYml}let u=await FTo(n);u.docsRef!=null&&(c.docs=u.docsRef);let l=Ye(this.cwd,De.of(jv)),p=this.serializeFernYml(c);if(await(0,eht.writeFile)(l,p,"utf-8"),this.deleteOriginals)for(let d of r)try{await(0,eht.rm)(d),this.logger.debug(`Deleted ${d}`)}catch{t.push({type:"info",message:`Could not delete ${d}`})}return this.logger.info(`Created ${l}`),t.push(...await kTo(this.cwd)),{success:!0,warnings:t,migratedFiles:r,outputPath:l}}async migrateSingleApi(t){let{fernDir:r,org:n,warnings:i,migratedFiles:o}=t,a=await new I6e({cwd:r}).migrate();i.push(...a.warnings),a.absoluteFilePath!=null&&o.push(a.absoluteFilePath);let c=await DTo({fernDir:r,generatorsYmlApi:a.rawApi});i.push(...c.warnings);let u={org:n};return c.api!=null&&(u.api=c.api),a.sdks!=null&&(u.sdks=a.sdks),{success:!0,fernYml:u}}async migrateMultiApi(t){let{fernDir:r,apisDir:n,org:i,warnings:o,migratedFiles:s}=t,c=(await(0,eht.readdir)(n,{withFileTypes:!0})).filter(A=>A.isDirectory()).map(A=>A.name);if(c.length===0)return o.push({type:"conflict",message:"No API directories found in fern/apis/"}),{success:!1,fernYml:{org:i}};let u={},l={targets:{}},p;for(let A of c){let b=Ye(n,De.of(A)),w=await new I6e({cwd:b,apiName:A}).migrate();if(o.push(...w.warnings),w.absoluteFilePath!=null&&s.push(w.absoluteFilePath),u[A]=w.rawApi,w.sdks!=null){for(let[C,x]of Object.entries(w.sdks.targets))l.targets[C]=x;w.sdks.autorelease!=null&&p==null&&(p=w.sdks.autorelease)}}let d=await RTo({fernDir:r,apisDir:n,generatorsYmlApis:u});o.push(...d.warnings);let f={org:i,apis:d.apis};Object.keys(l.targets).length>0&&(p!=null&&(l.autorelease=p),f.sdks=l);let h=await new I6e({cwd:r}).detect();return h.found&&h.absoluteFilePath!=null&&(o.push({type:"info",message:"Found generators.yml in fern root alongside apis/ directory",suggestion:"Review the migrated configuration to ensure it's correct"}),s.push(h.absoluteFilePath)),{success:!0,fernYml:f}}async findFernDirectory(){if(this.cwd.split("/").pop()===wA)return this.cwd;let r=Ye(this.cwd,De.of(wA));if(await ar(r,"directory"))return r}serializeFernYml(t){let r={edition:t.edition,org:t.org};return t.api!=null&&(r.api=t.api),t.apis!=null&&(r.apis=t.apis),t.ai!=null&&(r.ai=t.ai),t.cli!=null&&(r.cli=t.cli),t.docs!=null&&(r.docs=t.docs),t.sdks!=null&&(r.sdks=this.simplifySdks(t.sdks)),Sr.dump(r,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"',forceQuotes:!1})}simplifySdks(t){let r={...t},n={};for(let[i,o]of Object.entries(t.targets)){let s=o.output;if(typeof s=="string"){n[i]=o;continue}if(s.git==null&&s.path!=null){n[i]={...o,output:s.path};continue}n[i]=o}return r.targets=n,r}};var NTo=class{async handle(t,r){let i=await new CUt({cwd:t.cwd,logger:t.stdout,deleteOriginals:r.delete}).migrate();for(let o of i.warnings){switch(o.type){case"deprecated":t.stdout.warn(`Deprecated: ${o.message}`);break;case"unsupported":t.stdout.warn(`Unsupported: ${o.message}`);break;case"conflict":t.stderr.error(`Error: ${o.message}`);break;case"info":t.stdout.info(o.message);break}o.suggestion!=null&&t.stdout.info(` Suggestion: ${o.suggestion}`)}if(i.success){i.outputPath!=null&&t.stdout.debug(`Created: ${i.outputPath}`);return}throw new N({message:"Migration failed",code:N.Code.ConfigError})}};function QTo(e){let t=new NTo;vo(e,"migrate","Migrate legacy configuration files to fern.yml",(r,n)=>t.handle(r,n),r=>r.option("delete",{type:"boolean",description:"Keep original files after migration",default:!0}))}function jTo(e){YE(e,"config","Configure, edit, and inspect your settings",[QTo])}var MTo=class{async handle(t,r){let n=await t.loadWorkspaceOrThrow();if(n.docs==null)throw new N({message:`No docs configuration found in fern.yml.
|
|
3240
3240
|
|
|
3241
3241
|
Add a 'docs:' section to your fern.yml to get started.`,code:N.Code.ConfigError});let o=await new h1e({context:t}).check({workspace:n,strict:r.strict}),s=o.hasErrors||r.strict&&o.hasWarnings;if(r.json){let a=this.buildJsonResponse({result:o,hasErrors:s});if(t.stdout.info(JSON.stringify(a,null,2)),s)throw new N({code:N.Code.ValidationError});return}if(o.violations.length>0)for(let a of o.violations){let c=a.severity==="warning"?ve.yellow:ve.red;process.stderr.write(`${c(`${a.displayRelativeFilepath}:${a.line}:${a.column}: ${a.message}`)}
|
|
3242
|
-
`)}if(s)throw new N({code:N.Code.ValidationError});if(o.warningCount>0){t.stderr.info(`${Cn.warning} ${ve.yellow(`Found ${o.warningCount} warnings`)}`),t.stderr.info(ve.dim(" Run 'fern docs check --strict' to treat warnings as errors"));return}t.stderr.info(`${Cn.success} ${ve.green("All checks passed")}`)}buildJsonResponse({result:t,hasErrors:r}){let n={};return t.violations.length>0&&(n.docs=t.violations.map(i=>wX(i))),{success:!r,results:n}}};function LTo(e){let t=new MTo;vo(e,"check","Validate docs configuration",(r,n)=>t.handle(r,n),r=>r.option("strict",{type:"boolean",description:"Treat warnings as errors",default:!1}).option("json",{type:"boolean",description:"Output results as JSON to stdout",default:!1}))}var L8c=we(require("net"),1),U8c=we(require("os"),1),N5n=class extends Error{constructor(t){super(`${t} is locked`)}},tht={old:new Set,young:new Set},znm=1e3*15,z8c=new Set;var wUt,Vnm=()=>{let e=U8c.default.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},j8c=e=>new Promise((t,r)=>{let n=L8c.default.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),M8c=async(e,t)=>{if(e.host||e.port===0)return j8c(e);for(let r of t)try{await j8c({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},qnm=e=>tht.old.has(e)||tht.young.has(e)||z8c.has(e),Gnm=function*(e){e&&(yield*e),yield 0};async function g1e(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let s=e.exclude;if(typeof s[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let a of s){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}r=new Set(s)}let{reserve:n,...i}=e??{};wUt===void 0&&(wUt=setTimeout(()=>{wUt=void 0,tht.old=tht.young,tht.young=new Set},znm),wUt.unref&&wUt.unref());let o=Vnm();for(let s of Gnm(t))try{if(r.has(s))continue;let a=await M8c({...i,port:s},o);for(;qnm(a);){if(s!==0)throw new N5n(s);a=await M8c({...i,port:s},o)}return n?z8c.add(a):tht.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof N5n))throw a}throw new Error("No available ports found")}var G8c=/^[a-z0-9-]+-preview-[a-z0-9-]+\.docs\.buildwithfern\.com$/i,V8c="docs.buildwithfern.com",q8c=62;function v6e(e){let t=e.toLowerCase().trim();t.startsWith("https://")?t=t.slice(8):t.startsWith("http://")&&(t=t.slice(7));let r=t.indexOf("/");return r!==-1&&(t=t.slice(0,r)),G8c.test(t)}function W8c(e){let t=e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");return t.length===0?"default":t}function xUt({orgId:e,previewId:t}){let r=W8c(t),n=`${e}-preview-${r}.${V8c}`;if(n.length<=q8c)return n;let i=`${e}-preview-`,o=q8c-i.length;if(o<8)throw new N({message:`Organization name "${e}" is too long to generate a valid preview URL`,code:N.Code.ValidationError});let a=r.slice(0,o).replace(/-+$/,"");return`${i}${a}.${V8c}`}jt();Cg();Xt();mx();var SRo=require("child_process"),peu=we(VTo(),1),_Ro=we(v8n(),1),BRo=we(require("fs"),1),Rzt=require("fs/promises"),feu=we(require("http"),1),PRo=we(require("path"),1);var qWc=require("events"),_8n=we(require("fs"),1),D6e=we(require("path"),1);var SWc=we(require("os"),1),_Wc=300,C1e=20,JUt=1e7,BWc=SWc.default.platform();var spm=BWc==="darwin",cPo=BWc==="win32",w1e=spm||cPo,TWc=3e3,OWc=2e4,uPo=1250;var lre;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(lre||(lre={}));var P6e;(function(e){e.CHANGE="change",e.RENAME="rename"})(P6e||(P6e={}));var YUt;(function(e){e.CHANGE="change",e.ERROR="error"})(YUt||(YUt={}));var Pc;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(Pc||(Pc={}));var w2;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(w2||(w2={}));var apm=(e,t=1,r)=>{t=Math.max(1,t);let n=r?.leading??!1,i=r?.trailing??!0,o=Math.max(r?.maxWait??1/0,t),s,a,c=0,u=0,l=()=>{let C=Date.now(),x=C-c,B=C-u,O=x>=t||B>=o;return[C,O]},p=C=>{if(u=C,!s)return;let x=s;s=void 0,e.apply(void 0,x)},d=()=>{v(0)},f=()=>{a&&(d(),p(Date.now()))},m=C=>{if(u=C,n)return p(C)},h=C=>{if(i&&s)return p(C);s=void 0},A=()=>{a=void 0;let[C,x]=l();return x?h(C):b(C)},b=C=>{let x=C-c,B=C-u,O=t-x,F=o-B,T=Math.min(O,F);return v(T)},v=C=>{a&&clearTimeout(a),!(C<=0)&&(a=setTimeout(A,C))},w=(...C)=>{let[x,B]=l(),O=!!a;if(s=C,c=x,(B||!a)&&v(t),B)return O?p(x):m(x)};return w.cancel=d,w.flush=f,w},C8n=apm;var dPo=we(require("fs"),1),x8n=we(require("path"),1);var wd=we(require("fs"),1),lT=require("util");var Ppe=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},pre=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var lPo=we(require("process"),1),PWc=lPo.default.getuid?!lPo.default.getuid():!1,DWc=1e4,fj=()=>{};var XUt={isChangeErrorOk:e=>{if(!XUt.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!PWc&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!XUt.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!XUt.isNodeError(e))throw e;if(!XUt.isChangeErrorOk(e))throw e}},qv=XUt;var pPo=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=DWc,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=()=>this.remove(n),n=()=>t(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},RWc=new pPo;var Dpe=(e,t)=>function(n){return function i(...o){return RWc.schedule().then(s=>{let a=u=>(s(),u),c=u=>{if(s(),Date.now()>=n)throw u;if(t(u)){let l=Math.round(100*Math.random());return new Promise(d=>setTimeout(d,l)).then(()=>i.apply(void 0,o))}throw u};return e.apply(void 0,o).then(a,c)})}},Rpe=(e,t)=>function(n){return function i(...o){try{return e.apply(void 0,o)}catch(s){if(Date.now()>n)throw s;if(t(s))return i.apply(void 0,o);throw s}}};var cpm={attempt:{chmod:Ppe((0,lT.promisify)(wd.default.chmod),qv.onChangeError),chown:Ppe((0,lT.promisify)(wd.default.chown),qv.onChangeError),close:Ppe((0,lT.promisify)(wd.default.close),fj),fsync:Ppe((0,lT.promisify)(wd.default.fsync),fj),mkdir:Ppe((0,lT.promisify)(wd.default.mkdir),fj),realpath:Ppe((0,lT.promisify)(wd.default.realpath),fj),stat:Ppe((0,lT.promisify)(wd.default.stat),fj),unlink:Ppe((0,lT.promisify)(wd.default.unlink),fj),chmodSync:pre(wd.default.chmodSync,qv.onChangeError),chownSync:pre(wd.default.chownSync,qv.onChangeError),closeSync:pre(wd.default.closeSync,fj),existsSync:pre(wd.default.existsSync,fj),fsyncSync:pre(wd.default.fsync,fj),mkdirSync:pre(wd.default.mkdirSync,fj),realpathSync:pre(wd.default.realpathSync,fj),statSync:pre(wd.default.statSync,fj),unlinkSync:pre(wd.default.unlinkSync,fj)},retry:{close:Dpe((0,lT.promisify)(wd.default.close),qv.isRetriableError),fsync:Dpe((0,lT.promisify)(wd.default.fsync),qv.isRetriableError),open:Dpe((0,lT.promisify)(wd.default.open),qv.isRetriableError),readFile:Dpe((0,lT.promisify)(wd.default.readFile),qv.isRetriableError),rename:Dpe((0,lT.promisify)(wd.default.rename),qv.isRetriableError),stat:Dpe((0,lT.promisify)(wd.default.stat),qv.isRetriableError),write:Dpe((0,lT.promisify)(wd.default.write),qv.isRetriableError),writeFile:Dpe((0,lT.promisify)(wd.default.writeFile),qv.isRetriableError),closeSync:Rpe(wd.default.closeSync,qv.isRetriableError),fsyncSync:Rpe(wd.default.fsyncSync,qv.isRetriableError),openSync:Rpe(wd.default.openSync,qv.isRetriableError),readFileSync:Rpe(wd.default.readFileSync,qv.isRetriableError),renameSync:Rpe(wd.default.renameSync,qv.isRetriableError),statSync:Rpe(wd.default.statSync,qv.isRetriableError),writeSync:Rpe(wd.default.writeSync,qv.isRetriableError),writeFileSync:Rpe(wd.default.writeFileSync,qv.isRetriableError)}},FWc=cpm;var w8n=we(require("fs"),1),ZUt=we(require("path"),1);var fPo=()=>{};var upm=()=>{let e=fPo,t=fPo,r=!1,n=!1;return{promise:new Promise((c,u)=>{e=l=>(r=!0,c(l)),t=l=>(n=!0,u(l))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},kWc=upm;var lpm=()=>{let{promise:e,resolve:t,isPending:r}=kWc(),n=0,i=()=>{n+=1},o=()=>{n-=1,!n&&t()};return i(),queueMicrotask(o),{promise:e,isPending:r,increment:i,decrement:o}},NWc=lpm;var QWc={then:e=>{e()}};var jWc=e=>Array.isArray(e)?e:[e],MWc=e=>typeof e=="function";var ppm=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,o=t?.ignore??[],s=jWc(o).map(re=>MWc(re)?re:ie=>re.test(ie)),a=re=>s.some(ie=>ie(re)),c=t?.signal??{aborted:!1},u=t?.onDirents||(()=>{}),l=[],p=new Set,d={},f=[],m=new Set,h={},A=[],b=new Set,v={},w={},C=new Set,x={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},B={directories:l,directoriesNames:p,directoriesNamesToPaths:d,files:f,filesNames:m,filesNamesToPaths:h,symlinks:A,symlinksNames:b,symlinksNamesToPaths:v,map:w},{promise:O,increment:F,decrement:T}=NWc(),L=0,K=(re,ie,Ee,Ie)=>{C.has(ie)||L>=i||(L+=1,re.directories.push(ie),re.directoriesNames.add(Ee),l.push(ie),p.add(Ee),d.propertyIsEnumerable(Ee)||(d[Ee]=[]),d[Ee].push(ie),C.add(ie),!(Ie>=n)&&(L>=i||me(ie,Ie+1)))},X=(re,ie,Ee)=>{C.has(ie)||L>=i||(L+=1,re.files.push(ie),re.filesNames.add(Ee),f.push(ie),m.add(Ee),h.propertyIsEnumerable(Ee)||(h[Ee]=[]),h[Ee].push(ie),C.add(ie))},Y=(re,ie,Ee,Ie)=>{C.has(ie)||L>=i||(L+=1,re.symlinks.push(ie),re.symlinksNames.add(Ee),A.push(ie),b.add(Ee),v.propertyIsEnumerable(Ee)||(v[Ee]=[]),v[Ee].push(ie),C.add(ie),r&&(Ie>=n||L>=i||Re(ie,Ie+1)))},de=(re,ie,Ee,Ie,Fe)=>{c.aborted||a(ie)||(Ie.isDirectory()?K(re,ie,Ee,Fe):Ie.isFile()?X(re,ie,Ee):Ie.isSymbolicLink()&&Y(re,ie,Ee,Fe))},he=(re,ie,Ee,Ie)=>{if(c.aborted)return;let Fe=ie===ZUt.default.sep?"":ZUt.default.sep,Ue=Ee.name,st=`${ie}${Fe}${Ue}`;a(st)||(Ee.isDirectory()?K(re,st,Ue,Ie):Ee.isFile()?X(re,st,Ue):Ee.isSymbolicLink()&&Y(re,st,Ue,Ie))},ae=(re,ie,Ee,Ie)=>{for(let Fe=0,Ue=Ee.length;Fe<Ue;Fe++)he(re,ie,Ee[Fe],Ie)},me=(re,ie)=>{c.aborted||ie>n||L>=i||(F(),w8n.default.readdir(re,{withFileTypes:!0},(Ee,Ie)=>{if(Ee||c.aborted||!Ie.length)return T();(u(Ie)||QWc).then(()=>{let Ue=w[re]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};ae(Ue,re,Ie,ie),T()})}))},Re=(re,ie)=>{F(),w8n.default.realpath(re,(Ee,Ie)=>{if(Ee||c.aborted)return T();w8n.default.stat(Ie,(Fe,Ue)=>{if(Fe||c.aborted)return T();let st=ZUt.default.basename(Ie),ht=w[re]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};de(ht,Ie,st,Ue,ie),T()})})};return(async(re,ie=1)=>(re=ZUt.default.normalize(re),C.add(re),me(re,ie),await O,c.aborted?x:B))(e)},LWc=ppm;var fre={lang:{debounce:C8n,attempt:e=>{try{return e()}catch(t){return fre.lang.castError(t)}},castArray:e=>fre.lang.isArray(e)?e:[e],castError:e=>fre.lang.isError(e)?e:fre.lang.isString(e)?new Error(e):new Error("Unknown error"),defer:e=>setTimeout(e,0),isArray:e=>Array.isArray(e),isError:e=>e instanceof Error,isFunction:e=>typeof e=="function",isNaN:e=>Number.isNaN(e),isNumber:e=>typeof e=="number",isPrimitive:e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},isShallowEqual:(e,t)=>{if(e===t)return!0;if(fre.lang.isNaN(e))return fre.lang.isNaN(t);if(fre.lang.isPrimitive(e)||fre.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},isSet:e=>e instanceof Set,isString:e=>typeof e=="string",isUndefined:e=>e===void 0,noop:()=>{},uniq:e=>e.length<2?e:Array.from(new Set(e))},fs:{getDepth:e=>Math.max(0,e.split(x8n.default.sep).length-1),getRealPath:(e,t)=>{try{return t?dPo.default.realpathSync.native(e):dPo.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===x8n.default.sep&&t.length-e.length>x8n.default.sep.length,poll:(e,t=OWc)=>FWc.retry.stat(t)(e,{bigint:!0}).catch(fre.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,o)=>{if(o&&r===1&&e in o){let s=o[e];return[s.directories,s.files]}else{let s=await LWc(e,{depth:r,limit:n,ignore:t,signal:i});return[s.directories,s.files]}}}},Zl=fre;var S8n=we(require("path"),1);var mPo=class{constructor(t,r,n){this.base=n,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||Zl.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=_Wc){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,o=async(a,c)=>{let u=this.options.ignoreInitial?[]:a,l=await this.eventsPopulate([...c]),p=this.eventsDeduplicate([...u,...l]);this.onTargetEvents(p)},s=Zl.lang.debounce(()=>{this.watcher.isClosed()||(r=o(n,i),n=[],i=new Set)},t);return async(a,c="",u=!1)=>{u?await this.eventsPopulate([c],n,!0):i.add(c),r.then(s)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[o,s]=i,a=r[s];return o===a||o===Pc.CHANGE&&a===Pc.ADD||(r[s]=o,n.push(i)),n},[])}async eventsPopulate(t,r=[],n=!1){return await Promise.all(t.map(async i=>{let o=await this.watcher._poller.update(i,this.options.pollingTimeout);await Promise.all(o.map(async s=>{r.push([s,i]),s===Pc.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):s===Pc.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,i,r,n)}))})),r}async eventsPopulateAddDir(t,r,n=[],i=!1){if(i)return n;let o=this.options.recursive?this.options.depth??C1e:Math.min(1,this.options.depth??C1e),s=this.options.limit??JUt,[a,c]=await Zl.fs.readdir(r,this.options.ignore,o,s,this.watcher._closeSignal),u=[...a,...c];return await Promise.all(u.map(l=>{if(!this.watcher.isIgnored(l,this.options.ignore)&&!t.includes(l))return this.eventsPopulate([l],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let o of this.watcher._poller.stats.keys())Zl.fs.isSubPath(r,o)&&(t.includes(o)||await this.eventsPopulate([o],n,!0));return n}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(Pc.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!w1e&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(Pc.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(Pc.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(S8n.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(Pc.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(S8n.default.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(Pc.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===Pc.ADD?this.onTargetAdd(n):r===Pc.ADD_DIR?this.onTargetAddDir(n):r===Pc.CHANGE?this.onTargetChange(n):r===Pc.UNLINK?this.onTargetUnlink(n):r===Pc.UNLINK_DIR&&this.onTargetUnlinkDir(n)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,n=!1){return this.handlerBatched(t,r,n)}onWatcherChange(t=P6e.CHANGE,r){if(this.watcher.isClosed())return;let n=S8n.default.resolve(this.folderPath,r||"");this.filePath&&n!==this.folderPath&&n!==this.filePath||this.watcher.isIgnored(n,this.options.ignore)||this.onWatcherEvent(t,n)}onWatcherError(t){cPo&&t.code==="EPERM"?this.onWatcherChange(P6e.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(YUt.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(YUt.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(P6e.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&w1e&&this.options.native!==!1?this.options.depth??C1e:Math.min(1,this.options.depth??C1e),n=this.options.limit??JUt,[i,o]=await Zl.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),s=[this.folderPath,...i,...o];await Promise.all(s.map(a=>{if(!this.watcher._poller.stats.has(a)&&!this.watcher.isIgnored(a,this.options.ignore))return this.onWatcherEvent(P6e.CHANGE,a,t)}))}}},UWc=mPo;var x2={interval:100,intervalId:void 0,fns:new Map,init:()=>{x2.intervalId||(x2.intervalId=setInterval(x2.resolve,x2.interval))},reset:()=>{x2.intervalId&&(clearInterval(x2.intervalId),delete x2.intervalId)},add:(e,t)=>{x2.fns.set(e,Date.now()+t),x2.init()},remove:e=>{x2.fns.delete(e)},resolve:()=>{if(!x2.fns.size)return x2.reset();let e=Date.now();for(let[t,r]of x2.fns)r>=e||(x2.remove(t),t())}},ezt=x2;var tzt=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=uPo){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{let p=this._watcher._poller.paths.find(n||-1,d=>d!==i);if(p&&p!==i){if(Zl.fs.getRealPath(i,!0)===p)return;this._watcher.event(o.rename,p,i)}else this._watcher.event(o.add,i)};if(!n)return a();let c=()=>{s.add.delete(n),ezt.remove(u)},u=()=>{c(),a()};ezt.add(u,r);let l=()=>{let p=s.unlink.get(n);if(!p)return;c();let d=p();i===d?o.change&&this._watcher._poller.stats.has(i)&&this._watcher.event(o.change,i):this._watcher.event(o.rename,d,i)};s.add.set(n,l),l()}getLockUnlink(t,r=uPo){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{this._watcher.event(o.unlink,i)};if(!n)return a();let c=()=>{s.unlink.delete(n),ezt.remove(u)},u=()=>{c(),a()};ezt.add(u,r);let l=()=>(c(),i);s.unlink.set(n,l),s.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,Pc.ADD,lre.FILE);return this.getLockAdd({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let n=this._watcher._poller.getIno(t,Pc.ADD_DIR,lre.DIR);return this.getLockAdd({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let n=this._watcher._poller.getIno(t,Pc.UNLINK,lre.FILE);return this.getLockUnlink({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let n=this._watcher._poller.getIno(t,Pc.UNLINK_DIR,lre.DIR);return this.getLockUnlink({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};tzt.DIR_EVENTS={add:Pc.ADD_DIR,rename:Pc.RENAME_DIR,unlink:Pc.UNLINK_DIR};tzt.FILE_EVENTS={add:Pc.ADD,change:Pc.CHANGE,rename:Pc.RENAME,unlink:Pc.UNLINK};var zWc=tzt;var hPo=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(Zl.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(Zl.lang.isSet(n)){let i=n.delete(r);return n.size||this.map.delete(t),i}else if(n===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let n=this.map.get(t);if(Zl.lang.isSet(n))return Array.from(n).find(r);if(r(n))return n}}get(t){return this.map.get(t)}has(t,r){if(Zl.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return Zl.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);Zl.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},gPo=hPo;var APo=class{constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},VWc=APo;var yPo=class{constructor(){this.inos={},this.paths=new gPo,this.stats=new Map}getIno(t,r,n){let i=this.inos[r];if(!i)return;let o=i[t];if(o&&!(n&&o[1]!==n))return o[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let n=await Zl.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new VWc(n)}reset(){this.inos={},this.paths=new gPo,this.stats=new Map}async update(t,r){let n=this.getStats(t),i=await this.poll(t,r);if(this.updateStats(t,i),!n&&i){if(i.isFile())return this.updateIno(t,Pc.ADD,i),[Pc.ADD];if(i.isDirectory())return this.updateIno(t,Pc.ADD_DIR,i),[Pc.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,Pc.UNLINK,n),[Pc.UNLINK];if(n.isDirectory())return this.updateIno(t,Pc.UNLINK_DIR,n),[Pc.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,Pc.CHANGE,i),[Pc.CHANGE]);if(i.isDirectory())return this.updateIno(t,Pc.UNLINK,n),this.updateIno(t,Pc.ADD_DIR,i),[Pc.UNLINK,Pc.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,Pc.UNLINK_DIR,n),this.updateIno(t,Pc.ADD,i),[Pc.UNLINK_DIR,Pc.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,Pc.UNLINK_DIR,n),this.updateIno(t,Pc.ADD_DIR,i),[Pc.UNLINK_DIR,Pc.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=n.isFile()?lre.FILE:lre.DIR;i[t]=[n.ino,o]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let n=this.stats.get(t)?.ino||-1;this.paths.delete(n,t),this.stats.delete(t)}}},bPo=yPo;var EPo=class e extends qWc.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(w2.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on(w2.CLOSE,i)),this._readyWait=new Promise(i=>this.on(w2.READY,i)),this._locker=new zWc(this),this._roots=new Set,this._poller=new bPo,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,n)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(Zl.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit(w2.CLOSE))}error(t){if(this.isClosed())return!1;let r=Zl.lang.castError(t);return this.emit(w2.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit(w2.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(w2.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&Zl.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&Zl.lang.isShallowEqual(n.options,r))return!0;return!1}watchersClose(t,r,n=!0){if(t){let i=this._watchers[t];if(i)for(let o of[...i])r&&o.filePath!==r||this.watcherClose(o);if(n)for(let o in this._watchers)Zl.fs.isSubPath(t,o)&&this.watchersClose(o,r,!1)}else for(let i in this._watchers)this.watchersClose(i,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,n]of t)this.watchPath(r,n.options,n.handler)}async watcherAdd(t,r){let{folderPath:n}=t;(this._watchers[n]=this._watchers[n]||[]).push(t);let o=new UWc(this,t,r);return await o.init(),o}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let o=r.indexOf(t);r.splice(o,1),r.length||delete this._watchers[t.folderPath]}let n=t.filePath||t.folderPath;this._roots.has(n)&&(this._watchersRestorable[n]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=Zl.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(a=>a.handler===n&&(!a.filePath||a.filePath===i)&&a.options.ignore===r.ignore&&!!a.options.native==!!r.native&&(!r.recursive||a.options.recursive)))return!0;let s=D6e.default.dirname(t);for(let a=1;a<1/0;a++){if(this._watchers[s]?.find(l=>(a===1||l.options.recursive&&a<=(l.options.depth??C1e))&&l.handler===n&&(!l.filePath||l.filePath===i)&&l.options.ignore===r.ignore&&!!l.options.native==!!r.native&&(!r.recursive||l.options.recursive&&w1e&&l.options.native!==!1)))return!0;if(!w1e)break;let u=D6e.default.dirname(t);if(s===u)break;s=u}return!1}async watchDirectories(t,r,n,i,o){if(this.isClosed())return;t=Zl.lang.uniq(t).sort();let s;for(let a of t)if(!this.isIgnored(a,r.ignore)&&!this.watcherExists(a,r,n,i))try{let c=!r.recursive||w1e&&r.native!==!1?r:{...r,recursive:!1},l={watcher:_8n.default.watch(a,c),handler:n,options:r,folderPath:a,filePath:i},p=s=await this.watcherAdd(l,o);if(this._roots.has(i||a)){let f={...r,ignoreInitial:!0,recursive:!1},m=D6e.default.dirname(a),h=a;await this.watchDirectories([m],f,n,h,p)}}catch(c){this.error(c)}return s}async watchDirectory(t,r,n,i,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||w1e&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,o));{r={...r,recursive:!0};let s=r.depth??C1e,a=r.limit??JUt,[c]=await Zl.fs.readdir(t,r.ignore,s,a,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let u=await this.watchDirectories([t],r,n,i,o);if(c.length){let l=Zl.fs.getDepth(t);for(let p of c){let d=Zl.fs.getDepth(p),f=Math.max(0,s-(d-l)),m={...r,depth:f};await this.watchDirectories([p],m,n,i,o||u)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},o=(u,l)=>{l===t&&(c(),n())},s=new e(o),a=()=>{this._subwatchers.add(i),this.on(w2.CLOSE,c),s.watchFile(t,r,o)},c=()=>{this._subwatchers.delete(i),this.removeListener(w2.CLOSE,c),s.close()};return a()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=D6e.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,o=new bPo,s=await this.watchPolling(t,r,async()=>{i||!(await o.update(t,r.pollingTimeout)).length||i||(i=!0,s(),n())})}async watchPolling(t,r,n){if(this.isClosed())return Zl.lang.noop;if(this.pollerExists(t,r))return Zl.lang.noop;let i={...r,interval:r.pollingInterval??TWc},o={targetPath:t,options:r},s=()=>{this._pollers.add(o),this.on(w2.CLOSE,a),_8n.default.watchFile(t,i,n)},a=()=>{this._pollers.delete(o),this.removeListener(w2.CLOSE,a),_8n.default.unwatchFile(t,n)};return Zl.lang.attempt(s),()=>Zl.lang.attempt(a)}async watchUnknownChild(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchFileOnce(t,r,i)}async watchUnknownTarget(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchPollingOnce(t,r,i)}async watchPaths(t,r,n){if(this.isClosed())return;if(t=Zl.lang.uniq(t).sort(),t.every((o,s)=>t.every((a,c)=>c===s||!Zl.fs.isSubPath(o,a))))await Promise.all(t.map(o=>this.watchPath(o,r,n)));else for(let o of t)await this.watchPath(o,r,n)}async watchPath(t,r,n){if(this.isClosed()||(t=D6e.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await Zl.fs.poll(t,r.pollingTimeout);if(i){if(i.isFile())return this.watchFile(t,r,n);if(i.isDirectory())return this.watchDirectory(t,r,n);this.error(`"${t}" is not supported`)}else{let o=D6e.default.dirname(t);return(await Zl.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=Zl.lang.noop){if(Zl.lang.isFunction(t))return this.watch([],{},t);if(Zl.lang.isUndefined(t))return this.watch([],r,n);if(Zl.lang.isFunction(r))return this.watch(t,{},r);if(Zl.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=Zl.lang.castArray(t);i.forEach(o=>this._roots.add(o)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==Zl.lang.noop&&this.on(w2.ALL,n),r.readdirMap=void 0,this.ready())}},B8n=EPo;V8n();Xt();var n8=require("fs/promises"),K$c=require("os"),VPo=we(require("path"),1),Qfm=".fern",jfm="logs",zPo=100*1024*1024;function Mfm(){return"cli@5.3.0"}var j6e=class{logFilePath=null;initialized=!1;sessionStartTime;consoleLogger;constructor(){this.sessionStartTime=Date.now()}async initialize(t){if(this.initialized)return;this.consoleLogger=t;let r=Ye(Ht.of((0,K$c.homedir)()),De.of(Qfm)),n=Ye(r,De.of(jfm));await ar(n)||await(0,n8.mkdir)(n,{recursive:!0});let o=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=Ye(n,De.of(o));let s=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${VPo.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
|
|
3242
|
+
`)}if(s)throw new N({code:N.Code.ValidationError});if(o.warningCount>0){t.stderr.info(`${Cn.warning} ${ve.yellow(`Found ${o.warningCount} warnings`)}`),t.stderr.info(ve.dim(" Run 'fern docs check --strict' to treat warnings as errors"));return}t.stderr.info(`${Cn.success} ${ve.green("All checks passed")}`)}buildJsonResponse({result:t,hasErrors:r}){let n={};return t.violations.length>0&&(n.docs=t.violations.map(i=>wX(i))),{success:!r,results:n}}};function LTo(e){let t=new MTo;vo(e,"check","Validate docs configuration",(r,n)=>t.handle(r,n),r=>r.option("strict",{type:"boolean",description:"Treat warnings as errors",default:!1}).option("json",{type:"boolean",description:"Output results as JSON to stdout",default:!1}))}var L8c=we(require("net"),1),U8c=we(require("os"),1),N5n=class extends Error{constructor(t){super(`${t} is locked`)}},tht={old:new Set,young:new Set},znm=1e3*15,z8c=new Set;var wUt,Vnm=()=>{let e=U8c.default.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},j8c=e=>new Promise((t,r)=>{let n=L8c.default.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),M8c=async(e,t)=>{if(e.host||e.port===0)return j8c(e);for(let r of t)try{await j8c({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},qnm=e=>tht.old.has(e)||tht.young.has(e)||z8c.has(e),Gnm=function*(e){e&&(yield*e),yield 0};async function g1e(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let s=e.exclude;if(typeof s[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let a of s){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}r=new Set(s)}let{reserve:n,...i}=e??{};wUt===void 0&&(wUt=setTimeout(()=>{wUt=void 0,tht.old=tht.young,tht.young=new Set},znm),wUt.unref&&wUt.unref());let o=Vnm();for(let s of Gnm(t))try{if(r.has(s))continue;let a=await M8c({...i,port:s},o);for(;qnm(a);){if(s!==0)throw new N5n(s);a=await M8c({...i,port:s},o)}return n?z8c.add(a):tht.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof N5n))throw a}throw new Error("No available ports found")}var G8c=/^[a-z0-9-]+-preview-[a-z0-9-]+\.docs\.buildwithfern\.com$/i,V8c="docs.buildwithfern.com",q8c=62;function v6e(e){let t=e.toLowerCase().trim();t.startsWith("https://")?t=t.slice(8):t.startsWith("http://")&&(t=t.slice(7));let r=t.indexOf("/");return r!==-1&&(t=t.slice(0,r)),G8c.test(t)}function W8c(e){let t=e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");return t.length===0?"default":t}function xUt({orgId:e,previewId:t}){let r=W8c(t),n=`${e}-preview-${r}.${V8c}`;if(n.length<=q8c)return n;let i=`${e}-preview-`,o=q8c-i.length;if(o<8)throw new N({message:`Organization name "${e}" is too long to generate a valid preview URL`,code:N.Code.ValidationError});let a=r.slice(0,o).replace(/-+$/,"");return`${i}${a}.${V8c}`}jt();Cg();Xt();mx();var SRo=require("child_process"),peu=we(VTo(),1),_Ro=we(v8n(),1),BRo=we(require("fs"),1),Rzt=require("fs/promises"),feu=we(require("http"),1),PRo=we(require("path"),1);var qWc=require("events"),_8n=we(require("fs"),1),D6e=we(require("path"),1);var SWc=we(require("os"),1),_Wc=300,C1e=20,JUt=1e7,BWc=SWc.default.platform();var spm=BWc==="darwin",cPo=BWc==="win32",w1e=spm||cPo,TWc=3e3,OWc=2e4,uPo=1250;var lre;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(lre||(lre={}));var P6e;(function(e){e.CHANGE="change",e.RENAME="rename"})(P6e||(P6e={}));var YUt;(function(e){e.CHANGE="change",e.ERROR="error"})(YUt||(YUt={}));var Pc;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(Pc||(Pc={}));var w2;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(w2||(w2={}));var apm=(e,t=1,r)=>{t=Math.max(1,t);let n=r?.leading??!1,i=r?.trailing??!0,o=Math.max(r?.maxWait??1/0,t),s,a,c=0,u=0,l=()=>{let C=Date.now(),x=C-c,B=C-u,O=x>=t||B>=o;return[C,O]},p=C=>{if(u=C,!s)return;let x=s;s=void 0,e.apply(void 0,x)},d=()=>{v(0)},f=()=>{a&&(d(),p(Date.now()))},m=C=>{if(u=C,n)return p(C)},h=C=>{if(i&&s)return p(C);s=void 0},A=()=>{a=void 0;let[C,x]=l();return x?h(C):b(C)},b=C=>{let x=C-c,B=C-u,O=t-x,F=o-B,T=Math.min(O,F);return v(T)},v=C=>{a&&clearTimeout(a),!(C<=0)&&(a=setTimeout(A,C))},w=(...C)=>{let[x,B]=l(),O=!!a;if(s=C,c=x,(B||!a)&&v(t),B)return O?p(x):m(x)};return w.cancel=d,w.flush=f,w},C8n=apm;var dPo=we(require("fs"),1),x8n=we(require("path"),1);var wd=we(require("fs"),1),lT=require("util");var Ppe=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},pre=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var lPo=we(require("process"),1),PWc=lPo.default.getuid?!lPo.default.getuid():!1,DWc=1e4,fj=()=>{};var XUt={isChangeErrorOk:e=>{if(!XUt.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!PWc&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!XUt.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!XUt.isNodeError(e))throw e;if(!XUt.isChangeErrorOk(e))throw e}},qv=XUt;var pPo=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=DWc,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=()=>this.remove(n),n=()=>t(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},RWc=new pPo;var Dpe=(e,t)=>function(n){return function i(...o){return RWc.schedule().then(s=>{let a=u=>(s(),u),c=u=>{if(s(),Date.now()>=n)throw u;if(t(u)){let l=Math.round(100*Math.random());return new Promise(d=>setTimeout(d,l)).then(()=>i.apply(void 0,o))}throw u};return e.apply(void 0,o).then(a,c)})}},Rpe=(e,t)=>function(n){return function i(...o){try{return e.apply(void 0,o)}catch(s){if(Date.now()>n)throw s;if(t(s))return i.apply(void 0,o);throw s}}};var cpm={attempt:{chmod:Ppe((0,lT.promisify)(wd.default.chmod),qv.onChangeError),chown:Ppe((0,lT.promisify)(wd.default.chown),qv.onChangeError),close:Ppe((0,lT.promisify)(wd.default.close),fj),fsync:Ppe((0,lT.promisify)(wd.default.fsync),fj),mkdir:Ppe((0,lT.promisify)(wd.default.mkdir),fj),realpath:Ppe((0,lT.promisify)(wd.default.realpath),fj),stat:Ppe((0,lT.promisify)(wd.default.stat),fj),unlink:Ppe((0,lT.promisify)(wd.default.unlink),fj),chmodSync:pre(wd.default.chmodSync,qv.onChangeError),chownSync:pre(wd.default.chownSync,qv.onChangeError),closeSync:pre(wd.default.closeSync,fj),existsSync:pre(wd.default.existsSync,fj),fsyncSync:pre(wd.default.fsync,fj),mkdirSync:pre(wd.default.mkdirSync,fj),realpathSync:pre(wd.default.realpathSync,fj),statSync:pre(wd.default.statSync,fj),unlinkSync:pre(wd.default.unlinkSync,fj)},retry:{close:Dpe((0,lT.promisify)(wd.default.close),qv.isRetriableError),fsync:Dpe((0,lT.promisify)(wd.default.fsync),qv.isRetriableError),open:Dpe((0,lT.promisify)(wd.default.open),qv.isRetriableError),readFile:Dpe((0,lT.promisify)(wd.default.readFile),qv.isRetriableError),rename:Dpe((0,lT.promisify)(wd.default.rename),qv.isRetriableError),stat:Dpe((0,lT.promisify)(wd.default.stat),qv.isRetriableError),write:Dpe((0,lT.promisify)(wd.default.write),qv.isRetriableError),writeFile:Dpe((0,lT.promisify)(wd.default.writeFile),qv.isRetriableError),closeSync:Rpe(wd.default.closeSync,qv.isRetriableError),fsyncSync:Rpe(wd.default.fsyncSync,qv.isRetriableError),openSync:Rpe(wd.default.openSync,qv.isRetriableError),readFileSync:Rpe(wd.default.readFileSync,qv.isRetriableError),renameSync:Rpe(wd.default.renameSync,qv.isRetriableError),statSync:Rpe(wd.default.statSync,qv.isRetriableError),writeSync:Rpe(wd.default.writeSync,qv.isRetriableError),writeFileSync:Rpe(wd.default.writeFileSync,qv.isRetriableError)}},FWc=cpm;var w8n=we(require("fs"),1),ZUt=we(require("path"),1);var fPo=()=>{};var upm=()=>{let e=fPo,t=fPo,r=!1,n=!1;return{promise:new Promise((c,u)=>{e=l=>(r=!0,c(l)),t=l=>(n=!0,u(l))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},kWc=upm;var lpm=()=>{let{promise:e,resolve:t,isPending:r}=kWc(),n=0,i=()=>{n+=1},o=()=>{n-=1,!n&&t()};return i(),queueMicrotask(o),{promise:e,isPending:r,increment:i,decrement:o}},NWc=lpm;var QWc={then:e=>{e()}};var jWc=e=>Array.isArray(e)?e:[e],MWc=e=>typeof e=="function";var ppm=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,o=t?.ignore??[],s=jWc(o).map(re=>MWc(re)?re:ie=>re.test(ie)),a=re=>s.some(ie=>ie(re)),c=t?.signal??{aborted:!1},u=t?.onDirents||(()=>{}),l=[],p=new Set,d={},f=[],m=new Set,h={},A=[],b=new Set,v={},w={},C=new Set,x={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},B={directories:l,directoriesNames:p,directoriesNamesToPaths:d,files:f,filesNames:m,filesNamesToPaths:h,symlinks:A,symlinksNames:b,symlinksNamesToPaths:v,map:w},{promise:O,increment:F,decrement:T}=NWc(),L=0,K=(re,ie,Ee,Ie)=>{C.has(ie)||L>=i||(L+=1,re.directories.push(ie),re.directoriesNames.add(Ee),l.push(ie),p.add(Ee),d.propertyIsEnumerable(Ee)||(d[Ee]=[]),d[Ee].push(ie),C.add(ie),!(Ie>=n)&&(L>=i||me(ie,Ie+1)))},X=(re,ie,Ee)=>{C.has(ie)||L>=i||(L+=1,re.files.push(ie),re.filesNames.add(Ee),f.push(ie),m.add(Ee),h.propertyIsEnumerable(Ee)||(h[Ee]=[]),h[Ee].push(ie),C.add(ie))},Y=(re,ie,Ee,Ie)=>{C.has(ie)||L>=i||(L+=1,re.symlinks.push(ie),re.symlinksNames.add(Ee),A.push(ie),b.add(Ee),v.propertyIsEnumerable(Ee)||(v[Ee]=[]),v[Ee].push(ie),C.add(ie),r&&(Ie>=n||L>=i||Re(ie,Ie+1)))},de=(re,ie,Ee,Ie,Fe)=>{c.aborted||a(ie)||(Ie.isDirectory()?K(re,ie,Ee,Fe):Ie.isFile()?X(re,ie,Ee):Ie.isSymbolicLink()&&Y(re,ie,Ee,Fe))},he=(re,ie,Ee,Ie)=>{if(c.aborted)return;let Fe=ie===ZUt.default.sep?"":ZUt.default.sep,Ue=Ee.name,st=`${ie}${Fe}${Ue}`;a(st)||(Ee.isDirectory()?K(re,st,Ue,Ie):Ee.isFile()?X(re,st,Ue):Ee.isSymbolicLink()&&Y(re,st,Ue,Ie))},ae=(re,ie,Ee,Ie)=>{for(let Fe=0,Ue=Ee.length;Fe<Ue;Fe++)he(re,ie,Ee[Fe],Ie)},me=(re,ie)=>{c.aborted||ie>n||L>=i||(F(),w8n.default.readdir(re,{withFileTypes:!0},(Ee,Ie)=>{if(Ee||c.aborted||!Ie.length)return T();(u(Ie)||QWc).then(()=>{let Ue=w[re]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};ae(Ue,re,Ie,ie),T()})}))},Re=(re,ie)=>{F(),w8n.default.realpath(re,(Ee,Ie)=>{if(Ee||c.aborted)return T();w8n.default.stat(Ie,(Fe,Ue)=>{if(Fe||c.aborted)return T();let st=ZUt.default.basename(Ie),ht=w[re]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};de(ht,Ie,st,Ue,ie),T()})})};return(async(re,ie=1)=>(re=ZUt.default.normalize(re),C.add(re),me(re,ie),await O,c.aborted?x:B))(e)},LWc=ppm;var fre={lang:{debounce:C8n,attempt:e=>{try{return e()}catch(t){return fre.lang.castError(t)}},castArray:e=>fre.lang.isArray(e)?e:[e],castError:e=>fre.lang.isError(e)?e:fre.lang.isString(e)?new Error(e):new Error("Unknown error"),defer:e=>setTimeout(e,0),isArray:e=>Array.isArray(e),isError:e=>e instanceof Error,isFunction:e=>typeof e=="function",isNaN:e=>Number.isNaN(e),isNumber:e=>typeof e=="number",isPrimitive:e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},isShallowEqual:(e,t)=>{if(e===t)return!0;if(fre.lang.isNaN(e))return fre.lang.isNaN(t);if(fre.lang.isPrimitive(e)||fre.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},isSet:e=>e instanceof Set,isString:e=>typeof e=="string",isUndefined:e=>e===void 0,noop:()=>{},uniq:e=>e.length<2?e:Array.from(new Set(e))},fs:{getDepth:e=>Math.max(0,e.split(x8n.default.sep).length-1),getRealPath:(e,t)=>{try{return t?dPo.default.realpathSync.native(e):dPo.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===x8n.default.sep&&t.length-e.length>x8n.default.sep.length,poll:(e,t=OWc)=>FWc.retry.stat(t)(e,{bigint:!0}).catch(fre.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,o)=>{if(o&&r===1&&e in o){let s=o[e];return[s.directories,s.files]}else{let s=await LWc(e,{depth:r,limit:n,ignore:t,signal:i});return[s.directories,s.files]}}}},Zl=fre;var S8n=we(require("path"),1);var mPo=class{constructor(t,r,n){this.base=n,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||Zl.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=_Wc){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,o=async(a,c)=>{let u=this.options.ignoreInitial?[]:a,l=await this.eventsPopulate([...c]),p=this.eventsDeduplicate([...u,...l]);this.onTargetEvents(p)},s=Zl.lang.debounce(()=>{this.watcher.isClosed()||(r=o(n,i),n=[],i=new Set)},t);return async(a,c="",u=!1)=>{u?await this.eventsPopulate([c],n,!0):i.add(c),r.then(s)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[o,s]=i,a=r[s];return o===a||o===Pc.CHANGE&&a===Pc.ADD||(r[s]=o,n.push(i)),n},[])}async eventsPopulate(t,r=[],n=!1){return await Promise.all(t.map(async i=>{let o=await this.watcher._poller.update(i,this.options.pollingTimeout);await Promise.all(o.map(async s=>{r.push([s,i]),s===Pc.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):s===Pc.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,i,r,n)}))})),r}async eventsPopulateAddDir(t,r,n=[],i=!1){if(i)return n;let o=this.options.recursive?this.options.depth??C1e:Math.min(1,this.options.depth??C1e),s=this.options.limit??JUt,[a,c]=await Zl.fs.readdir(r,this.options.ignore,o,s,this.watcher._closeSignal),u=[...a,...c];return await Promise.all(u.map(l=>{if(!this.watcher.isIgnored(l,this.options.ignore)&&!t.includes(l))return this.eventsPopulate([l],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let o of this.watcher._poller.stats.keys())Zl.fs.isSubPath(r,o)&&(t.includes(o)||await this.eventsPopulate([o],n,!0));return n}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(Pc.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!w1e&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(Pc.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(Pc.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(S8n.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(Pc.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(S8n.default.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(Pc.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===Pc.ADD?this.onTargetAdd(n):r===Pc.ADD_DIR?this.onTargetAddDir(n):r===Pc.CHANGE?this.onTargetChange(n):r===Pc.UNLINK?this.onTargetUnlink(n):r===Pc.UNLINK_DIR&&this.onTargetUnlinkDir(n)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,n=!1){return this.handlerBatched(t,r,n)}onWatcherChange(t=P6e.CHANGE,r){if(this.watcher.isClosed())return;let n=S8n.default.resolve(this.folderPath,r||"");this.filePath&&n!==this.folderPath&&n!==this.filePath||this.watcher.isIgnored(n,this.options.ignore)||this.onWatcherEvent(t,n)}onWatcherError(t){cPo&&t.code==="EPERM"?this.onWatcherChange(P6e.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(YUt.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(YUt.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(P6e.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&w1e&&this.options.native!==!1?this.options.depth??C1e:Math.min(1,this.options.depth??C1e),n=this.options.limit??JUt,[i,o]=await Zl.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),s=[this.folderPath,...i,...o];await Promise.all(s.map(a=>{if(!this.watcher._poller.stats.has(a)&&!this.watcher.isIgnored(a,this.options.ignore))return this.onWatcherEvent(P6e.CHANGE,a,t)}))}}},UWc=mPo;var x2={interval:100,intervalId:void 0,fns:new Map,init:()=>{x2.intervalId||(x2.intervalId=setInterval(x2.resolve,x2.interval))},reset:()=>{x2.intervalId&&(clearInterval(x2.intervalId),delete x2.intervalId)},add:(e,t)=>{x2.fns.set(e,Date.now()+t),x2.init()},remove:e=>{x2.fns.delete(e)},resolve:()=>{if(!x2.fns.size)return x2.reset();let e=Date.now();for(let[t,r]of x2.fns)r>=e||(x2.remove(t),t())}},ezt=x2;var tzt=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=uPo){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{let p=this._watcher._poller.paths.find(n||-1,d=>d!==i);if(p&&p!==i){if(Zl.fs.getRealPath(i,!0)===p)return;this._watcher.event(o.rename,p,i)}else this._watcher.event(o.add,i)};if(!n)return a();let c=()=>{s.add.delete(n),ezt.remove(u)},u=()=>{c(),a()};ezt.add(u,r);let l=()=>{let p=s.unlink.get(n);if(!p)return;c();let d=p();i===d?o.change&&this._watcher._poller.stats.has(i)&&this._watcher.event(o.change,i):this._watcher.event(o.rename,d,i)};s.add.set(n,l),l()}getLockUnlink(t,r=uPo){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{this._watcher.event(o.unlink,i)};if(!n)return a();let c=()=>{s.unlink.delete(n),ezt.remove(u)},u=()=>{c(),a()};ezt.add(u,r);let l=()=>(c(),i);s.unlink.set(n,l),s.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,Pc.ADD,lre.FILE);return this.getLockAdd({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let n=this._watcher._poller.getIno(t,Pc.ADD_DIR,lre.DIR);return this.getLockAdd({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let n=this._watcher._poller.getIno(t,Pc.UNLINK,lre.FILE);return this.getLockUnlink({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let n=this._watcher._poller.getIno(t,Pc.UNLINK_DIR,lre.DIR);return this.getLockUnlink({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};tzt.DIR_EVENTS={add:Pc.ADD_DIR,rename:Pc.RENAME_DIR,unlink:Pc.UNLINK_DIR};tzt.FILE_EVENTS={add:Pc.ADD,change:Pc.CHANGE,rename:Pc.RENAME,unlink:Pc.UNLINK};var zWc=tzt;var hPo=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(Zl.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(Zl.lang.isSet(n)){let i=n.delete(r);return n.size||this.map.delete(t),i}else if(n===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let n=this.map.get(t);if(Zl.lang.isSet(n))return Array.from(n).find(r);if(r(n))return n}}get(t){return this.map.get(t)}has(t,r){if(Zl.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return Zl.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);Zl.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},gPo=hPo;var APo=class{constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},VWc=APo;var yPo=class{constructor(){this.inos={},this.paths=new gPo,this.stats=new Map}getIno(t,r,n){let i=this.inos[r];if(!i)return;let o=i[t];if(o&&!(n&&o[1]!==n))return o[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let n=await Zl.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new VWc(n)}reset(){this.inos={},this.paths=new gPo,this.stats=new Map}async update(t,r){let n=this.getStats(t),i=await this.poll(t,r);if(this.updateStats(t,i),!n&&i){if(i.isFile())return this.updateIno(t,Pc.ADD,i),[Pc.ADD];if(i.isDirectory())return this.updateIno(t,Pc.ADD_DIR,i),[Pc.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,Pc.UNLINK,n),[Pc.UNLINK];if(n.isDirectory())return this.updateIno(t,Pc.UNLINK_DIR,n),[Pc.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,Pc.CHANGE,i),[Pc.CHANGE]);if(i.isDirectory())return this.updateIno(t,Pc.UNLINK,n),this.updateIno(t,Pc.ADD_DIR,i),[Pc.UNLINK,Pc.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,Pc.UNLINK_DIR,n),this.updateIno(t,Pc.ADD,i),[Pc.UNLINK_DIR,Pc.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,Pc.UNLINK_DIR,n),this.updateIno(t,Pc.ADD_DIR,i),[Pc.UNLINK_DIR,Pc.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=n.isFile()?lre.FILE:lre.DIR;i[t]=[n.ino,o]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let n=this.stats.get(t)?.ino||-1;this.paths.delete(n,t),this.stats.delete(t)}}},bPo=yPo;var EPo=class e extends qWc.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(w2.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on(w2.CLOSE,i)),this._readyWait=new Promise(i=>this.on(w2.READY,i)),this._locker=new zWc(this),this._roots=new Set,this._poller=new bPo,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,n)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(Zl.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit(w2.CLOSE))}error(t){if(this.isClosed())return!1;let r=Zl.lang.castError(t);return this.emit(w2.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit(w2.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(w2.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&Zl.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&Zl.lang.isShallowEqual(n.options,r))return!0;return!1}watchersClose(t,r,n=!0){if(t){let i=this._watchers[t];if(i)for(let o of[...i])r&&o.filePath!==r||this.watcherClose(o);if(n)for(let o in this._watchers)Zl.fs.isSubPath(t,o)&&this.watchersClose(o,r,!1)}else for(let i in this._watchers)this.watchersClose(i,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,n]of t)this.watchPath(r,n.options,n.handler)}async watcherAdd(t,r){let{folderPath:n}=t;(this._watchers[n]=this._watchers[n]||[]).push(t);let o=new UWc(this,t,r);return await o.init(),o}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let o=r.indexOf(t);r.splice(o,1),r.length||delete this._watchers[t.folderPath]}let n=t.filePath||t.folderPath;this._roots.has(n)&&(this._watchersRestorable[n]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=Zl.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(a=>a.handler===n&&(!a.filePath||a.filePath===i)&&a.options.ignore===r.ignore&&!!a.options.native==!!r.native&&(!r.recursive||a.options.recursive)))return!0;let s=D6e.default.dirname(t);for(let a=1;a<1/0;a++){if(this._watchers[s]?.find(l=>(a===1||l.options.recursive&&a<=(l.options.depth??C1e))&&l.handler===n&&(!l.filePath||l.filePath===i)&&l.options.ignore===r.ignore&&!!l.options.native==!!r.native&&(!r.recursive||l.options.recursive&&w1e&&l.options.native!==!1)))return!0;if(!w1e)break;let u=D6e.default.dirname(t);if(s===u)break;s=u}return!1}async watchDirectories(t,r,n,i,o){if(this.isClosed())return;t=Zl.lang.uniq(t).sort();let s;for(let a of t)if(!this.isIgnored(a,r.ignore)&&!this.watcherExists(a,r,n,i))try{let c=!r.recursive||w1e&&r.native!==!1?r:{...r,recursive:!1},l={watcher:_8n.default.watch(a,c),handler:n,options:r,folderPath:a,filePath:i},p=s=await this.watcherAdd(l,o);if(this._roots.has(i||a)){let f={...r,ignoreInitial:!0,recursive:!1},m=D6e.default.dirname(a),h=a;await this.watchDirectories([m],f,n,h,p)}}catch(c){this.error(c)}return s}async watchDirectory(t,r,n,i,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||w1e&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,o));{r={...r,recursive:!0};let s=r.depth??C1e,a=r.limit??JUt,[c]=await Zl.fs.readdir(t,r.ignore,s,a,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let u=await this.watchDirectories([t],r,n,i,o);if(c.length){let l=Zl.fs.getDepth(t);for(let p of c){let d=Zl.fs.getDepth(p),f=Math.max(0,s-(d-l)),m={...r,depth:f};await this.watchDirectories([p],m,n,i,o||u)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},o=(u,l)=>{l===t&&(c(),n())},s=new e(o),a=()=>{this._subwatchers.add(i),this.on(w2.CLOSE,c),s.watchFile(t,r,o)},c=()=>{this._subwatchers.delete(i),this.removeListener(w2.CLOSE,c),s.close()};return a()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=D6e.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,o=new bPo,s=await this.watchPolling(t,r,async()=>{i||!(await o.update(t,r.pollingTimeout)).length||i||(i=!0,s(),n())})}async watchPolling(t,r,n){if(this.isClosed())return Zl.lang.noop;if(this.pollerExists(t,r))return Zl.lang.noop;let i={...r,interval:r.pollingInterval??TWc},o={targetPath:t,options:r},s=()=>{this._pollers.add(o),this.on(w2.CLOSE,a),_8n.default.watchFile(t,i,n)},a=()=>{this._pollers.delete(o),this.removeListener(w2.CLOSE,a),_8n.default.unwatchFile(t,n)};return Zl.lang.attempt(s),()=>Zl.lang.attempt(a)}async watchUnknownChild(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchFileOnce(t,r,i)}async watchUnknownTarget(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchPollingOnce(t,r,i)}async watchPaths(t,r,n){if(this.isClosed())return;if(t=Zl.lang.uniq(t).sort(),t.every((o,s)=>t.every((a,c)=>c===s||!Zl.fs.isSubPath(o,a))))await Promise.all(t.map(o=>this.watchPath(o,r,n)));else for(let o of t)await this.watchPath(o,r,n)}async watchPath(t,r,n){if(this.isClosed()||(t=D6e.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await Zl.fs.poll(t,r.pollingTimeout);if(i){if(i.isFile())return this.watchFile(t,r,n);if(i.isDirectory())return this.watchDirectory(t,r,n);this.error(`"${t}" is not supported`)}else{let o=D6e.default.dirname(t);return(await Zl.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=Zl.lang.noop){if(Zl.lang.isFunction(t))return this.watch([],{},t);if(Zl.lang.isUndefined(t))return this.watch([],r,n);if(Zl.lang.isFunction(r))return this.watch(t,{},r);if(Zl.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=Zl.lang.castArray(t);i.forEach(o=>this._roots.add(o)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==Zl.lang.noop&&this.on(w2.ALL,n),r.readdirMap=void 0,this.ready())}},B8n=EPo;V8n();Xt();var n8=require("fs/promises"),K$c=require("os"),VPo=we(require("path"),1),Qfm=".fern",jfm="logs",zPo=100*1024*1024;function Mfm(){return"cli@5.4.0"}var j6e=class{logFilePath=null;initialized=!1;sessionStartTime;consoleLogger;constructor(){this.sessionStartTime=Date.now()}async initialize(t){if(this.initialized)return;this.consoleLogger=t;let r=Ye(Ht.of((0,K$c.homedir)()),De.of(Qfm)),n=Ye(r,De.of(jfm));await ar(n)||await(0,n8.mkdir)(n,{recursive:!0});let o=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=Ye(n,De.of(o));let s=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${VPo.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
|
|
3243
3243
|
`);await(0,n8.writeFile)(this.logFilePath,s,"utf-8"),this.initialized=!0,this.enforceLogSizeLimit(n)}getLogFilePath(){return this.logFilePath}async writeEntry(t){if(!this.initialized||!this.logFilePath)return;let r=JSON.stringify(t)+`
|
|
3244
3244
|
`;try{await(0,n8.appendFile)(this.logFilePath,r,"utf-8")}catch{}}async logFrontendMetrics(t){let r={timestamp:t.timestamp,source:t.source,level:t.level,eventType:this.getEventType(t.payload,t.isAggregate),isAggregate:t.isAggregate,data:t.payload};await this.writeEntry(r)}async logCliMetric(t,r="info"){let n={timestamp:t.timestamp,source:Mfm(),level:r,eventType:t.type,data:{durationMs:t.durationMs,metadata:t.metadata}};await this.writeEntry(n)}async logCliMemory(){let t=process.memoryUsage(),r={type:"cli_memory",timestamp:new Date().toISOString(),metadata:{heapUsed:t.heapUsed,heapTotal:t.heapTotal,external:t.external,rss:t.rss,heapUsedMB:Math.round(t.heapUsed/1024/1024*100)/100,heapTotalMB:Math.round(t.heapTotal/1024/1024*100)/100,rssMB:Math.round(t.rss/1024/1024*100)/100}};await this.logCliMetric(r)}async logCliReloadStart(){let t={type:"cli_reload_start",timestamp:new Date().toISOString()};await this.logCliMetric(t)}async logCliReloadFinish(t,r){let n={type:"cli_reload_finish",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(n)}async logCliDocsGeneration(t,r){let n={type:"cli_docs_generation",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(n)}async logCliValidation(t,r){let n={type:"cli_validation",timestamp:new Date().toISOString(),durationMs:t,metadata:{success:r}};await this.logCliMetric(n)}async enforceLogSizeLimit(t){try{let n=(await(0,n8.readdir)(t)).filter(c=>c.endsWith(".log")),i=[];for(let c of n){let u=VPo.default.join(t,c);try{let l=await(0,n8.stat)(u);i.push({name:c,fullPath:u,size:l.size,mtimeMs:l.mtimeMs})}catch{}}let o=i.reduce((c,u)=>c+u.size,0),s=Math.round(o/1024/1024*100)/100,a=zPo/1024/1024;if(o<=zPo){this.consoleLogger?.debug(`Log directory size ${s} MB does not exceed ${a} MB cap`);return}this.consoleLogger?.info(`Rotating logs: total size ${s} MB exceeds ${a} MB cap`),i.sort((c,u)=>c.mtimeMs-u.mtimeMs);for(let c of i){if(o<=zPo)break;if(!(this.logFilePath!=null&&c.fullPath===this.logFilePath))try{await(0,n8.unlink)(c.fullPath),o-=c.size}catch{}}}catch{}}getEventType(t,r){return r?"aggregate_summary":"type"in t&&typeof t.type=="string"?t.type:"unknown"}static isMetricsMessage(t){if(typeof t!="object"||t===null)return!1;let r=t;return r.type==="metrics"&&typeof r.timestamp=="string"&&typeof r.source=="string"}};var q8n={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"};function J$c(e){let t=Lfm();if(t==null)return;let{port:r,debugLogger:n,getDocsLoadResponse:i,extractLocaleFromPath:o}=e,s=new Map;function a(u){let l=JSON.stringify(u),p=[];for(let[d]of s)try{d.send(l)}catch{p.push(d)}for(let d of p){let f=s.get(d);f&&(clearInterval(f.pingInterval),s.delete(d))}}let c=t.serve({port:r,async fetch(u,l){if(u.method==="OPTIONS")return new Response(null,{status:204,headers:q8n});let p=new URL(u.url);if(u.headers.get("upgrade")?.toLowerCase()==="websocket"){l.upgrade(u,{data:{connectionId:`${Date.now()}`}});return}if(u.method==="POST"&&p.pathname==="/v2/registry/docs/load-with-url")try{let f=await u.json(),m=o?.(f?.url);return new Response(JSON.stringify(i(m)),{headers:{"Content-Type":"application/json",...q8n}})}catch{return new Response(JSON.stringify(i()),{headers:{"Content-Type":"application/json",...q8n}})}let d=/^\/_local\/(.*)/.exec(p.pathname);return u.method==="GET"&&d!=null?new Response(t.file(`/${d[1]}`),{headers:q8n}):new Response("Not Found",{status:404})},websocket:{open(u){let{connectionId:l}=u.data,p=setInterval(()=>{let d=s.get(u);if(!d)return;let f=Date.now();if(f-d.lastPong>9e4){u.close();return}try{u.send(JSON.stringify({type:"ping",timestamp:f}))}catch{u.close()}},3e4);s.set(u,{pingInterval:p,lastPong:Date.now()});try{u.send(JSON.stringify({type:"connected",connectionId:l}))}catch{}},message(u,l){try{let p=JSON.parse(l.toString());if(p.type==="pong"){let d=s.get(u);d&&(d.lastPong=Date.now())}else j6e.isMetricsMessage(p)&&n.logFrontendMetrics(p)}catch{}},close(u){let l=s.get(u);l&&(clearInterval(l.pingInterval),s.delete(u))}}});return{sendData:a,stop:u=>c.stop(u)}}function Lfm(){return globalThis.Bun}Xt();mx();var XZc=require("child_process"),nGn=we(XPo(),1),ZZc=we(pRo(),1),_2=require("fs"),dj=require("fs/promises"),eeu=require("os"),gW=we(require("path"),1),teu=we(qw(),1),reu=we(YZc(),1),$6e=process.platform==="win32",rGn=ve.cyan("[docs]:"),gAm="etag",AAm=23,vRo=e=>e.padEnd(AAm," "),yAm="preview",bAm="app-preview",EAm="bundle",IAm=".next",vAm="standalone",CAm=".fern",wAm="packages/fern-docs/bundle/.next/server/instrumentation.js",xAm='Cannot find matching keyid: {"signatures":';function SAm(e){try{let r=(0,XZc.execSync)('reg query "HKLM\\SYSTEM\\CurrentControlSet\\Control\\FileSystem" /v LongPathsEnabled',{encoding:"utf-8",timeout:5e3}).match(/LongPathsEnabled\s+REG_DWORD\s+0x(\d+)/i);if(r!=null&&r[1]==="1")return}catch(t){e.debug(`Registry query for LongPathsEnabled failed: ${t}`)}throw new N({message:`Windows long path support is not enabled. The docs bundle contains deeply nested .pnpm paths that exceed the 260-character MAX_PATH limit.
|
|
3245
3245
|
|
|
@@ -3432,7 +3432,7 @@ Please ensure you have membership at https://dashboard.buildwithfern.com, and as
|
|
|
3432
3432
|
|
|
3433
3433
|
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`:r}function Mbm(e,t,r){return t!=null&&t.includes("Invalid authorization token")?`Your authentication token is invalid or expired. Please run '${r}' to re-authenticate.`:`You are not authorized to publish docs under organization '${e}'. Please run '${r}' to ensure you are logged in with the correct account.
|
|
3434
3434
|
|
|
3435
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`}function Lbm(e){if(e==null)return{code:void 0,message:void 0};let t=e.body;if(t!=null&&typeof t=="object"){let n=typeof t.code=="string"?t.code:void 0,i=typeof t.message=="string"?t.message:void 0;return{code:n,message:i}}return{code:void 0,message:typeof t=="string"&&t.length>0?t:typeof e.errorMessage=="string"?e.errorMessage:typeof e.message=="string"?e.message:void 0}}function Ubm(e){try{return new URL(g2(e)).pathname}catch{return}}async function zbm({fdr:e,workspace:t,organization:r,context:n,snippetsConfig:i}){if(!t)return;let o=await Vbm({fdr:e,workspace:t,snippetsConfig:i,context:n});if(Object.keys(o).length===0){n.logger.debug("[SDK Dynamic IR] No snippet configs found, skipping S3 check");return}try{let a=(await e.api.register.checkSdkDynamicIrExists({orgId:hn.OrgId(r),apiId:"",irVersions:[]})).existingDynamicIrs??{};if(Object.keys(a).length===0){n.logger.debug("[SDK Dynamic IR] No existing SDK dynamic IRs found in S3");return}let c={};for(let[u,l]of Object.entries(a??{}))try{n.logger.debug(`Downloading existing SDK dynamic IR for ${u}...`);let p=await fetch(l.downloadUrl);if(p.ok){let d=await p.json();c[u]={dynamicIR:d},n.logger.debug(`Successfully downloaded SDK dynamic IR for ${u}`)}else n.logger.warn(`Failed to download SDK dynamic IR for ${u}: ${p.status}`)}catch(p){n.logger.warn(`Error downloading SDK dynamic IR for ${u}: ${p}`)}return Object.keys(c).length>0?c:void 0}catch(s){n.logger.debug(`Error checking for existing SDK dynamic IRs: ${s}`);return}}function mFo(e){return e.replace(/^https:\/\//,"")}async function Vbm({fdr:e,workspace:t,snippetsConfig:r,context:n}){let i={},o=[{language:"typescript",snippetName:r.typescriptSdk?.package??void 0,explicitVersion:r.typescriptSdk?.version??void 0},{language:"python",snippetName:r.pythonSdk?.package??void 0,explicitVersion:r.pythonSdk?.version??void 0},{language:"java",snippetName:r.javaSdk?.coordinate??void 0,explicitVersion:r.javaSdk?.version??void 0},{language:"go",snippetName:r.goSdk?.githubRepo&&mFo(r.goSdk?.githubRepo),explicitVersion:r.goSdk?.version??void 0},{language:"csharp",snippetName:r.csharpSdk?.package??void 0,explicitVersion:r.csharpSdk?.version??void 0},{language:"ruby",snippetName:r.rubySdk?.gem??void 0,explicitVersion:r.rubySdk?.version??void 0},{language:"php",snippetName:r.phpSdk?.package??void 0,explicitVersion:r.phpSdk?.version??void 0},{language:"swift",snippetName:r.swiftSdk?.package??void 0,explicitVersion:r.swiftSdk?.version??void 0},{language:"rust",snippetName:r.rustSdk?.package??void 0,explicitVersion:r.rustSdk?.version??void 0}];for(let s of o){if(!s.snippetName)continue;let a=s.explicitVersion??void 0;a||(a=(await qbm({fdr:e,workspace:t,language:s.language,snippetName:s.snippetName,context:n}))?.version),i[s.language]={packageName:s.snippetName,version:a},a||n.logger.debug(`[SDK Dynamic IR] ${s.language}: no version specified, will use latest`)}return i}async function qbm({fdr:e,workspace:t,language:r,snippetName:n,context:i}){let o;switch(r){case"csharp":o="Csharp";break;case"go":o="Go";break;case"java":o="Java";break;case"python":o="Python";break;case"ruby":o="Ruby";break;case"typescript":o="TypeScript";break;case"php":o="Php";break;case"swift":o="Swift";break;default:return}let s,a,c;if(t.generatorsConfiguration?.groups){let u=[];for(let l of t.generatorsConfiguration.groups)for(let p of l.generators)if(p.language===r){let d=Rn.getPackageName({generatorInvocation:p});d&&u.push(d),!a&&d&&(a=d,c=p.name,p.outputMode.type==="githubV2"&&(s=`${p.outputMode.githubV2.owner}/${p.outputMode.githubV2.repo}`))}}if(!a){i.logger.debug(`[SDK Dynamic IR] ${r}: no generator found with a package name`);return}try{let u=await e.sdks.computeSemanticVersion({githubRepository:s,language:o,package:a});return i.logger.debug(`[SDK Dynamic IR] ${r}: computed version ${u.version} for package "${a}"`),{version:u.version,generatorPackage:a}}catch(u){i.logger.debug(`[SDK Dynamic IR] ${r}: error computing version: ${u}`);return}}async function Gbm({workspace:e,organization:t,context:r,snippetsConfig:n,skipLanguages:i=new Set}){let o={};if(!e)return;let s={typescript:n.typescriptSdk?.package,python:n.pythonSdk?.package,java:n.javaSdk?.coordinate,go:n.goSdk?.githubRepo&&mFo(n.goSdk?.githubRepo),csharp:n.csharpSdk?.package,ruby:n.rubySdk?.gem,php:n.phpSdk?.package,swift:n.swiftSdk?.package,rust:n.rustSdk?.package};if(e.generatorsConfiguration?.groups)for(let a of e.generatorsConfiguration.groups)for(let c of a.generators){let u=Y6e({apiName:e.workspaceName??"",organization:t,generatorInvocation:c}),l="";if(u?.outputConfig.type==="publish")switch(u.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":l=u.outputConfig.value.packageName;break;case"maven":l=u.outputConfig.value.coordinate;break;case"go":l=u.outputConfig.value.repoUrl;break;case"swift":l=u.outputConfig.value.repoUrl;break;case"crates":l=u.outputConfig.value.packageName;break}if(c.language==="php"&&c.config&&typeof c.config=="object"&&"packageName"in c.config&&(l=c.config.packageName??""),c.language==="go"&&l&&(l=mFo(l)),!!c.language){if(i.has(c.language)){r.logger.debug(`Skipping dynamic IR generation for ${c.language} (using existing SDK dynamic IR)`);continue}if(c.language&&s[c.language]===l){let p=Sg({workspace:e,generationLanguage:c.language,keywords:void 0,smartCasing:c.smartCasing,exampleGeneration:{disabled:!0,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},audiences:{type:"all"},readme:void 0,packageName:l,version:void 0,context:r,sourceResolver:new Ih(r,e),dynamicGeneratorConfig:u}),d=DNe({ir:p,disableExamples:!0,smartCasing:c.smartCasing,generationLanguage:c.language,generatorConfig:u});d?o[c.language]={dynamicIR:d}:r.logger.debug(`Failed to create dynamic IR for ${c.language}`)}}}for(let[a,c]of Object.entries(s))a&&c&&!Object.keys(o).includes(a)&&!i.has(a)&&(r.logger.warn(),r.logger.warn(`Failed to upload ${a} SDK snippets because of unknown package \`${c}\`.`),r.logger.warn(`Please make sure your ${e.workspaceName?`${e.workspaceName}/`:""}generators.yml has a generator that publishes a ${c} package.`),r.logger.warn());if(Object.keys(o).length>0)return o}async function Wbm({dynamicIRs:e,dynamicIRUploadUrls:t,context:r,apiId:n}){if(Object.keys(t).length>0)for(let[i,o]of Object.entries(t)){let s=e[i]?.dynamicIR;if(s){let a=JSON.stringify(s);(await fetch(o.uploadUrl,{method:"PUT",body:a,headers:{"Content-Type":"application/octet-stream","Content-Length":Buffer.byteLength(a,"utf8").toString()}})).ok?r.logger.debug(`Uploaded dynamic IR for ${n}:${i}`):r.logger.warn(`Failed to upload dynamic IR for ${n}:${i}`)}else r.logger.warn(`Could not find matching dynamic IR to upload for ${n}:${i}`)}}async function $bm({docsDefinition:e,isPreview:t,context:r}){e.config.aiChatConfig==null||t||r.logger.warn(ve.yellow("Enabling Ask Fern from docs.yml is deprecated. Please enable it from the Fern dashboard instead."))}function Hbm(e,t){if(e)return{enabled:!0,model:process.env.FERN_AI_MODEL||"gpt-4o-mini",maxRetries:parseInt(process.env.FERN_AI_MAX_RETRIES||"3"),requestTimeoutMs:parseInt(process.env.FERN_AI_TIMEOUT_MS||"25000"),styleInstructions:t}}function Jtu(e){let t=e,r=t?.content;return{errorType:t?.error,statusCode:t?.statusCode??r?.statusCode,reason:r?.reason,errorMessage:r?.errorMessage??r?.message,body:r?.body,cause:r?.cause,rawError:e}}var Lzt=[60*1e3,300*1e3,300*1e3];async function Uzt({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:o,instanceUrl:s,preview:a,previewId:c,disableTemplates:u,skipUpload:l,cliVersion:p,ciSource:d,deployerAuthor:f,loginCommand:m}){let h=a&&!n.config.settings?.substituteEnvVars;n.config=YA(n.config,{onError:C=>i.failAndThrow(void 0,C,{code:N.Code.EnvironmentError})},{substituteAsEmpty:h});let A=n.config.instances;if(A.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.",void 0,{code:N.Code.ConfigError});return}if(A.length>1&&s==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${A[0]?.url})`,void 0,{code:N.Code.ConfigError});return}let b=A.find(C=>C.url===s)??A[0];if(b==null){i.failAndThrow(`No docs instance with url ${s}. Failed to register.`,void 0,{code:N.Code.ConfigError});return}let v=[];b.customDomain!=null&&(typeof b.customDomain=="string"?v.push(b.customDomain):Array.isArray(b.customDomain)&&v.push(...b.customDomain)),b.multiSource===!0&&Kbm(b.url,v,i),i.logger.info(`Starting docs publishing for ${a?"preview":"production"}: ${b.url}`),i.logger.debug(`Organization: ${e}, Preview: ${a}, APIs: ${t.length}, OSS: ${r.length}`);let w;return await i.runInteractiveTask({name:b.url},async()=>{let C=performance.now(),x=()=>$tu({docsWorkspace:n,customDomains:v,domain:b.url,token:o,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:a,previewId:c,editThisPage:b.editThisPage,disableTemplates:u,skipUpload:l,withAiExamples:n.config.aiExamples?.enabled??n.config.experimental?.aiExamples??!0,excludeApis:n.config.experimental?.excludeApis??!1,targetAudiences:b.audiences?Array.isArray(b.audiences)?b.audiences:[b.audiences]:void 0,docsUrl:b.url,cliVersion:p,ciSource:d,deployerAuthor:f,loginCommand:m,multiSource:b.multiSource??!1});for(let O=0;;O++)try{w=await x();break}catch(F){if(!(F instanceof Hht)||O>=Lzt.length){if(F instanceof Hht)return i.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.",void 0,{code:N.Code.NetworkError});throw F}let T=Lzt[O]??Lzt[Lzt.length-1]??6e4,L=T/6e4;i.logger.warn(`Another docs publish is in progress. Retrying in ${L} minute${L===1?"":"s"} (attempt ${O+1}/${Lzt.length})...`),await new Promise(K=>setTimeout(K,T))}let B=performance.now()-C;i.logger.debug(`Docs publishing completed in ${B.toFixed(0)}ms`)}),w}function Ytu(e){try{let t=e.startsWith("https://")||e.startsWith("http://")?e:`https://${e}`;return new URL(t).pathname}catch{return"/"}}function Kbm(e,t,r){let n=Ytu(e);for(let i of t){let o=Ytu(i);o!=="/"&&n!==o&&r.failAndThrow(`When multi-source is enabled, the url and custom-domain must share the same basepath. Instance url '${e}' has basepath '${n}' but custom-domain '${i}' has basepath '${o}'.`,void 0,{code:N.Code.ConfigError})}}var YGn=class{context;task;project;docsWorkspace;ossWorkspaces;token;constructor({context:t,task:r,project:n,docsWorkspace:i,ossWorkspaces:o,token:s}){this.context=t,this.task=r,this.project=n,this.docsWorkspace=i,this.ossWorkspaces=o,this.token=s}async publish({instanceUrl:t,preview:r,previewId:n,skipUpload:i}){let o=new Eh({context:this.context,task:this.task});try{let s=await Uzt({organization:this.project.config.organization,apiWorkspaces:this.project.apiWorkspaces,ossWorkspaces:this.ossWorkspaces,docsWorkspace:this.docsWorkspace,context:o,token:this.token,instanceUrl:t,preview:r,previewId:n,disableTemplates:void 0,skipUpload:i,cliVersion:"5.3.0",loginCommand:"fern auth login"});return o.getResult()===Df.Failure?{success:!1}:{success:!0,url:s}}catch(s){return{success:!1,error:Jn(s)}}}};jt();var Kht=class e{static MAX_DISPLAYED_LOGS_TTY=10;static URL_PATTERN=/https?:\/\/[^\s]+/;context;stream;tasks={};taskOrder=[];startTime;isRegistered=!1;constructor(t){this.context=t.context,this.stream=t.stream??process.stderr}addTask(t){let r={...t,status:t.status??"pending"};return this.tasks[t.id]=r,this.taskOrder.push(t.id),this}async start(t){return this.startTime=Date.now(),t!=null&&await this.context.ttyAwareLogger.takeOverTerminal(()=>{this.stream.write(`
|
|
3435
|
+
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`}function Lbm(e){if(e==null)return{code:void 0,message:void 0};let t=e.body;if(t!=null&&typeof t=="object"){let n=typeof t.code=="string"?t.code:void 0,i=typeof t.message=="string"?t.message:void 0;return{code:n,message:i}}return{code:void 0,message:typeof t=="string"&&t.length>0?t:typeof e.errorMessage=="string"?e.errorMessage:typeof e.message=="string"?e.message:void 0}}function Ubm(e){try{return new URL(g2(e)).pathname}catch{return}}async function zbm({fdr:e,workspace:t,organization:r,context:n,snippetsConfig:i}){if(!t)return;let o=await Vbm({fdr:e,workspace:t,snippetsConfig:i,context:n});if(Object.keys(o).length===0){n.logger.debug("[SDK Dynamic IR] No snippet configs found, skipping S3 check");return}try{let a=(await e.api.register.checkSdkDynamicIrExists({orgId:hn.OrgId(r),apiId:"",irVersions:[]})).existingDynamicIrs??{};if(Object.keys(a).length===0){n.logger.debug("[SDK Dynamic IR] No existing SDK dynamic IRs found in S3");return}let c={};for(let[u,l]of Object.entries(a??{}))try{n.logger.debug(`Downloading existing SDK dynamic IR for ${u}...`);let p=await fetch(l.downloadUrl);if(p.ok){let d=await p.json();c[u]={dynamicIR:d},n.logger.debug(`Successfully downloaded SDK dynamic IR for ${u}`)}else n.logger.warn(`Failed to download SDK dynamic IR for ${u}: ${p.status}`)}catch(p){n.logger.warn(`Error downloading SDK dynamic IR for ${u}: ${p}`)}return Object.keys(c).length>0?c:void 0}catch(s){n.logger.debug(`Error checking for existing SDK dynamic IRs: ${s}`);return}}function mFo(e){return e.replace(/^https:\/\//,"")}async function Vbm({fdr:e,workspace:t,snippetsConfig:r,context:n}){let i={},o=[{language:"typescript",snippetName:r.typescriptSdk?.package??void 0,explicitVersion:r.typescriptSdk?.version??void 0},{language:"python",snippetName:r.pythonSdk?.package??void 0,explicitVersion:r.pythonSdk?.version??void 0},{language:"java",snippetName:r.javaSdk?.coordinate??void 0,explicitVersion:r.javaSdk?.version??void 0},{language:"go",snippetName:r.goSdk?.githubRepo&&mFo(r.goSdk?.githubRepo),explicitVersion:r.goSdk?.version??void 0},{language:"csharp",snippetName:r.csharpSdk?.package??void 0,explicitVersion:r.csharpSdk?.version??void 0},{language:"ruby",snippetName:r.rubySdk?.gem??void 0,explicitVersion:r.rubySdk?.version??void 0},{language:"php",snippetName:r.phpSdk?.package??void 0,explicitVersion:r.phpSdk?.version??void 0},{language:"swift",snippetName:r.swiftSdk?.package??void 0,explicitVersion:r.swiftSdk?.version??void 0},{language:"rust",snippetName:r.rustSdk?.package??void 0,explicitVersion:r.rustSdk?.version??void 0}];for(let s of o){if(!s.snippetName)continue;let a=s.explicitVersion??void 0;a||(a=(await qbm({fdr:e,workspace:t,language:s.language,snippetName:s.snippetName,context:n}))?.version),i[s.language]={packageName:s.snippetName,version:a},a||n.logger.debug(`[SDK Dynamic IR] ${s.language}: no version specified, will use latest`)}return i}async function qbm({fdr:e,workspace:t,language:r,snippetName:n,context:i}){let o;switch(r){case"csharp":o="Csharp";break;case"go":o="Go";break;case"java":o="Java";break;case"python":o="Python";break;case"ruby":o="Ruby";break;case"typescript":o="TypeScript";break;case"php":o="Php";break;case"swift":o="Swift";break;default:return}let s,a,c;if(t.generatorsConfiguration?.groups){let u=[];for(let l of t.generatorsConfiguration.groups)for(let p of l.generators)if(p.language===r){let d=Rn.getPackageName({generatorInvocation:p});d&&u.push(d),!a&&d&&(a=d,c=p.name,p.outputMode.type==="githubV2"&&(s=`${p.outputMode.githubV2.owner}/${p.outputMode.githubV2.repo}`))}}if(!a){i.logger.debug(`[SDK Dynamic IR] ${r}: no generator found with a package name`);return}try{let u=await e.sdks.computeSemanticVersion({githubRepository:s,language:o,package:a});return i.logger.debug(`[SDK Dynamic IR] ${r}: computed version ${u.version} for package "${a}"`),{version:u.version,generatorPackage:a}}catch(u){i.logger.debug(`[SDK Dynamic IR] ${r}: error computing version: ${u}`);return}}async function Gbm({workspace:e,organization:t,context:r,snippetsConfig:n,skipLanguages:i=new Set}){let o={};if(!e)return;let s={typescript:n.typescriptSdk?.package,python:n.pythonSdk?.package,java:n.javaSdk?.coordinate,go:n.goSdk?.githubRepo&&mFo(n.goSdk?.githubRepo),csharp:n.csharpSdk?.package,ruby:n.rubySdk?.gem,php:n.phpSdk?.package,swift:n.swiftSdk?.package,rust:n.rustSdk?.package};if(e.generatorsConfiguration?.groups)for(let a of e.generatorsConfiguration.groups)for(let c of a.generators){let u=Y6e({apiName:e.workspaceName??"",organization:t,generatorInvocation:c}),l="";if(u?.outputConfig.type==="publish")switch(u.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":l=u.outputConfig.value.packageName;break;case"maven":l=u.outputConfig.value.coordinate;break;case"go":l=u.outputConfig.value.repoUrl;break;case"swift":l=u.outputConfig.value.repoUrl;break;case"crates":l=u.outputConfig.value.packageName;break}if(c.language==="php"&&c.config&&typeof c.config=="object"&&"packageName"in c.config&&(l=c.config.packageName??""),c.language==="go"&&l&&(l=mFo(l)),!!c.language){if(i.has(c.language)){r.logger.debug(`Skipping dynamic IR generation for ${c.language} (using existing SDK dynamic IR)`);continue}if(c.language&&s[c.language]===l){let p=Sg({workspace:e,generationLanguage:c.language,keywords:void 0,smartCasing:c.smartCasing,exampleGeneration:{disabled:!0,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},audiences:{type:"all"},readme:void 0,packageName:l,version:void 0,context:r,sourceResolver:new Ih(r,e),dynamicGeneratorConfig:u}),d=DNe({ir:p,disableExamples:!0,smartCasing:c.smartCasing,generationLanguage:c.language,generatorConfig:u});d?o[c.language]={dynamicIR:d}:r.logger.debug(`Failed to create dynamic IR for ${c.language}`)}}}for(let[a,c]of Object.entries(s))a&&c&&!Object.keys(o).includes(a)&&!i.has(a)&&(r.logger.warn(),r.logger.warn(`Failed to upload ${a} SDK snippets because of unknown package \`${c}\`.`),r.logger.warn(`Please make sure your ${e.workspaceName?`${e.workspaceName}/`:""}generators.yml has a generator that publishes a ${c} package.`),r.logger.warn());if(Object.keys(o).length>0)return o}async function Wbm({dynamicIRs:e,dynamicIRUploadUrls:t,context:r,apiId:n}){if(Object.keys(t).length>0)for(let[i,o]of Object.entries(t)){let s=e[i]?.dynamicIR;if(s){let a=JSON.stringify(s);(await fetch(o.uploadUrl,{method:"PUT",body:a,headers:{"Content-Type":"application/octet-stream","Content-Length":Buffer.byteLength(a,"utf8").toString()}})).ok?r.logger.debug(`Uploaded dynamic IR for ${n}:${i}`):r.logger.warn(`Failed to upload dynamic IR for ${n}:${i}`)}else r.logger.warn(`Could not find matching dynamic IR to upload for ${n}:${i}`)}}async function $bm({docsDefinition:e,isPreview:t,context:r}){e.config.aiChatConfig==null||t||r.logger.warn(ve.yellow("Enabling Ask Fern from docs.yml is deprecated. Please enable it from the Fern dashboard instead."))}function Hbm(e,t){if(e)return{enabled:!0,model:process.env.FERN_AI_MODEL||"gpt-4o-mini",maxRetries:parseInt(process.env.FERN_AI_MAX_RETRIES||"3"),requestTimeoutMs:parseInt(process.env.FERN_AI_TIMEOUT_MS||"25000"),styleInstructions:t}}function Jtu(e){let t=e,r=t?.content;return{errorType:t?.error,statusCode:t?.statusCode??r?.statusCode,reason:r?.reason,errorMessage:r?.errorMessage??r?.message,body:r?.body,cause:r?.cause,rawError:e}}var Lzt=[60*1e3,300*1e3,300*1e3];async function Uzt({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:o,instanceUrl:s,preview:a,previewId:c,disableTemplates:u,skipUpload:l,cliVersion:p,ciSource:d,deployerAuthor:f,loginCommand:m}){let h=a&&!n.config.settings?.substituteEnvVars;n.config=YA(n.config,{onError:C=>i.failAndThrow(void 0,C,{code:N.Code.EnvironmentError})},{substituteAsEmpty:h});let A=n.config.instances;if(A.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.",void 0,{code:N.Code.ConfigError});return}if(A.length>1&&s==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${A[0]?.url})`,void 0,{code:N.Code.ConfigError});return}let b=A.find(C=>C.url===s)??A[0];if(b==null){i.failAndThrow(`No docs instance with url ${s}. Failed to register.`,void 0,{code:N.Code.ConfigError});return}let v=[];b.customDomain!=null&&(typeof b.customDomain=="string"?v.push(b.customDomain):Array.isArray(b.customDomain)&&v.push(...b.customDomain)),b.multiSource===!0&&Kbm(b.url,v,i),i.logger.info(`Starting docs publishing for ${a?"preview":"production"}: ${b.url}`),i.logger.debug(`Organization: ${e}, Preview: ${a}, APIs: ${t.length}, OSS: ${r.length}`);let w;return await i.runInteractiveTask({name:b.url},async()=>{let C=performance.now(),x=()=>$tu({docsWorkspace:n,customDomains:v,domain:b.url,token:o,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:a,previewId:c,editThisPage:b.editThisPage,disableTemplates:u,skipUpload:l,withAiExamples:n.config.aiExamples?.enabled??n.config.experimental?.aiExamples??!0,excludeApis:n.config.experimental?.excludeApis??!1,targetAudiences:b.audiences?Array.isArray(b.audiences)?b.audiences:[b.audiences]:void 0,docsUrl:b.url,cliVersion:p,ciSource:d,deployerAuthor:f,loginCommand:m,multiSource:b.multiSource??!1});for(let O=0;;O++)try{w=await x();break}catch(F){if(!(F instanceof Hht)||O>=Lzt.length){if(F instanceof Hht)return i.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.",void 0,{code:N.Code.NetworkError});throw F}let T=Lzt[O]??Lzt[Lzt.length-1]??6e4,L=T/6e4;i.logger.warn(`Another docs publish is in progress. Retrying in ${L} minute${L===1?"":"s"} (attempt ${O+1}/${Lzt.length})...`),await new Promise(K=>setTimeout(K,T))}let B=performance.now()-C;i.logger.debug(`Docs publishing completed in ${B.toFixed(0)}ms`)}),w}function Ytu(e){try{let t=e.startsWith("https://")||e.startsWith("http://")?e:`https://${e}`;return new URL(t).pathname}catch{return"/"}}function Kbm(e,t,r){let n=Ytu(e);for(let i of t){let o=Ytu(i);o!=="/"&&n!==o&&r.failAndThrow(`When multi-source is enabled, the url and custom-domain must share the same basepath. Instance url '${e}' has basepath '${n}' but custom-domain '${i}' has basepath '${o}'.`,void 0,{code:N.Code.ConfigError})}}var YGn=class{context;task;project;docsWorkspace;ossWorkspaces;token;constructor({context:t,task:r,project:n,docsWorkspace:i,ossWorkspaces:o,token:s}){this.context=t,this.task=r,this.project=n,this.docsWorkspace=i,this.ossWorkspaces=o,this.token=s}async publish({instanceUrl:t,preview:r,previewId:n,skipUpload:i}){let o=new Eh({context:this.context,task:this.task});try{let s=await Uzt({organization:this.project.config.organization,apiWorkspaces:this.project.apiWorkspaces,ossWorkspaces:this.ossWorkspaces,docsWorkspace:this.docsWorkspace,context:o,token:this.token,instanceUrl:t,preview:r,previewId:n,disableTemplates:void 0,skipUpload:i,cliVersion:"5.4.0",loginCommand:"fern auth login"});return o.getResult()===Df.Failure?{success:!1}:{success:!0,url:s}}catch(s){return{success:!1,error:Jn(s)}}}};jt();var Kht=class e{static MAX_DISPLAYED_LOGS_TTY=10;static URL_PATTERN=/https?:\/\/[^\s]+/;context;stream;tasks={};taskOrder=[];startTime;isRegistered=!1;constructor(t){this.context=t.context,this.stream=t.stream??process.stderr}addTask(t){let r={...t,status:t.status??"pending"};return this.tasks[t.id]=r,this.taskOrder.push(t.id),this}async start(t){return this.startTime=Date.now(),t!=null&&await this.context.ttyAwareLogger.takeOverTerminal(()=>{this.stream.write(`
|
|
3436
3436
|
`),this.stream.write(`${ve.cyan("\u25C6")} ${ve.bold(t.title)}
|
|
3437
3437
|
`),t.subtitle!=null&&this.stream.write(` ${ve.dim(t.subtitle)}
|
|
3438
3438
|
`),this.stream.write(`
|
|
@@ -4108,7 +4108,7 @@ For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides
|
|
|
4108
4108
|
Run ${ve.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
|
|
4109
4109
|
Run ${ve.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),Stt(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function Rns({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!n6u(e))return;let i=t??"",o=e.filter(a=>a.isUpgradeAvailable);r!=null&&(o=o.slice(0,r+1));let s=o.sort((a,c)=>a.generatorName.localeCompare(c.generatorName)||a.currentVersion.localeCompare(c.currentVersion));for(let a of s)i+=`
|
|
4110
4110
|
${await ljh(a.generatorName)} (${a.apiName!=null?"API: "+a.apiName+", ":""}Group: ${a.generatorGroup}) `+ve.dim(a.currentVersion)+ve.reset(" \u2192 ")+ve.green(a.latestVersion);return i+=`
|
|
4111
|
-
`,n?Stt(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function ljh(e){let r=await new r6u.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new N({message:`Generator ${e} not found`,code:N.Code.ConfigError});return r.body.displayName}async function pjh({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){if(t.length===1){let a={type:"singleApi",versions:{}};return await o6u({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,u,l,p)=>{a.versions[u]==null&&(a.versions[u]={});let d=Xke(l.name);if(d==null){p.logger.debug(`Skipping unknown generator: ${l.name}`);return}let f=await KO({generatorName:d,cliVersion:e.environment.packageVersion,currentGeneratorVersion:l.version,channel:i,includeMajor:o,context:p});f!=null&&(a.versions[u][l.name]={previousVersion:l.version,latestVersion:f})},generatorFilter:r,groupFilter:n}),a}let s={type:"multiApi",versions:{}};return await o6u({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(a,c,u,l)=>{if(a==null)return;s.versions[a]==null&&(s.versions[a]={}),s.versions[a][c]==null&&(s.versions[a][c]={});let p=Xke(u.name);if(p==null){l.logger.debug(`Skipping unknown generator: ${u.name}`);return}let d=await KO({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:o,context:l});d!=null&&(s.versions[a][c][u.name]={previousVersion:u.version,latestVersion:d})},generatorFilter:r,groupFilter:n}),s}async function o6u({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async s=>{let a=await O6({absolutePathToWorkspace:o.absoluteFilePath,context:s});if(a==null||a.groups==null)return;let c=n!=null?cE(n):void 0;for(let u of a.groups)if(!(i!=null&&u.groupName!==i))for(let l of u.generators)c!=null&&l.name!==c||await r(o.workspaceName,u.groupName,l,s)})}))}function s6u(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[s,a]of Object.entries(o)){r.debug(`Checking if ${s} in group ${i} has an upgrade available...`);let c;try{c=DN(a.latestVersion,a.previousVersion)}catch{throw new N({message:`Generator "${s}" has an invalid version "${a.previousVersion}" in generators.yml. Use an exact version like 1.2.3.`,code:N.Code.ConfigError})}r.debug(`Latest version: ${a.latestVersion}. `+(c?"Upgrade available.":"No upgrade available.")),n.push({generatorName:s,generatorGroup:i,apiName:t,isUpgradeAvailable:c,currentVersion:a.previousVersion,latestVersion:a.latestVersion})}return n}async function lii({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let s=[];if(e!=null){let a=await pjh({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(a.type==="multiApi")for(let[c,u]of Object.entries(a.versions))s.push(...s6u(u,c,t.logger));else s.push(...s6u(a.versions,void 0,t.logger))}return s}async function yde({cliEnvironment:e,includePreReleases:t=!1}){if(e.packageName!=="fern-api"||e.packageVersion==="0.0.0")return e.packageVersion;try{return await A1t(e.packageName,{version:t?"prerelease":"latest"})}catch(r){throw new N({message:`Failed to resolve latest CLI version: ${r instanceof Error?r.message:String(r)}`,code:N.Code.NetworkError})}}var a6u=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],pii=class e{environment;sentryClient;posthogManager;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Kn.Info;isLocal;stdoutRedirector=new uii;jsonMode=!1;static async create(t,r,{isLocal:n}){let i=await j6t();return new e(t,r,{isLocal:n,posthogManager:i})}constructor(t,r,{isLocal:n,posthogManager:i}){this.ttyAwareLogger=new qkt(t,r),this.isLocal=n??!1,this.posthogManager=i;let o=this.getPackageName(),s=this.getPackageVersion(),a=this.getCliName();(o==null||s==null||a==null)&&this.exitProgram(),this.environment={packageName:o,packageVersion:s,cliName:a},this.sentryClient=new cii({release:`cli@${this.environment.packageVersion}`})}getPackageName(){return"fern-api"}getPackageVersion(){return"5.
|
|
4111
|
+
`,n?Stt(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function ljh(e){let r=await new r6u.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new N({message:`Generator ${e} not found`,code:N.Code.ConfigError});return r.body.displayName}async function pjh({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){if(t.length===1){let a={type:"singleApi",versions:{}};return await o6u({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,u,l,p)=>{a.versions[u]==null&&(a.versions[u]={});let d=Xke(l.name);if(d==null){p.logger.debug(`Skipping unknown generator: ${l.name}`);return}let f=await KO({generatorName:d,cliVersion:e.environment.packageVersion,currentGeneratorVersion:l.version,channel:i,includeMajor:o,context:p});f!=null&&(a.versions[u][l.name]={previousVersion:l.version,latestVersion:f})},generatorFilter:r,groupFilter:n}),a}let s={type:"multiApi",versions:{}};return await o6u({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(a,c,u,l)=>{if(a==null)return;s.versions[a]==null&&(s.versions[a]={}),s.versions[a][c]==null&&(s.versions[a][c]={});let p=Xke(u.name);if(p==null){l.logger.debug(`Skipping unknown generator: ${u.name}`);return}let d=await KO({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:o,context:l});d!=null&&(s.versions[a][c][u.name]={previousVersion:u.version,latestVersion:d})},generatorFilter:r,groupFilter:n}),s}async function o6u({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async s=>{let a=await O6({absolutePathToWorkspace:o.absoluteFilePath,context:s});if(a==null||a.groups==null)return;let c=n!=null?cE(n):void 0;for(let u of a.groups)if(!(i!=null&&u.groupName!==i))for(let l of u.generators)c!=null&&l.name!==c||await r(o.workspaceName,u.groupName,l,s)})}))}function s6u(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[s,a]of Object.entries(o)){r.debug(`Checking if ${s} in group ${i} has an upgrade available...`);let c;try{c=DN(a.latestVersion,a.previousVersion)}catch{throw new N({message:`Generator "${s}" has an invalid version "${a.previousVersion}" in generators.yml. Use an exact version like 1.2.3.`,code:N.Code.ConfigError})}r.debug(`Latest version: ${a.latestVersion}. `+(c?"Upgrade available.":"No upgrade available.")),n.push({generatorName:s,generatorGroup:i,apiName:t,isUpgradeAvailable:c,currentVersion:a.previousVersion,latestVersion:a.latestVersion})}return n}async function lii({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let s=[];if(e!=null){let a=await pjh({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(a.type==="multiApi")for(let[c,u]of Object.entries(a.versions))s.push(...s6u(u,c,t.logger));else s.push(...s6u(a.versions,void 0,t.logger))}return s}async function yde({cliEnvironment:e,includePreReleases:t=!1}){if(e.packageName!=="fern-api"||e.packageVersion==="0.0.0")return e.packageVersion;try{return await A1t(e.packageName,{version:t?"prerelease":"latest"})}catch(r){throw new N({message:`Failed to resolve latest CLI version: ${r instanceof Error?r.message:String(r)}`,code:N.Code.NetworkError})}}var a6u=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],pii=class e{environment;sentryClient;posthogManager;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Kn.Info;isLocal;stdoutRedirector=new uii;jsonMode=!1;static async create(t,r,{isLocal:n}){let i=await j6t();return new e(t,r,{isLocal:n,posthogManager:i})}constructor(t,r,{isLocal:n,posthogManager:i}){this.ttyAwareLogger=new qkt(t,r),this.isLocal=n??!1,this.posthogManager=i;let o=this.getPackageName(),s=this.getPackageVersion(),a=this.getCliName();(o==null||s==null||a==null)&&this.exitProgram(),this.environment={packageName:o,packageVersion:s,cliName:a},this.sentryClient=new cii({release:`cli@${this.environment.packageVersion}`})}getPackageName(){return"fern-api"}getPackageVersion(){return"5.4.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${ve.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r,n){throw this.failWithoutThrowing(t,r,n),new au}failWithoutThrowing(t,r,n){this.didSucceed=!1,!(r instanceof au)&&(Skt({message:t,error:r,logger:this.logger}),aii(this,r,{...n,message:t}))}enableJsonMode(){this.jsonMode||(this.jsonMode=!0,this.stdoutRedirector.redirect())}get isJsonMode(){return this.jsonMode}writeJsonToStdout(t){this.stdoutRedirector.restore(),process.stdout.write(JSON.stringify(t,null,2)+`
|
|
4112
4112
|
`),this.jsonMode&&this.stdoutRedirector.redirect()}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish();try{await this.posthogManager.flush()}catch{}await this.sentryClient.flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await i6u({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
4113
4113
|
`)||(r+=`
|
|
4114
4114
|
`),this.stderr.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram({code:t}={}){process.exit(t??(this.didSucceed?0:1))}longestWorkspaceName;registerWorkspaces(t){let r=tyi(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new N7t(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(o){throw n.failWithoutThrowing(void 0,o),new au}finally{n.finish()}return i}instrumentPostHogEvent(t){this.isLocal||this.posthogManager.sendEvent(t)}captureException(t,r){this.sentryClient.captureException(t,r)}logger=z1((t,...r)=>this.log(t,...r));stderr=z1((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=t.type==="docs"?"docs":t.workspaceName??"api",n=c6u(r),i=1+(this.longestWorkspaceName!=null?c6u(this.longestWorkspaceName):n).length,o=n.padEnd(i),s=a6u[this.numTasks++%a6u.length],a=ve.hex(s)(o);return{...this.constructTaskInit(),logPrefix:a,title:ve.hex(s).bold(r)}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===Df.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:t=>{this.instrumentPostHogEvent(t)},shouldBufferLogs:!1,captureException:(t,r)=>{this.sentryClient.captureException(t,r)}}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let n=t.filter(i=>tS.indexOf(i.level)>=tS.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===Kn.Debug,stderr:r||this.jsonMode})}_suppressUpgradeMessage=!1;suppressUpgradeMessage(){this._suppressUpgradeMessage=!0}_isUpgradeAvailable;async isUpgradeAvailable({includePreReleases:t=!1}={}){if(this._isUpgradeAvailable==null){this.logger.debug(`Checking if ${this.environment.packageName} upgrade is available...`);let r=await yde({cliEnvironment:this.environment,includePreReleases:t}),n=DN(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},o=await lii({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:o}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){try{return await Pns({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r,theme:{prefix:ve.yellow("?"),style:{answer:i=>ve.cyan(i),message:i=>ve.bold(i),highlight:i=>ve.cyan(i)}}})}catch(n){throw n?.name==="ExitPromptError"?(this.logger.info(`
|