@fern-api/csharp-dynamic-snippets 2.76.6 → 2.77.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/dist/index.js CHANGED
@@ -2,7 +2,7 @@ var hc=Object.defineProperty;var yd=(e,t,r)=>t in e?hc(e,t,{enumerable:!0,config
2
2
  `).map(A=>{let I=A.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(I&&I.length===5){let[,P,L,R,F]=I;if(!P||!L||!R||!F)return;if(w||o.some(U=>P?.includes(U))){w=!0;return}switch(P){case"Object.<anonymous>":P="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":P=`${P.substring(P.indexOf(".")+1)}()=> { ... }`;break}return{fn:P,path:b(L),position:`${R}:${F}`}}}).filter(A=>A&&!i.some(I=>A.fn.includes(I))&&!(c&&A.path?.startsWith("node:"))&&!(l&&A.path?.endsWith(".js"))&&!r.some(I=>A.path.includes(I))).slice(t,t+e)}function Ui({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:i=[],stopOn:o=["runInteractiveTask"],filterNode:c=!0,filterJs:l=!0,multiline:b=!1,formatFilename:w=A=>A}={}){return je?`${Di({maxFrames:e,skip:t,filterPaths:r,filterFunctions:i,stopOn:o,filterNode:c,filterJs:l,formatFilename:w}).map(A=>`${b?`
3
3
  `:" > "}${A.fn} - ${A.path}:${A.position}`).join("")}`:""}var Gn=class{constructor({maxFrames:t=50,skip:r=0,filterPaths:i=[],filterFunctions:o=[],stopOn:c=[],filterNode:l=!0,filterJs:b=!0,multiline:w=!1,formatFilename:A=I=>I}={}){y(this,"maxFrames");y(this,"skip");y(this,"filterPaths");y(this,"filterFunctions");y(this,"stopOn");y(this,"filterNode");y(this,"filterJs");y(this,"multiline");y(this,"formatFilename");y(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=r,this.filterPaths=i,this.filterFunctions=o,this.stopOn=c,this.filterNode=l,this.filterJs=b,this.multiline=w,this.formatFilename=A}tag(t){let r=this.tracking.get(t)||new Set;Di({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(i=>r.add(i)),this.tracking.set(t,r)}trace(t){if(!je)return"";let r=this.tracking.get(t);return r?[...r].map(i=>`${this.multiline?`
4
4
  `:""}${i.fn} - ${i.path}:${i.position}`).join(""):""}frames(t){let r=this.tracking.get(t);return r?[...r]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},Vo;function Ul({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:i=[],stopOn:o=[],filterNode:c=!0,filterJs:l=!0,multiline:b=!1,formatFilename:w=A=>A}={}){je&&(Vo??(Vo=new Gn({maxFrames:e,skip:t,filterPaths:r,filterFunctions:i,stopOn:o,filterNode:c,filterJs:l,multiline:b,formatFilename:w})))}function Ml(e){Vo?.tag(e)}function Mi(e){return Vo?.frames(e)??[]}var ut=class{constructor(){Ml(this)}};n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var u0="__package__",m2=`${u0}.yml`;var vl="default-group",Vl="spec-origin",zl="async-api",ql="openapi",Gl="openapi-overrides",Wl="api-settings";var $l="local";var Ge={};q(Ge,{API_ORIGIN_LOCATION_KEY:()=>Vl,API_SETTINGS_KEY:()=>Wl,ASYNC_API_LOCATION_KEY:()=>zl,CoerceConstsTo:()=>cf,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>vl,DEFAULT_GROUP_NAME:()=>$l,DefaultIntegerFormat:()=>pf,ExampleStyle:()=>lf,FormParameterEncoding:()=>ff,GenerationLanguage:()=>Hl,GithubCommitAndReleaseMode:()=>xf,GithubLicenseType:()=>wf,GithubSelfhostedMode:()=>Sf,Language:()=>mf,MessageNamingSettingsSchema:()=>df,ModelProvider:()=>Yl,MultiServerStrategy:()=>hf,OPENAPI_LOCATION_KEY:()=>ql,OPENAPI_OVERRIDES_LOCATION_KEY:()=>Gl,PathParameterOrder:()=>yf,RemoveDiscriminantsFromSchemas:()=>gf,UnionSettingsSchema:()=>bf,ai:()=>zo,automation:()=>Xl,fernDefinition:()=>Go,generators:()=>Wo,getPackageName:()=>Jl,group:()=>$o,isApiConfigurationV2Schema:()=>Xf,isAsyncApiSpecSchema:()=>Zf,isConjureSchema:()=>em,isGraphQLSpecSchema:()=>tm,isNamespacedApiConfiguration:()=>rm,isOpenApiSpecSchema:()=>im,isOpenRpcSpecSchema:()=>nm,isProtoSpecSchema:()=>sm,isRawProtobufAPIDefinitionSchema:()=>Kl,license:()=>Ho,replay:()=>Tf,resolveAutomationConfig:()=>Ql,reviewers:()=>Ef,serialization:()=>yu});n();a();s();n();a();s();var Hl={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function Jl({generatorInvocation:e}){return e.language==="go"?c0(e):e.outputMode._visit({downloadFiles:()=>{},github:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),githubV2:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),publish:()=>{},publishV2:()=>{},_other:()=>{}})}function c0(e){return e.outputMode._visit({downloadFiles:()=>{},github:t=>`github.com/${t.owner}/${t.repo}`,githubV2:t=>`github.com/${t.owner}/${t.repo}`,publish:()=>{},publishV2:()=>{},_other:()=>{}})}n();a();s();function Kl(e){return typeof e!="string"&&"proto"in e}n();a();s();var Wn={generate:!0,upgrade:!0,preview:!0,verify:!0};function Ql({rootAutomation:e,groupAutomation:t,generatorAutomation:r}){return{generate:r?.generate??t?.generate??e?.generate??Wn.generate,upgrade:r?.upgrade??t?.upgrade??e?.upgrade??Wn.upgrade,preview:r?.preview??t?.preview??e?.preview??Wn.preview,verify:r?.verify??t?.verify??e?.verify??Wn.verify}}n();a();s();n();a();s();var zo={};q(zo,{ModelProvider:()=>Yl});n();a();s();n();a();s();var Yl={Openai:"openai",Anthropic:"anthropic",AwsBedrock:"aws-bedrock"};var Xl={};n();a();s();var Go={};q(Go,{AvailabilityStatusSchema:()=>ef,auth:()=>Zl,availability:()=>qo,commons:()=>tf,encoding:()=>rf,environments:()=>nf,file:()=>sf,service:()=>af,types:()=>of,validation:()=>uf});n();a();s();n();a();s();var Zl={};n();a();s();var qo={};q(qo,{AvailabilityStatusSchema:()=>ef});n();a();s();n();a();s();var ef={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var tf={};n();a();s();var rf={};n();a();s();var nf={};n();a();s();var sf={};n();a();s();var af={};n();a();s();var of={};n();a();s();var uf={};n();a();s();var Wo={};q(Wo,{CoerceConstsTo:()=>cf,DefaultIntegerFormat:()=>pf,ExampleStyle:()=>lf,FormParameterEncoding:()=>ff,Language:()=>mf,MessageNamingSettingsSchema:()=>df,MultiServerStrategy:()=>hf,PathParameterOrder:()=>yf,RemoveDiscriminantsFromSchemas:()=>gf,UnionSettingsSchema:()=>bf});n();a();s();n();a();s();var cf={Literals:"literals",Enums:"enums",EnumsCoerceableToLiterals:"enums-coerceable-to-literals"};n();a();s();var pf={Int32:"int32",Int64:"int64",Uint32:"uint32",Uint64:"uint64"};n();a();s();var lf={Minimal:"minimal",Comprehensive:"comprehensive"};n();a();s();var ff={Form:"form",Json:"json"};n();a();s();var mf={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};n();a();s();var df={V1:"v1",V2:"v2"};n();a();s();var hf={EnvironmentPerServer:"environment-per-server",UrlsPerEnvironment:"urls-per-environment"};n();a();s();var yf={UrlOrder:"url-order",SpecOrder:"spec-order"};n();a();s();var gf={Always:"always",Never:"never"};n();a();s();var bf={V1:"v1"};var $o={};q($o,{GithubCommitAndReleaseMode:()=>xf,GithubSelfhostedMode:()=>Sf});n();a();s();n();a();s();var xf={Commit:"commit",Release:"release"};n();a();s();var Sf={PullRequest:"pull-request",Push:"push",CommitAndRelease:"commit-and-release"};var Ho={};q(Ho,{GithubLicenseType:()=>wf});n();a();s();n();a();s();var wf={Mit:"MIT",Apache:"Apache-2.0"};var Tf={};n();a();s();var Ef={};n();a();s();var yu={};q(yu,{AiServicesSchema:()=>Xn,ApiConfigurationSchema:()=>sa,ApiConfigurationSchemaInternal:()=>Pr,ApiConfigurationV2Schema:()=>ia,ApiConfigurationV2SettingsSchema:()=>kr,ApiConfigurationV2SpecsSchema:()=>Fr,ApiDefinitionList:()=>zs,ApiDefinitionPathSchema:()=>It,ApiDefinitionSchema:()=>Vs,ApiDefinitionSettingsSchema:()=>Ir,ApiDefinitionWithOverridesSchema:()=>Nr,AsyncApiSettingsSchema:()=>_r,AsyncApiSpecSchema:()=>Ys,AutomationSchema:()=>wt,BaseApiSettingsSchema:()=>Cr,BaseGeneratorInvocationSchema:()=>Lr,CoerceConstsTo:()=>qs,ConjureSchema:()=>Qs,CratesOutputLocationSchema:()=>pa,CustomGeneratorInvocationSchema:()=>_a,DefaultGeneratorInvocationSchema:()=>ka,DefaultIntegerFormat:()=>Gs,ExampleStyle:()=>aa,FormParameterEncoding:()=>Ws,GeneratorApiSettingsSchema:()=>ca,GeneratorGroupSchema:()=>La,GeneratorImageObjectSchema:()=>oa,GeneratorInvocationSchema:()=>Fa,GeneratorOutputSchema:()=>Sa,GeneratorPublishMetadataSchema:()=>Gi,GeneratorSnippetsSchema:()=>Ea,GeneratorsConfigurationSchema:()=>Yf,GeneratorsOpenApiObjectSchema:()=>Ba,GeneratorsOpenApiSchema:()=>Da,GitRemoteSchema:()=>Ms,GithubCommitAndReleaseMode:()=>Aa,GithubCommitAndReleaseSchema:()=>Ia,GithubConfigurationSchema:()=>Ca,GithubLicenseCustomSchema:()=>wa,GithubLicenseSchema:()=>qe,GithubLicenseType:()=>Ta,GithubPullRequestSchema:()=>Na,GithubPushSchema:()=>Ra,GithubSelfhostedMode:()=>Oa,GithubSelfhostedSchema:()=>Pa,GraphQlSpecSchema:()=>Xs,Language:()=>Ua,LocalFileSystemOutputLocationSchema:()=>la,MavenOutputLocationSchema:()=>ma,MavenOutputSignatureSchema:()=>fa,MessageNamingSettingsSchema:()=>wr,ModelName:()=>Qn,ModelProvider:()=>Yn,MultiServerStrategy:()=>Tr,NamespacedApiConfigurationSchema:()=>na,NpmOutputLocationSchema:()=>da,NugetOutputLocationSchema:()=>ha,OpenApiExampleGenerationSchema:()=>$s,OpenApiFilterSchema:()=>Hs,OpenApiSettingsSchema:()=>Rt,OpenApiSpecSchema:()=>Zs,OpenRpcSpecSchema:()=>ea,OutputMetadataAuthor:()=>ua,OutputMetadataSchema:()=>Ot,OverridesSchema:()=>ze,PathParameterOrder:()=>Er,PostmanOutputLocationSchema:()=>ya,ProtobufApiDefinitionSchema:()=>Or,ProtobufDefinitionSchema:()=>Rr,ProtobufSpecSchema:()=>ta,PypiOutputLocationSchema:()=>ba,PypiOutputMetadataSchema:()=>ga,ReadmeCustomSectionSchema:()=>Ma,ReadmeEndpointObjectSchema:()=>va,ReadmeEndpointSchema:()=>Wi,ReadmeSchema:()=>Va,RemoveDiscriminantsFromSchemas:()=>Ar,ReplayConfigSchema:()=>ja,RequestOrResponseExampleGenerationSchema:()=>zi,ResolveAliases:()=>Ks,ResolveAliasesSchema:()=>Js,ReviewerSchema:()=>qi,ReviewersSchema:()=>Pt,RubyGemsOutputLocationSchema:()=>xa,SpecGitSourceSchema:()=>vs,SpecSchema:()=>ra,SpecSourceSchema:()=>Nt,UnionSettingsSchema:()=>Us,WhitelabelConfigurationSchema:()=>qa,WhitelabelGithubConfigurationSchema:()=>za,ai:()=>Zo,automation:()=>eu,fernDefinition:()=>pu,generators:()=>lu,group:()=>fu,license:()=>mu,replay:()=>du,reviewers:()=>hu});n();a();s();n();a();s();var Zo={};q(Zo,{AiServicesSchema:()=>Xn,ModelName:()=>Qn,ModelProvider:()=>Yn});n();a();s();n();a();s();n();a();s();var p={};q(p,{JsonError:()=>fr,ParseError:()=>mr,any:()=>Df,bigint:()=>If,boolean:()=>Uf,booleanLiteral:()=>jf,date:()=>Nf,discriminant:()=>Jf,enum_:()=>Hn,getObjectLikeUtils:()=>Je,getObjectUtils:()=>Jt,getSchemaUtils:()=>ae,isProperty:()=>pt,lazy:()=>Rf,lazyObject:()=>Ff,list:()=>Kn,never:()=>Mf,number:()=>vf,object:()=>Jn,objectWithoutOptionalProperties:()=>kf,optional:()=>Jo,property:()=>Pf,record:()=>Gf,set:()=>Wf,string:()=>Vf,stringLiteral:()=>Bf,transform:()=>Ko,undiscriminatedUnion:()=>Hf,union:()=>Qf,unknown:()=>zf,withParsedProperties:()=>Xo});n();a();s();n();a();s();n();a();s();n();a();s();var Q={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"};n();a();s();function ie(e,t){return`Expected ${t}. Received ${p0(e)}.`}function p0(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}n();a();s();function xe(e){return{...e,json:Af(e.json),parse:Af(e.parse)}}function Af(e){return(t,r)=>{let i=e(t,r),{skipValidation:o=!1}=r??{};return!i.ok&&o?(console.warn(["Failed to validate.",...i.errors.map(c=>" - "+(c.path.length>0?`${c.path.join(".")}: ${c.message}`:c.message))].join(`
5
- `)),{ok:!0,value:t}):i}}n();a();s();n();a();s();n();a();s();n();a();s();function $n(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var fr=class extends Error{constructor(r){super(r.map($n).join("; "));y(this,"errors");this.errors=r,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};n();a();s();var mr=class extends Error{constructor(r){super(r.map($n).join("; "));y(this,"errors");this.errors=r,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};function ae(e){return{nullable:()=>l0(e),optional:()=>Jo(e),optionalNullable:()=>f0(e),transform:t=>Ko(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new mr(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new fr(i.errors)}}}function l0(e){let t={parse:(r,i)=>r==null?{ok:!0,value:null}:e.parse(r,i),json:(r,i)=>r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.NULLABLE};return{...t,...ae(t)}}function Jo(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.OPTIONAL};return{...t,...ae(t)}}function f0(e){let t={parse:(r,i)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,i),json:(r,i)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.OPTIONAL_NULLABLE};return{...t,...ae(t)}}function Ko(e,t){let r={parse:(i,o)=>{let c=e.parse(i,o);return c.ok?{ok:!0,value:t.transform(c.value)}:c},json:(i,o)=>{let c=t.untransform(i);return e.json(c,o)},getType:()=>e.getType()};return{...r,...ae(r)}}function If(){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:ie(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:ie(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Q.BIGINT};return{...xe(e),...ae(e)}}n();a();s();n();a();s();var m0=/^([+-]?\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 Nf(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:ie(t,"string")}]}:m0.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:ie(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:ie(t,"Date object")}]},getType:()=>Q.DATE};return{...xe(e),...ae(e)}}n();a();s();n();a();s();n();a();s();function Se(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...xe(r),...ae(r)}}}function Hn(e){let t=new Set(e);return Se(Q.ENUM,(i,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:c=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:c,message:ie(i,"string")}]}:!t.has(i)&&!o?{ok:!1,errors:[{path:c,message:ie(i,"enum")}]}:{ok:!0,value:i})()}n();a();s();n();a();s();function Rf(e){let t=Qo(e);return{...t,...ae(t)}}function Qo(e){return{parse:(t,r)=>dr(e).parse(t,r),json:(t,r)=>dr(e).json(t,r),getType:()=>dr(e).getType()}}function dr(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}n();a();s();n();a();s();n();a();s();n();a();s();function Yo(e){return Object.entries(e)}n();a();s();function vi(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[o,c])=>(r.has(o)&&(i[o]=c),i),{})}n();a();s();function ct(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}n();a();s();function Vi(e){return Object.keys(e)}n();a();s();function Of(e,t){let r=[],i=[];for(let o of e)t(o)?r.push(o):i.push(o);return[r,i]}n();a();s();n();a();s();var d0=Object.prototype.hasOwnProperty;function Je(e){return{withParsedProperties:t=>Xo(e,t)}}function Xo(e,t){let r={parse:(i,o)=>{let c=e.parse(i,o);if(!c.ok)return c;let l={};for(let b in t)if(d0.call(t,b)){let w=t[b];l[b]=typeof w=="function"?w(c.value):w}return{ok:!0,value:{...c.value,...l}}},json:(i,o)=>{if(!ct(i))return{ok:!1,errors:[{path:o?.breadcrumbsPrefix??[],message:ie(i,"object")}]};let c=new Set(Object.keys(t)),l=vi(i,Object.keys(i).filter(b=>!c.has(b)));return e.json(l,o)},getType:()=>e.getType()};return{...r,...ae(r),...Je(r)}}n();a();s();function Pf(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function pt(e){return e.isProperty}var h0=Object.prototype.hasOwnProperty;function Jn(e){let t;function r(){if(t==null){t={};for(let[L,R]of Yo(e)){let F=pt(R)?R.rawKey:L,U=pt(R)?R.valueSchema:R;t[F]={rawKey:F,parsedKey:L,valueSchema:U}}}return t}let i,o,c,l;function b(){if(i==null){i=[],o=[];for(let[L,R]of Yo(e)){let F=pt(R)?R.rawKey:L,U=pt(R)?R.valueSchema:R;y0(U)&&(i.push(F),o.push(L))}c=new Set(i),l=new Set(o)}return i}function w(){return o==null&&b(),o}function A(){return c==null&&b(),c}function I(){return l==null&&b(),l}let P={_getRawProperties:()=>Object.entries(e).map(([L,R])=>pt(R)?R.rawKey:L),_getParsedProperties:()=>Vi(e),parse:(L,R)=>{let F=R?.breadcrumbsPrefix??[];return Cf({value:L,requiredKeys:b(),requiredKeysSet:A(),getProperty:U=>{let M=r()[U];if(M!=null)return{transformedKey:M.parsedKey,transform:W=>{let z=[...F,U];return M.valueSchema.parse(W,{...R,breadcrumbsPrefix:z})}}},unrecognizedObjectKeys:R?.unrecognizedObjectKeys,skipValidation:R?.skipValidation,breadcrumbsPrefix:F,omitUndefined:R?.omitUndefined})},json:(L,R)=>{let F=R?.breadcrumbsPrefix??[];return Cf({value:L,requiredKeys:w(),requiredKeysSet:I(),getProperty:U=>{let M=e[U];if(M!=null)return pt(M)?{transformedKey:M.rawKey,transform:W=>{let z=[...F,U];return M.valueSchema.json(W,{...R,breadcrumbsPrefix:z})}}:{transformedKey:U,transform:W=>{let z=[...F,U];return M.json(W,{...R,breadcrumbsPrefix:z})}}},unrecognizedObjectKeys:R?.unrecognizedObjectKeys,skipValidation:R?.skipValidation,breadcrumbsPrefix:F,omitUndefined:R?.omitUndefined})},getType:()=>Q.OBJECT};return{...xe(P),...ae(P),...Je(P),...Jt(P)}}function Cf({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:i,unrecognizedObjectKeys:o="fail",skipValidation:c=!1,breadcrumbsPrefix:l=[]}){if(!ct(e))return{ok:!1,errors:[{path:l,message:ie(e,"object")}]};let b=t.length,w=[],A={};for(let I in e){if(!h0.call(e,I))continue;let P=e[I],L=i(I);if(L!=null){b>0&&r.has(I)&&b--;let R=L.transform(P);R.ok?A[L.transformedKey]=R.value:(A[I]=P,w.push(...R.errors))}else switch(o){case"fail":w.push({path:[...l,I],message:`Unexpected key "${I}"`});break;case"strip":break;case"passthrough":A[I]=P;break}}if(b>0)for(let I of t)I in e||w.push({path:l,message:`Missing required key "${I}"`});return w.length===0||c?{ok:!0,value:A}:{ok:!1,errors:w}}function Jt(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,o)=>_f({extensionKeys:t._getRawProperties(),value:i,transformBase:c=>e.parse(c,o),transformExtension:c=>t.parse(c,o),breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(i,o)=>_f({extensionKeys:t._getParsedProperties(),value:i,transformBase:c=>e.json(c,o),transformExtension:c=>t.json(c,o),breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>Q.OBJECT};return{...r,...ae(r),...Je(r),...Jt(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),i={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(o,c)=>{let l=e.parse(o,{...c,unrecognizedObjectKeys:"passthrough"});if(!l.ok)return l;let b={};if(typeof o=="object"&&o!=null)for(let[w,A]of Object.entries(o))t.has(w)||(b[w]=A);return{ok:!0,value:{...b,...l.value}}},json:(o,c)=>{let l=e.json(o,{...c,unrecognizedObjectKeys:"passthrough"});if(!l.ok)return l;let b={};if(typeof o=="object"&&o!=null)for(let[w,A]of Object.entries(o))r.has(w)||(b[w]=A);return{ok:!0,value:{...b,...l.value}}},getType:()=>Q.OBJECT};return{...i,...ae(i),...Je(i),...Jt(i)}}}}function _f({extensionKeys:e,value:t,transformBase:r,transformExtension:i,breadcrumbsPrefix:o=[]}){if(!ct(t))return{ok:!1,errors:[{path:o,message:ie(t,"object")}]};let c=new Set(e),[l,b]=Of(Vi(t),I=>c.has(I)),w=r(vi(t,b)),A=i(vi(t,l));return w.ok&&A.ok?{ok:!0,value:{...w.value,...A.value}}:{ok:!1,errors:[...w.ok?[]:w.errors,...A.ok?[]:A.errors]}}function y0(e){return!g0(e)}function g0(e){switch(e.getType()){case Q.ANY:case Q.UNKNOWN:case Q.OPTIONAL:case Q.OPTIONAL_NULLABLE:return!0;default:return!1}}n();a();s();function kf(e){return Jn(e)}function Ff(e){let t={...Qo(e),_getRawProperties:()=>dr(e)._getRawProperties(),_getParsedProperties:()=>dr(e)._getParsedProperties()};return{...t,...ae(t),...Je(t),...Jt(t)}}n();a();s();n();a();s();function Kn(e){let t={parse:(r,i)=>Lf(r,(o,c)=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${c}]`]})),json:(r,i)=>Lf(r,(o,c)=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${c}]`]})),getType:()=>Q.LIST};return{...xe(t),...ae(t)}}function Lf(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:ie(e,"list"),path:[]}]};let r=[],i=[];for(let o=0;o<e.length;o++){let c=t(e[o],o);c.ok?r.push(c.value):i.push(...c.errors)}return i.length===0?{ok:!0,value:r}:{ok:!1,errors:i}}n();a();s();n();a();s();function jf(e){return Se(Q.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:ie(r,`${e.toString()}`)}]})()}n();a();s();function Bf(e){return Se(Q.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:ie(r,`"${e}"`)}]})()}n();a();s();n();a();s();var Df=Se(Q.ANY,e=>({ok:!0,value:e}));n();a();s();var Uf=Se(Q.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"boolean")}]});n();a();s();var Mf=Se(Q.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));n();a();s();var vf=Se(Q.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"number")}]});n();a();s();var Vf=Se(Q.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"string")}]});n();a();s();var zf=Se(Q.UNKNOWN,e=>({ok:!0,value:e}));n();a();s();n();a();s();var b0=Object.prototype.hasOwnProperty;function Gf(e,t){let r={parse:(i,o)=>qf({value:i,isKeyNumeric:e.getType()===Q.NUMBER,transformKey:c=>e.parse(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${c} (key)`]}),transformValue:(c,l)=>t.parse(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${l}`]}),breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(i,o)=>qf({value:i,isKeyNumeric:e.getType()===Q.NUMBER,transformKey:c=>e.json(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${c} (key)`]}),transformValue:(c,l)=>t.json(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${l}`]}),breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>Q.RECORD};return{...xe(r),...ae(r)}}function qf({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:o=[]}){if(!ct(e))return{ok:!1,errors:[{path:o,message:ie(e,"object")}]};let c={},l=[];for(let b in e){if(!b0.call(e,b))continue;let w=e[b];if(w===void 0)continue;let A=b;if(t){let L=b.length>0?Number(b):NaN;Number.isNaN(L)||(A=L)}let I=r(A),P=i(w,A);I.ok&&P.ok?c[I.value]=P.value:(I.ok||l.push(...I.errors),P.ok||l.push(...P.errors))}return l.length===0?{ok:!0,value:c}:{ok:!1,errors:l}}n();a();s();n();a();s();function Wf(e){let t=Kn(e),r={parse:(i,o)=>{let c=t.parse(i,o);return c.ok?{ok:!0,value:new Set(c.value)}:c},json:(i,o)=>i instanceof Set?t.json([...i],o):{ok:!1,errors:[{path:o?.breadcrumbsPrefix??[],message:ie(i,"Set")}]},getType:()=>Q.SET};return{...xe(r),...ae(r)}}n();a();s();n();a();s();function Hf(e){let t={parse:(r,i)=>$f((o,c)=>o.parse(r,c),e,i),json:(r,i)=>$f((o,c)=>o.json(r,c),e,i),getType:()=>Q.UNDISCRIMINATED_UNION};return{...xe(t),...ae(t)}}function $f(e,t,r){let i=[];for(let[o,c]of t.entries()){let l=e(c,{...r,skipValidation:!1});if(l.ok)return l;for(let b of l.errors)i.push({path:b.path,message:`[Variant ${o}] ${b.message}`})}return{ok:!1,errors:i}}n();a();s();n();a();s();function Jf(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}n();a();s();var x0=Object.prototype.hasOwnProperty;function Qf(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,o=Hn(Vi(t)),c={parse:(l,b)=>Kf({value:l,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:w=>o.parse(w,{allowUnrecognizedEnumValues:b?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...b?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:w=>t[w],allowUnrecognizedUnionMembers:b?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(w,A)=>A.parse(w,b),breadcrumbsPrefix:b?.breadcrumbsPrefix}),json:(l,b)=>Kf({value:l,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:w=>o.json(w,{allowUnrecognizedEnumValues:b?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...b?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:w=>t[w],allowUnrecognizedUnionMembers:b?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(w,A)=>A.json(w,b),breadcrumbsPrefix:b?.breadcrumbsPrefix}),getType:()=>Q.UNION};return{...xe(c),...ae(c),...Je(c)}}function Kf({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:c=!1,transformAdditionalProperties:l,breadcrumbsPrefix:b=[]}){if(!ct(e))return{ok:!1,errors:[{path:b,message:ie(e,"object")}]};let w=e[t],A={};for(let R in e)x0.call(e,R)&&R!==t&&(A[R]=e[R]);if(w==null)return{ok:!1,errors:[{path:b,message:`Missing discriminant ("${t}")`}]};let I=i(w);if(!I.ok)return{ok:!1,errors:I.errors};let P=o(I.value);if(P==null)return c?{ok:!0,value:{[r]:I.value,...A}}:{ok:!1,errors:[{path:[...b,t],message:"Unexpected discriminant value"}]};let L=l(A,P);return L.ok?{ok:!0,value:{[r]:w,...L.value}}:L}n();a();s();var Qn=p.string();n();a();s();var Yn=p.enum_(["openai","anthropic","aws-bedrock"]);var Xn=p.object({provider:Yn,model:Qn});var eu={};q(eu,{AutomationSchema:()=>wt});n();a();s();n();a();s();var wt=p.object({generate:p.boolean().optional(),upgrade:p.boolean().optional(),preview:p.boolean().optional(),verify:p.boolean().optional()});var pu={};q(pu,{AnyAuthItem:()=>Zn,AnyAuthSchemesSchema:()=>es,ApiAuthSchema:()=>yr,AuthSchemeDeclarationSchema:()=>Et,AuthSchemeReferenceSchema:()=>hr,AuthScope:()=>ls,AuthVariable:()=>Kt,AvailabilitySchema:()=>xs,AvailabilityStatusSchema:()=>br,AvailabilityUnionSchema:()=>Ss,BaseTypeReferenceSchema:()=>Fs,BasicAuthSchemeSchema:()=>is,BearerAuthSchemeSchema:()=>cs,EncodingSchema:()=>Es,EndpointSecuritySchema:()=>rs,EndpointSecuritySchemaDetails:()=>ts,EnvironmentSchema:()=>Ns,HeaderAuthSchemeSchema:()=>ps,HttpHeaderSchema:()=>Sr,InferredAuthenticatedRequestHeader:()=>ns,InferredBearerAuthSchema:()=>os,InferredGetTokenEndpointSchema:()=>as,InferredGetTokenEndpointSchemaObject:()=>ss,ListValidationSchema:()=>Os,MapValidationSchema:()=>Ps,MultipleBaseUrlsEnvironmentSchema:()=>As,NumberValidationSchema:()=>Cs,OAuthAccessTokenRequestPropertiesSchema:()=>fs,OAuthAccessTokenResponsePropertiesSchema:()=>ms,OAuthGetTokenEndpointSchema:()=>ds,OAuthRefreshTokenEndpointSchema:()=>gs,OAuthRefreshTokenRequestPropertiesSchema:()=>hs,OAuthRefreshTokenResponsePropertiesSchema:()=>ys,OAuthSchemeSchema:()=>bs,ProtobufTypeSchema:()=>Ts,ServerVariableSchema:()=>xr,SingleBaseUrlEnvironmentSchema:()=>Is,StringValidationSchema:()=>_s,TokenBearerAuthSchema:()=>us,TypeReferenceDeclarationWithEnvOverride:()=>Bs,TypeReferenceDeclarationWithEnvOverrideSchema:()=>js,TypeReferenceDeclarationWithName:()=>Ls,ValidationSchema:()=>ks,WithAudiences:()=>At,WithAvailability:()=>ws,WithDocsSchema:()=>me,WithEnvironmentVariable:()=>gr,WithEnvironmentsSchema:()=>Rs,WithHeadersSchema:()=>Ds,WithName:()=>Tt,auth:()=>tu,availability:()=>ru,commons:()=>iu,encoding:()=>nu,environments:()=>su,file:()=>au,service:()=>ou,types:()=>uu,validation:()=>cu});n();a();s();n();a();s();var tu={};q(tu,{AnyAuthItem:()=>Zn,AnyAuthSchemesSchema:()=>es,ApiAuthSchema:()=>yr,AuthSchemeDeclarationSchema:()=>Et,AuthSchemeReferenceSchema:()=>hr,AuthScope:()=>ls,AuthVariable:()=>Kt,BasicAuthSchemeSchema:()=>is,BearerAuthSchemeSchema:()=>cs,EndpointSecuritySchema:()=>rs,EndpointSecuritySchemaDetails:()=>ts,HeaderAuthSchemeSchema:()=>ps,InferredAuthenticatedRequestHeader:()=>ns,InferredBearerAuthSchema:()=>os,InferredGetTokenEndpointSchema:()=>as,InferredGetTokenEndpointSchemaObject:()=>ss,OAuthAccessTokenRequestPropertiesSchema:()=>fs,OAuthAccessTokenResponsePropertiesSchema:()=>ms,OAuthGetTokenEndpointSchema:()=>ds,OAuthRefreshTokenEndpointSchema:()=>gs,OAuthRefreshTokenRequestPropertiesSchema:()=>hs,OAuthRefreshTokenResponsePropertiesSchema:()=>ys,OAuthSchemeSchema:()=>bs,TokenBearerAuthSchema:()=>us,WithEnvironmentVariable:()=>gr});n();a();s();n();a();s();n();a();s();n();a();s();var me=p.object({docs:p.string().optional()});var hr=p.object({scheme:p.string()}).extend(me);var Zn=p.undiscriminatedUnion([p.string(),hr]);n();a();s();var es=p.object({any:p.list(Zn)}).extend(me);n();a();s();n();a();s();n();a();s();var ts=p.object({});var rs=p.object({"endpoint-security":ts}).extend(me);var yr=p.undiscriminatedUnion([p.string(),hr,es,rs]);n();a();s();n();a();s();n();a();s();n();a();s();var Tt=p.object({name:p.string().optional()});n();a();s();var gr=p.object({env:p.string().optional()});var Kt=p.object({omit:p.boolean().optional()}).extend(gr).extend(Tt);var is=p.object({scheme:p.stringLiteral("basic"),username:Kt.optional(),password:Kt.optional()}).extend(me);n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var ns=p.object({"response-property":p.string(),"header-name":p.string(),"value-prefix":p.string().optional()});var ss=p.object({endpoint:p.string(),"expiry-response-property":p.string().optional(),"authenticated-request-headers":p.list(ns).optional()});var as=p.undiscriminatedUnion([p.string(),ss]);var os=p.object({scheme:p.stringLiteral("bearer"),"get-token":as}).extend(me);n();a();s();var us=p.object({scheme:p.stringLiteral("bearer"),token:Kt.optional()}).extend(me);var cs=p.undiscriminatedUnion([us,os]);n();a();s();var ps=p.object({header:p.string(),type:p.string().optional(),prefix:p.string().optional()}).extend(gr).extend(Tt).extend(me);n();a();s();n();a();s();var ls=p.string();n();a();s();n();a();s();var fs=p.object({"client-id":p.string().optional(),"client-secret":p.string().optional(),scopes:p.string().optional()});n();a();s();var ms=p.object({"access-token":p.string().optional(),"expires-in":p.string().optional(),"refresh-token":p.string().optional()});var ds=p.object({endpoint:p.string(),"request-properties":fs.optional(),"response-properties":ms.optional()});n();a();s();n();a();s();var hs=p.object({"refresh-token":p.string()});n();a();s();var ys=p.object({"access-token":p.string().optional(),"expires-in":p.string().optional(),"refresh-token":p.string().optional()});var gs=p.object({endpoint:p.string(),"request-properties":hs.optional(),"response-properties":ys.optional()});var bs=p.object({scheme:p.stringLiteral("oauth"),type:p.stringLiteral("client-credentials"),scopes:p.list(ls).optional(),"client-id-env":p.string().optional(),"client-secret-env":p.string().optional(),"token-prefix":p.string().optional(),"token-header":p.string().optional(),"get-token":ds,"refresh-token":gs.optional()}).extend(me);var Et=p.undiscriminatedUnion([bs,ps,is,cs]);var ru={};q(ru,{AvailabilitySchema:()=>xs,AvailabilityStatusSchema:()=>br,AvailabilityUnionSchema:()=>Ss});n();a();s();n();a();s();n();a();s();var br=p.enum_(["in-development","pre-release","deprecated","generally-available"]);var xs=p.object({status:br,message:p.string().optional()});n();a();s();var Ss=p.undiscriminatedUnion([br,xs]);var iu={};q(iu,{WithAudiences:()=>At,WithAvailability:()=>ws,WithDocsSchema:()=>me,WithName:()=>Tt});n();a();s();n();a();s();var At=p.object({audiences:p.list(p.string()).optional()});n();a();s();var ws=p.object({availability:Ss.optional()});var nu={};q(nu,{EncodingSchema:()=>Es,ProtobufTypeSchema:()=>Ts});n();a();s();n();a();s();n();a();s();var Ts=p.object({type:p.string()});var Es=p.object({proto:Ts.optional()});var su={};q(su,{EnvironmentSchema:()=>Ns,MultipleBaseUrlsEnvironmentSchema:()=>As,ServerVariableSchema:()=>xr,SingleBaseUrlEnvironmentSchema:()=>Is,WithEnvironmentsSchema:()=>Rs});n();a();s();n();a();s();n();a();s();n();a();s();var xr=p.object({id:p.string(),default:p.string().optional(),values:p.list(p.string()).optional()});var As=p.object({urls:p.record(p.string(),p.string()),"url-templates":p.record(p.string(),p.string()).optional(),"default-urls":p.record(p.string(),p.string()).optional(),variables:p.record(p.string(),p.list(xr)).optional()}).extend(At).extend(me);n();a();s();var Is=p.object({url:p.string(),"default-url":p.string().optional(),"url-template":p.string().optional(),variables:p.list(xr).optional()}).extend(At).extend(me);var Ns=p.undiscriminatedUnion([p.string(),Is,As]);n();a();s();var Rs=p.object({"default-url":p.string().optional(),"default-environment":p.string().optional(),environments:p.record(p.string(),Ns).optional()});var au={};q(au,{WithHeadersSchema:()=>Ds});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var Os=p.object({minItems:p.number().optional(),maxItems:p.number().optional()});n();a();s();var Ps=p.object({minProperties:p.number().optional(),maxProperties:p.number().optional()});n();a();s();var Cs=p.object({min:p.number().optional(),max:p.number().optional(),exclusiveMin:p.boolean().optional(),exclusiveMax:p.boolean().optional(),multipleOf:p.number().optional()});n();a();s();var _s=p.object({minLength:p.number().optional(),maxLength:p.number().optional(),pattern:p.string().optional(),format:p.string().optional()});var ks=p.undiscriminatedUnion([_s,Cs,Os,Ps]);var Fs=p.object({default:p.unknown().optional(),encoding:Es.optional(),validation:ks.optional()}).extend(me).extend(ws);var Ls=p.object({type:p.string()}).extend(Fs).extend(Tt).extend(At);var js=p.object({env:p.string().optional()}).extend(Ls);var Bs=p.undiscriminatedUnion([p.string(),js]);var Sr=Bs;var Ds=p.object({headers:p.record(p.string(),Sr).optional()});var ou={};q(ou,{HttpHeaderSchema:()=>Sr,TypeReferenceDeclarationWithEnvOverride:()=>Bs,TypeReferenceDeclarationWithEnvOverrideSchema:()=>js});n();a();s();var uu={};q(uu,{BaseTypeReferenceSchema:()=>Fs,TypeReferenceDeclarationWithName:()=>Ls});n();a();s();var cu={};q(cu,{ListValidationSchema:()=>Os,MapValidationSchema:()=>Ps,NumberValidationSchema:()=>Cs,StringValidationSchema:()=>_s,ValidationSchema:()=>ks});n();a();s();var lu={};q(lu,{ApiConfigurationSchema:()=>sa,ApiConfigurationSchemaInternal:()=>Pr,ApiConfigurationV2Schema:()=>ia,ApiConfigurationV2SettingsSchema:()=>kr,ApiConfigurationV2SpecsSchema:()=>Fr,ApiDefinitionList:()=>zs,ApiDefinitionPathSchema:()=>It,ApiDefinitionSchema:()=>Vs,ApiDefinitionSettingsSchema:()=>Ir,ApiDefinitionWithOverridesSchema:()=>Nr,AsyncApiSettingsSchema:()=>_r,AsyncApiSpecSchema:()=>Ys,BaseApiSettingsSchema:()=>Cr,CoerceConstsTo:()=>qs,ConjureSchema:()=>Qs,DefaultIntegerFormat:()=>Gs,ExampleStyle:()=>aa,FormParameterEncoding:()=>Ws,GeneratorImageObjectSchema:()=>oa,GeneratorsConfigurationSchema:()=>Yf,GeneratorsOpenApiObjectSchema:()=>Ba,GeneratorsOpenApiSchema:()=>Da,GitRemoteSchema:()=>Ms,GraphQlSpecSchema:()=>Xs,Language:()=>Ua,MessageNamingSettingsSchema:()=>wr,MultiServerStrategy:()=>Tr,NamespacedApiConfigurationSchema:()=>na,OpenApiExampleGenerationSchema:()=>$s,OpenApiFilterSchema:()=>Hs,OpenApiSettingsSchema:()=>Rt,OpenApiSpecSchema:()=>Zs,OpenRpcSpecSchema:()=>ea,OutputMetadataAuthor:()=>ua,OutputMetadataSchema:()=>Ot,OverridesSchema:()=>ze,PathParameterOrder:()=>Er,ProtobufApiDefinitionSchema:()=>Or,ProtobufDefinitionSchema:()=>Rr,ProtobufSpecSchema:()=>ta,ReadmeCustomSectionSchema:()=>Ma,ReadmeEndpointObjectSchema:()=>va,ReadmeEndpointSchema:()=>Wi,ReadmeSchema:()=>Va,RemoveDiscriminantsFromSchemas:()=>Ar,RequestOrResponseExampleGenerationSchema:()=>zi,ResolveAliases:()=>Ks,ResolveAliasesSchema:()=>Js,SpecGitSourceSchema:()=>vs,SpecSchema:()=>ra,SpecSourceSchema:()=>Nt,UnionSettingsSchema:()=>Us,WhitelabelConfigurationSchema:()=>qa,WhitelabelGithubConfigurationSchema:()=>za});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var It=p.string();n();a();s();n();a();s();n();a();s();var wr=p.enum_(["v1","v2"]);n();a();s();var Tr=p.enum_(["environment-per-server","urls-per-environment"]);n();a();s();var Er=p.enum_(["url-order","spec-order"]);n();a();s();var Ar=p.enum_(["always","never"]);n();a();s();var Us=p.enum_(["v1"]);var Ir=p.object({"use-title":p.boolean().optional(),unions:Us.optional(),"message-naming":wr.optional(),"respect-nullable-schemas":p.boolean().optional(),"only-include-referenced-schemas":p.boolean().optional(),"inline-path-parameters":p.boolean().optional(),"idiomatic-request-names":p.boolean().optional(),"wrap-references-to-nullable-in-optional":p.boolean().optional(),"coerce-optional-schemas-to-nullable":p.boolean().optional(),"group-environments-by-host":p.boolean().optional(),"multi-server-strategy":Tr.optional(),"remove-discriminants-from-schemas":Ar.optional(),"path-parameter-order":Er.optional()});n();a();s();var ze=p.undiscriminatedUnion([p.string(),p.list(p.string())]);var Nr=p.object({path:It,origin:p.string().optional(),overrides:ze.optional(),audiences:p.list(p.string()).optional(),settings:Ir.optional()});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var Ms=p.object({repo:p.string(),ref:p.string().optional(),path:p.string()});var vs=p.object({git:Ms});var Nt=p.undiscriminatedUnion([p.string(),vs]);var Rr=p.object({target:p.string().optional(),root:Nt,overrides:ze.optional(),"local-generation":p.boolean().optional(),"from-openapi":p.boolean().optional(),dependencies:p.list(p.string()).optional()});var Or=p.object({proto:Rr});var Vs=p.undiscriminatedUnion([It,Nr,Or]);var zs=p.list(Vs);var Pr=p.undiscriminatedUnion([It,Nr,zs,Or]);n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var qs=p.enum_(["literals","enums","enums-coerceable-to-literals"]);var Cr=p.object({"respect-nullable-schemas":p.boolean().optional(),"title-as-schema-name":p.boolean().optional(),"optional-additional-properties":p.boolean().optional(),"coerce-enums-to-literals":p.boolean().optional(),"idiomatic-request-names":p.boolean().optional(),"wrap-references-to-nullable-in-optional":p.boolean().optional(),"coerce-optional-schemas-to-nullable":p.boolean().optional(),"group-environments-by-host":p.boolean().optional(),"multi-server-strategy":Tr.optional(),"remove-discriminants-from-schemas":Ar.optional(),"path-parameter-order":Er.optional(),"resolve-schema-collisions":p.boolean().optional(),"infer-forward-compatible":p.boolean().optional(),"infer-default-environment":p.boolean().optional(),"coerce-consts-to":qs.optional()});var _r=p.object({"message-naming":wr.optional()}).extend(Cr);n();a();s();n();a();s();var Gs=p.enum_(["int32","int64","uint32","uint64"]);n();a();s();var Ws=p.enum_(["form","json"]);n();a();s();n();a();s();var zi=p.object({"max-depth":p.number().optional()});var $s=p.object({request:zi.optional(),response:zi.optional()});n();a();s();var Hs=p.object({endpoints:p.list(p.string()).optional()});n();a();s();n();a();s();var Js=p.object({except:p.list(p.string()).optional()});var Ks=p.undiscriminatedUnion([p.boolean(),Js]);var Rt=p.object({"only-include-referenced-schemas":p.boolean().optional(),"inline-path-parameters":p.boolean().optional(),"prefer-undiscriminated-unions-with-literals":p.boolean().optional(),"object-query-parameters":p.boolean().optional(),"respect-readonly-schemas":p.boolean().optional(),"use-read-variant-for-responses":p.boolean().optional(),"respect-forward-compatible-enums":p.boolean().optional(),"use-bytes-for-binary-response":p.boolean().optional(),"default-form-parameter-encoding":Ws.optional(),filter:Hs.optional(),"example-generation":$s.optional(),"additional-properties-defaults-to":p.boolean().optional(),"type-dates-as-strings":p.boolean().optional(),"preserve-single-schema-oneof":p.boolean().optional(),"inline-all-of-schemas":p.boolean().optional(),"resolve-aliases":Ks.optional(),"group-multi-api-environments":p.boolean().optional(),"default-integer-format":Gs.optional(),"infer-discriminated-union-base-properties":p.boolean().optional(),"disambiguate-request-names":p.boolean().optional()}).extend(Cr);var kr=p.object({"auto-generate-idempotency-key":p.unknown().optional()}).extend(Rt).extend(_r);n();a();s();n();a();s();var Qs=p.object({conjure:p.string()});n();a();s();n();a();s();var Ys=p.object({asyncapi:Nt,origin:p.string().optional(),overrides:ze.optional(),namespace:p.string().optional(),settings:_r.optional()});n();a();s();var Xs=p.object({graphql:p.string(),origin:p.string().optional(),overrides:p.string().optional(),examples:p.string().optional(),name:p.string().optional()});n();a();s();var Zs=p.object({openapi:Nt,origin:p.string().optional(),overrides:ze.optional(),overlays:p.string().optional(),namespace:p.string().optional(),settings:Rt.optional()});n();a();s();var ea=p.object({openrpc:p.string(),overrides:ze.optional(),namespace:p.string().optional()});n();a();s();var ta=p.object({proto:Rr});var ra=p.undiscriminatedUnion([Zs,Ys,ta,ea,Xs]);var Fr=p.undiscriminatedUnion([p.list(ra),Qs]);var ia=p.object({auth:yr.optional(),"auth-schemes":p.record(p.string(),Et).optional(),specs:Fr,settings:kr.optional()}).extend(Ds).extend(Rs);n();a();s();var na=p.object({namespaces:p.record(p.string(),Pr)});var sa=p.undiscriminatedUnion([Pr,na,ia]);n();a();s();var aa=p.enum_(["minimal","comprehensive"]);n();a();s();var oa=p.object({name:p.string(),registry:p.string()});n();a();s();n();a();s();n();a();s();n();a();s();var ua=p.object({name:p.string(),email:p.string()});var Ot=p.object({description:p.string().optional(),authors:p.list(ua).optional()});n();a();s();n();a();s();var qi=p.object({name:p.string()});var Pt=p.object({teams:p.list(qi).optional(),users:p.list(qi).optional()});n();a();s();n();a();s();n();a();s();n();a();s();var ca=p.object({auth:yr.optional(),"auth-schemes":p.record(p.string(),Et).optional(),headers:p.record(p.string(),Sr).optional(),settings:kr.optional(),specs:Fr.optional()});n();a();s();n();a();s();var pa=p.object({url:p.string().optional(),"package-name":p.string(),token:p.string().optional()});n();a();s();var la=p.object({path:p.string()});n();a();s();n();a();s();var fa=p.object({keyId:p.string(),password:p.string(),secretKey:p.string()});var ma=p.object({url:p.string().optional(),coordinate:p.string(),username:p.string().optional(),password:p.string().optional(),signature:fa.optional()});n();a();s();var da=p.object({url:p.string().optional(),"package-name":p.string(),token:p.string().optional()});n();a();s();var ha=p.object({url:p.string().optional(),"package-name":p.string(),"api-key":p.string().optional()});n();a();s();var ya=p.object({"api-key":p.string(),"workspace-id":p.string(),"collection-id":p.string().optional()});n();a();s();n();a();s();var ga=p.object({keywords:p.list(p.string()).optional(),"documentation-link":p.string().optional(),"homepage-link":p.string().optional()}).extend(Ot);var ba=p.object({url:p.string().optional(),"package-name":p.string(),token:p.string().optional(),username:p.string().optional(),password:p.string().optional(),metadata:ga.optional()});n();a();s();var xa=p.object({url:p.string().optional(),"package-name":p.string(),"api-key":p.string().optional()});var Sa=p.union("location",{npm:da,maven:ma,pypi:ba,postman:ya,"local-file-system":la,nuget:ha,rubygems:xa,crates:pa}).transform({transform:e=>e,untransform:e=>e});n();a();s();n();a();s();n();a();s();var wa=p.object({custom:p.string()});n();a();s();var Ta=p.enum_(["MIT","Apache-2.0"]);var qe=p.undiscriminatedUnion([Ta,wa]);var Gi=p.object({"package-description":p.string().optional(),email:p.string().optional(),"reference-url":p.string().optional(),author:p.string().optional(),license:qe.optional()});n();a();s();var Ea=p.object({path:p.string()});n();a();s();n();a();s();n();a();s();var Aa=p.enum_(["commit","release"]);var Ia=p.object({repository:p.string(),branch:p.string().optional(),license:qe.optional(),mode:Aa.optional()});n();a();s();var Na=p.object({repository:p.string(),branch:p.string().optional(),license:qe.optional(),mode:p.stringLiteral("pull-request"),reviewers:Pt.optional()});n();a();s();var Ra=p.object({repository:p.string(),license:qe.optional(),mode:p.stringLiteral("push"),branch:p.string().optional()});n();a();s();n();a();s();var Oa=p.enum_(["pull-request","push","commit-and-release"]);var Pa=p.object({uri:p.string(),token:p.string(),mode:Oa.optional(),branch:p.string().optional(),license:qe.optional()});var Ca=p.undiscriminatedUnion([Pa,Ia,Na,Ra]);var Lr=p.object({version:p.string(),output:Sa.optional(),github:Ca.optional(),config:p.unknown().optional(),metadata:Gi.optional(),keywords:p.list(p.string()).optional(),snippets:Ea.optional(),"ir-version":p.string().optional(),"smart-casing":p.boolean().optional(),"smart-casing-digit-word-boundary":p.boolean().optional(),api:ca.optional(),"disable-examples":p.boolean().optional(),"publish-metadata":Gi.optional(),autorelease:p.boolean().optional(),automation:wt.optional()});var _a=p.object({image:oa}).extend(Lr);n();a();s();var ka=p.object({name:p.string()}).extend(Lr);var Fa=p.undiscriminatedUnion([ka,_a]);var La=p.object({audiences:p.list(p.string()).optional(),generators:p.list(Fa),metadata:Ot.optional(),reviewers:Pt.optional(),automation:wt.optional()});n();a();s();var ja=p.object({enabled:p.boolean()});n();a();s();n();a();s();var Ba=p.object({path:p.string(),origin:p.string().optional(),overrides:p.string().optional(),"disable-examples":p.boolean().optional(),settings:Rt});var Da=p.undiscriminatedUnion([Ba,p.string()]);n();a();s();n();a();s();n();a();s();var Ua=p.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var Ma=p.object({title:p.string(),language:Ua,content:p.string()});n();a();s();n();a();s();var va=p.object({method:p.string(),path:p.string(),stream:p.boolean().optional()});var Wi=p.undiscriminatedUnion([p.string(),va]);var Va=p.object({bannerLink:p.string().optional(),introduction:p.string().optional(),apiReferenceLink:p.string().optional(),apiName:p.string().optional(),disabledSections:p.list(p.string()).optional(),defaultEndpoint:Wi.optional(),features:p.record(p.string(),p.list(Wi)).optional(),customSections:p.list(Ma).optional(),exampleStyle:aa.optional()});n();a();s();n();a();s();var za=p.object({username:p.string(),email:p.string(),token:p.string()});var qa=p.object({github:za.optional()});var Yf=p.object({"auth-schemes":p.record(p.string(),Et).optional(),api:sa.optional(),whitelabel:qa.optional(),metadata:Ot.optional(),readme:Va.optional(),"default-group":p.string().optional(),aliases:p.record(p.string(),p.list(p.string())).optional(),groups:p.record(p.string(),La).optional(),reviewers:Pt.optional(),replay:ja.optional(),ai:Xn.optional(),autorelease:p.boolean().optional(),automation:wt.optional(),openapi:Da.optional(),"openapi-overrides":p.string().optional(),"spec-origin":p.string().optional(),"async-api":p.string().optional(),"api-settings":Ir.optional()});var fu={};q(fu,{BaseGeneratorInvocationSchema:()=>Lr,CratesOutputLocationSchema:()=>pa,CustomGeneratorInvocationSchema:()=>_a,DefaultGeneratorInvocationSchema:()=>ka,GeneratorApiSettingsSchema:()=>ca,GeneratorGroupSchema:()=>La,GeneratorInvocationSchema:()=>Fa,GeneratorOutputSchema:()=>Sa,GeneratorPublishMetadataSchema:()=>Gi,GeneratorSnippetsSchema:()=>Ea,GithubCommitAndReleaseMode:()=>Aa,GithubCommitAndReleaseSchema:()=>Ia,GithubConfigurationSchema:()=>Ca,GithubPullRequestSchema:()=>Na,GithubPushSchema:()=>Ra,GithubSelfhostedMode:()=>Oa,GithubSelfhostedSchema:()=>Pa,LocalFileSystemOutputLocationSchema:()=>la,MavenOutputLocationSchema:()=>ma,MavenOutputSignatureSchema:()=>fa,NpmOutputLocationSchema:()=>da,NugetOutputLocationSchema:()=>ha,PostmanOutputLocationSchema:()=>ya,PypiOutputLocationSchema:()=>ba,PypiOutputMetadataSchema:()=>ga,RubyGemsOutputLocationSchema:()=>xa});n();a();s();var mu={};q(mu,{GithubLicenseCustomSchema:()=>wa,GithubLicenseSchema:()=>qe,GithubLicenseType:()=>Ta});n();a();s();var du={};q(du,{ReplayConfigSchema:()=>ja});n();a();s();var hu={};q(hu,{ReviewerSchema:()=>qi,ReviewersSchema:()=>Pt});n();a();s();n();a();s();n();a();s();function Xf(e){return e?.specs!=null}n();a();s();function Zf(e){return e?.asyncapi!=null}n();a();s();function em(e){return e?.conjure!=null}n();a();s();function tm(e){return e?.graphql!=null}n();a();s();function rm(e){return e?.namespaces!=null}n();a();s();function im(e){return e?.openapi!=null}n();a();s();function nm(e){return e?.openrpc!=null}n();a();s();function sm(e){return e?.proto!=null}var am={[Ge.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,Le(e)])),[Ge.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[Ge.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[Ge.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all","kwargs"]),[Ge.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","internal","map","package","range","return","select","struct","switch","type","var","vendor","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[Ge.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime","object_id","hash","eql?","equal?","method","send","respond_to?","respond_to_missing?","instance_of?","kind_of?","is_a?","extend","singleton_class","instance_variables","instance_variable_get","instance_variable_set","instance_variable_defined?","remove_instance_variable","public_methods","private_methods","protected_methods","singleton_methods"]),[Ge.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[Ge.GenerationLanguage.RUST]:new Set(["as","async","await","break","const","continue","crate","dyn","else","enum","extern","false","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","Self","static","struct","super","trait","true","type","union","unsafe","use","where","while","abstract","become","box","do","final","macro","override","priv","try","typeof","unsized","virtual","yield","bool","char","f32","f64","i8","i16","i32","i64","i128","isize","str","u8","u16","u32","u64","u128","usize","String","Vec","Option","Result","Box","Rc","Arc","Cell","RefCell","HashMap","HashSet","BTreeMap","BTreeSet"]),[Ge.GenerationLanguage.SWIFT]:new Set([])};var S0=["go","ruby"];function Ga(e,t,r){let{generationLanguage:i,keywords:o,smartCasing:c,smartCasingDigitWordBoundary:l}=r,b=P0(e),w=W=>({unsafeName:W,safeName:w0({name:W,keywords:T0({generationLanguage:i,keywords:o})})}),A=t.preserveUnderscores===!0,I=A?(W,z)=>gu(W,z):(W,z)=>z(W),P=I(b,lr),L=A?gu(b,W=>Le(lr(W))):Le(P),R=I(b,qn),{leading:F,trailing:U}=A?um(b):{leading:"",trailing:""},M=Li(P);if(c){!I0(M)&&(i==null||S0.includes(i))&&(P=F+M.map((z,oe)=>{if(oe>0){let H=Wa(z);if(H!=null)return H;if($a(z))return z.toUpperCase()}return z}).join("")+U,L=Le(F+M.map((z,oe)=>{let H=Wa(z);return H??($a(z)?z.toUpperCase():oe===0?Le(z):z)}).join("")+U));let W=z=>z.split(" ").map(oe=>{let H=oe.split(/(\d+)/);return H.map((K,C)=>{let D=qn(K),Z=H[C-1];return(l??!1)&&D!==""&&Z!=null&&/^\d+$/.test(Z)&&/^[^a-z0-9]/.test(K)?`_${D}`:D}).join("")}).join("_");R=A?gu(b,W):W(b)}return{originalName:e,camelCase:w(t.casingOverrides?.camel??P),snakeCase:w(t.casingOverrides?.snake??R),screamingSnakeCase:w(t.casingOverrides?.["screaming-snake"]??R.toUpperCase()),pascalCase:w(t.casingOverrides?.pascal??L)}}function om({generationLanguage:e,keywords:t,smartCasing:r,smartCasingDigitWordBoundary:i}){let o={generationLanguage:e,keywords:t,smartCasing:r,smartCasingDigitWordBoundary:i};return{generateName:(c,l)=>{if(typeof c=="string")return Ga(c,l??{},o);if("wireValue"in c){let b=c.name;return typeof b=="string"?Ga(b,l??{},o):b}return c},generateNameAndWireValue:(c,l)=>{if(typeof c=="string")return{wireValue:c,name:Ga(c,l??{},o)};let{name:b,wireValue:w}=c,A=typeof b=="string"?Ga(b,l??{},o):b;return{wireValue:w,name:A}}}}function w0({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":A0(e)?"_"+e:e}function T0({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return am[e]}var E0=/^[0-9]/;function A0(e){return E0.test(e)}function I0(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let o=Wa(i)!=null||$a(i),c=Wa(t)!=null||$a(t);return o&&c})}function Wa(e){return R0.get(e.toUpperCase())}function $a(e){return N0.has(e.toUpperCase())}var N0=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),R0=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]),O0=[[/\[\]/g,"Array"]];function P0(e){return O0.reduce((t,[r,i])=>t.replace(r,i),e)}function um(e){let t=e.match(/^(_+)/),r=e.match(/(_+)$/),i=t?.[1]??"",o=r?.[1]??"";if(i.length+o.length>=e.length)return{leading:e,trailing:"",core:""};let c=e.slice(i.length,e.length-o.length||void 0);return{leading:i,trailing:o,core:c}}function gu(e,t){let{leading:r,trailing:i,core:o}=um(e);return r===""&&i===""?t(e):`${r}${t(o)}${i}`}n();a();s();function $i(e){return typeof e=="string"?e:e.wireValue}var Hi=class e{constructor(t){y(this,"casingsGenerator");this.casingsGenerator=om(t)}static fromLanguage(t,r){return new e({generationLanguage:t,keywords:void 0,smartCasing:r})}resolve(t){return this.casingsGenerator.generateName(t)}resolveNameOrString(t){return this.casingsGenerator.generateName(t)}resolveNameAndWireValue(t){return this.casingsGenerator.generateNameAndWireValue(t)}camel(t){return this.resolve(t).camelCase}camelSafe(t){return this.camel(t).safeName}camelUnsafe(t){return this.camel(t).unsafeName}pascal(t){return this.resolve(t).pascalCase}pascalSafe(t){return this.pascal(t).safeName}pascalUnsafe(t){return this.pascal(t).unsafeName}snake(t){return this.resolve(t).snakeCase}snakeSafe(t){return this.snake(t).safeName}snakeUnsafe(t){return this.snake(t).unsafeName}screamingSnake(t){return this.resolve(t).screamingSnakeCase}screamingSnakeSafe(t){return this.screamingSnake(t).safeName}screamingSnakeUnsafe(t){return this.screamingSnake(t).unsafeName}};n();a();s();var Ke=class extends ut{constructor(r){super();y(this,"value");this.value=r}write(r){typeof this.value=="string"?r.write(this.value):typeof this.value=="function"?this.value(r):this.value.write(r)}};var k0=4;Ul({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Ji=class{constructor(){y(this,"lineBuffer",[]);y(this,"indentLevel",0);y(this,"hasWrittenAnything",!1);y(this,"lastCharacterIsSemicolon",!1);y(this,"lastCharacterIsNewline",!1);y(this,"nodeStackFrames",[])}get buffer(){return je&&this.nodeStackFrames.length>0&&this.writeInternal(`
5
+ `)),{ok:!0,value:t}):i}}n();a();s();n();a();s();n();a();s();n();a();s();function $n(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var fr=class extends Error{constructor(r){super(r.map($n).join("; "));y(this,"errors");this.errors=r,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};n();a();s();var mr=class extends Error{constructor(r){super(r.map($n).join("; "));y(this,"errors");this.errors=r,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};function ae(e){return{nullable:()=>l0(e),optional:()=>Jo(e),optionalNullable:()=>f0(e),transform:t=>Ko(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new mr(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new fr(i.errors)}}}function l0(e){let t={parse:(r,i)=>r==null?{ok:!0,value:null}:e.parse(r,i),json:(r,i)=>r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.NULLABLE};return{...t,...ae(t)}}function Jo(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.OPTIONAL};return{...t,...ae(t)}}function f0(e){let t={parse:(r,i)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,i),json:(r,i)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.OPTIONAL_NULLABLE};return{...t,...ae(t)}}function Ko(e,t){let r={parse:(i,o)=>{let c=e.parse(i,o);return c.ok?{ok:!0,value:t.transform(c.value)}:c},json:(i,o)=>{let c=t.untransform(i);return e.json(c,o)},getType:()=>e.getType()};return{...r,...ae(r)}}function If(){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:ie(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:ie(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Q.BIGINT};return{...xe(e),...ae(e)}}n();a();s();n();a();s();var m0=/^([+-]?\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 Nf(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:ie(t,"string")}]}:m0.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:ie(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:ie(t,"Date object")}]},getType:()=>Q.DATE};return{...xe(e),...ae(e)}}n();a();s();n();a();s();n();a();s();function Se(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...xe(r),...ae(r)}}}function Hn(e){let t=new Set(e);return Se(Q.ENUM,(i,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:c=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:c,message:ie(i,"string")}]}:!t.has(i)&&!o?{ok:!1,errors:[{path:c,message:ie(i,"enum")}]}:{ok:!0,value:i})()}n();a();s();n();a();s();function Rf(e){let t=Qo(e);return{...t,...ae(t)}}function Qo(e){return{parse:(t,r)=>dr(e).parse(t,r),json:(t,r)=>dr(e).json(t,r),getType:()=>dr(e).getType()}}function dr(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}n();a();s();n();a();s();n();a();s();n();a();s();function Yo(e){return Object.entries(e)}n();a();s();function vi(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[o,c])=>(r.has(o)&&(i[o]=c),i),{})}n();a();s();function ct(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}n();a();s();function Vi(e){return Object.keys(e)}n();a();s();function Of(e,t){let r=[],i=[];for(let o of e)t(o)?r.push(o):i.push(o);return[r,i]}n();a();s();n();a();s();var d0=Object.prototype.hasOwnProperty;function Je(e){return{withParsedProperties:t=>Xo(e,t)}}function Xo(e,t){let r={parse:(i,o)=>{let c=e.parse(i,o);if(!c.ok)return c;let l={};for(let b in t)if(d0.call(t,b)){let w=t[b];l[b]=typeof w=="function"?w(c.value):w}return{ok:!0,value:{...c.value,...l}}},json:(i,o)=>{if(!ct(i))return{ok:!1,errors:[{path:o?.breadcrumbsPrefix??[],message:ie(i,"object")}]};let c=new Set(Object.keys(t)),l=vi(i,Object.keys(i).filter(b=>!c.has(b)));return e.json(l,o)},getType:()=>e.getType()};return{...r,...ae(r),...Je(r)}}n();a();s();function Pf(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function pt(e){return e.isProperty}var h0=Object.prototype.hasOwnProperty;function Jn(e){let t;function r(){if(t==null){t={};for(let[L,R]of Yo(e)){let F=pt(R)?R.rawKey:L,U=pt(R)?R.valueSchema:R;t[F]={rawKey:F,parsedKey:L,valueSchema:U}}}return t}let i,o,c,l;function b(){if(i==null){i=[],o=[];for(let[L,R]of Yo(e)){let F=pt(R)?R.rawKey:L,U=pt(R)?R.valueSchema:R;y0(U)&&(i.push(F),o.push(L))}c=new Set(i),l=new Set(o)}return i}function w(){return o==null&&b(),o}function A(){return c==null&&b(),c}function I(){return l==null&&b(),l}let P={_getRawProperties:()=>Object.entries(e).map(([L,R])=>pt(R)?R.rawKey:L),_getParsedProperties:()=>Vi(e),parse:(L,R)=>{let F=R?.breadcrumbsPrefix??[];return Cf({value:L,requiredKeys:b(),requiredKeysSet:A(),getProperty:U=>{let M=r()[U];if(M!=null)return{transformedKey:M.parsedKey,transform:W=>{let z=[...F,U];return M.valueSchema.parse(W,{...R,breadcrumbsPrefix:z})}}},unrecognizedObjectKeys:R?.unrecognizedObjectKeys,skipValidation:R?.skipValidation,breadcrumbsPrefix:F,omitUndefined:R?.omitUndefined})},json:(L,R)=>{let F=R?.breadcrumbsPrefix??[];return Cf({value:L,requiredKeys:w(),requiredKeysSet:I(),getProperty:U=>{let M=e[U];if(M!=null)return pt(M)?{transformedKey:M.rawKey,transform:W=>{let z=[...F,U];return M.valueSchema.json(W,{...R,breadcrumbsPrefix:z})}}:{transformedKey:U,transform:W=>{let z=[...F,U];return M.json(W,{...R,breadcrumbsPrefix:z})}}},unrecognizedObjectKeys:R?.unrecognizedObjectKeys,skipValidation:R?.skipValidation,breadcrumbsPrefix:F,omitUndefined:R?.omitUndefined})},getType:()=>Q.OBJECT};return{...xe(P),...ae(P),...Je(P),...Jt(P)}}function Cf({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:i,unrecognizedObjectKeys:o="fail",skipValidation:c=!1,breadcrumbsPrefix:l=[]}){if(!ct(e))return{ok:!1,errors:[{path:l,message:ie(e,"object")}]};let b=t.length,w=[],A={};for(let I in e){if(!h0.call(e,I))continue;let P=e[I],L=i(I);if(L!=null){b>0&&r.has(I)&&b--;let R=L.transform(P);R.ok?A[L.transformedKey]=R.value:(A[I]=P,w.push(...R.errors))}else switch(o){case"fail":w.push({path:[...l,I],message:`Unexpected key "${I}"`});break;case"strip":break;case"passthrough":A[I]=P;break}}if(b>0)for(let I of t)I in e||w.push({path:l,message:`Missing required key "${I}"`});return w.length===0||c?{ok:!0,value:A}:{ok:!1,errors:w}}function Jt(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,o)=>_f({extensionKeys:t._getRawProperties(),value:i,transformBase:c=>e.parse(c,o),transformExtension:c=>t.parse(c,o),breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(i,o)=>_f({extensionKeys:t._getParsedProperties(),value:i,transformBase:c=>e.json(c,o),transformExtension:c=>t.json(c,o),breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>Q.OBJECT};return{...r,...ae(r),...Je(r),...Jt(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),i={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(o,c)=>{let l=e.parse(o,{...c,unrecognizedObjectKeys:"passthrough"});if(!l.ok)return l;let b={};if(typeof o=="object"&&o!=null)for(let[w,A]of Object.entries(o))t.has(w)||(b[w]=A);return{ok:!0,value:{...b,...l.value}}},json:(o,c)=>{let l=e.json(o,{...c,unrecognizedObjectKeys:"passthrough"});if(!l.ok)return l;let b={};if(typeof o=="object"&&o!=null)for(let[w,A]of Object.entries(o))r.has(w)||(b[w]=A);return{ok:!0,value:{...b,...l.value}}},getType:()=>Q.OBJECT};return{...i,...ae(i),...Je(i),...Jt(i)}}}}function _f({extensionKeys:e,value:t,transformBase:r,transformExtension:i,breadcrumbsPrefix:o=[]}){if(!ct(t))return{ok:!1,errors:[{path:o,message:ie(t,"object")}]};let c=new Set(e),[l,b]=Of(Vi(t),I=>c.has(I)),w=r(vi(t,b)),A=i(vi(t,l));return w.ok&&A.ok?{ok:!0,value:{...w.value,...A.value}}:{ok:!1,errors:[...w.ok?[]:w.errors,...A.ok?[]:A.errors]}}function y0(e){return!g0(e)}function g0(e){switch(e.getType()){case Q.ANY:case Q.UNKNOWN:case Q.OPTIONAL:case Q.OPTIONAL_NULLABLE:return!0;default:return!1}}n();a();s();function kf(e){return Jn(e)}function Ff(e){let t={...Qo(e),_getRawProperties:()=>dr(e)._getRawProperties(),_getParsedProperties:()=>dr(e)._getParsedProperties()};return{...t,...ae(t),...Je(t),...Jt(t)}}n();a();s();n();a();s();function Kn(e){let t={parse:(r,i)=>Lf(r,(o,c)=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${c}]`]})),json:(r,i)=>Lf(r,(o,c)=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${c}]`]})),getType:()=>Q.LIST};return{...xe(t),...ae(t)}}function Lf(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:ie(e,"list"),path:[]}]};let r=[],i=[];for(let o=0;o<e.length;o++){let c=t(e[o],o);c.ok?r.push(c.value):i.push(...c.errors)}return i.length===0?{ok:!0,value:r}:{ok:!1,errors:i}}n();a();s();n();a();s();function jf(e){return Se(Q.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:ie(r,`${e.toString()}`)}]})()}n();a();s();function Bf(e){return Se(Q.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:ie(r,`"${e}"`)}]})()}n();a();s();n();a();s();var Df=Se(Q.ANY,e=>({ok:!0,value:e}));n();a();s();var Uf=Se(Q.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"boolean")}]});n();a();s();var Mf=Se(Q.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));n();a();s();var vf=Se(Q.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"number")}]});n();a();s();var Vf=Se(Q.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"string")}]});n();a();s();var zf=Se(Q.UNKNOWN,e=>({ok:!0,value:e}));n();a();s();n();a();s();var b0=Object.prototype.hasOwnProperty;function Gf(e,t){let r={parse:(i,o)=>qf({value:i,isKeyNumeric:e.getType()===Q.NUMBER,transformKey:c=>e.parse(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${c} (key)`]}),transformValue:(c,l)=>t.parse(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${l}`]}),breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(i,o)=>qf({value:i,isKeyNumeric:e.getType()===Q.NUMBER,transformKey:c=>e.json(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${c} (key)`]}),transformValue:(c,l)=>t.json(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${l}`]}),breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>Q.RECORD};return{...xe(r),...ae(r)}}function qf({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:o=[]}){if(!ct(e))return{ok:!1,errors:[{path:o,message:ie(e,"object")}]};let c={},l=[];for(let b in e){if(!b0.call(e,b))continue;let w=e[b];if(w===void 0)continue;let A=b;if(t){let L=b.length>0?Number(b):NaN;Number.isNaN(L)||(A=L)}let I=r(A),P=i(w,A);I.ok&&P.ok?c[I.value]=P.value:(I.ok||l.push(...I.errors),P.ok||l.push(...P.errors))}return l.length===0?{ok:!0,value:c}:{ok:!1,errors:l}}n();a();s();n();a();s();function Wf(e){let t=Kn(e),r={parse:(i,o)=>{let c=t.parse(i,o);return c.ok?{ok:!0,value:new Set(c.value)}:c},json:(i,o)=>i instanceof Set?t.json([...i],o):{ok:!1,errors:[{path:o?.breadcrumbsPrefix??[],message:ie(i,"Set")}]},getType:()=>Q.SET};return{...xe(r),...ae(r)}}n();a();s();n();a();s();function Hf(e){let t={parse:(r,i)=>$f((o,c)=>o.parse(r,c),e,i),json:(r,i)=>$f((o,c)=>o.json(r,c),e,i),getType:()=>Q.UNDISCRIMINATED_UNION};return{...xe(t),...ae(t)}}function $f(e,t,r){let i=[];for(let[o,c]of t.entries()){let l=e(c,{...r,skipValidation:!1});if(l.ok)return l;for(let b of l.errors)i.push({path:b.path,message:`[Variant ${o}] ${b.message}`})}return{ok:!1,errors:i}}n();a();s();n();a();s();function Jf(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}n();a();s();var x0=Object.prototype.hasOwnProperty;function Qf(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,o=Hn(Vi(t)),c={parse:(l,b)=>Kf({value:l,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:w=>o.parse(w,{allowUnrecognizedEnumValues:b?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...b?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:w=>t[w],allowUnrecognizedUnionMembers:b?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(w,A)=>A.parse(w,b),breadcrumbsPrefix:b?.breadcrumbsPrefix}),json:(l,b)=>Kf({value:l,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:w=>o.json(w,{allowUnrecognizedEnumValues:b?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...b?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:w=>t[w],allowUnrecognizedUnionMembers:b?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(w,A)=>A.json(w,b),breadcrumbsPrefix:b?.breadcrumbsPrefix}),getType:()=>Q.UNION};return{...xe(c),...ae(c),...Je(c)}}function Kf({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:c=!1,transformAdditionalProperties:l,breadcrumbsPrefix:b=[]}){if(!ct(e))return{ok:!1,errors:[{path:b,message:ie(e,"object")}]};let w=e[t],A={};for(let R in e)x0.call(e,R)&&R!==t&&(A[R]=e[R]);if(w==null)return{ok:!1,errors:[{path:b,message:`Missing discriminant ("${t}")`}]};let I=i(w);if(!I.ok)return{ok:!1,errors:I.errors};let P=o(I.value);if(P==null)return c?{ok:!0,value:{[r]:I.value,...A}}:{ok:!1,errors:[{path:[...b,t],message:"Unexpected discriminant value"}]};let L=l(A,P);return L.ok?{ok:!0,value:{[r]:w,...L.value}}:L}n();a();s();var Qn=p.string();n();a();s();var Yn=p.enum_(["openai","anthropic","aws-bedrock"]);var Xn=p.object({provider:Yn,model:Qn});var eu={};q(eu,{AutomationSchema:()=>wt});n();a();s();n();a();s();var wt=p.object({generate:p.boolean().optional(),upgrade:p.boolean().optional(),preview:p.boolean().optional(),verify:p.boolean().optional()});var pu={};q(pu,{AnyAuthItem:()=>Zn,AnyAuthSchemesSchema:()=>es,ApiAuthSchema:()=>yr,AuthSchemeDeclarationSchema:()=>Et,AuthSchemeReferenceSchema:()=>hr,AuthScope:()=>ls,AuthVariable:()=>Kt,AvailabilitySchema:()=>xs,AvailabilityStatusSchema:()=>br,AvailabilityUnionSchema:()=>Ss,BaseTypeReferenceSchema:()=>Fs,BasicAuthSchemeSchema:()=>is,BearerAuthSchemeSchema:()=>cs,EncodingSchema:()=>Es,EndpointSecuritySchema:()=>rs,EndpointSecuritySchemaDetails:()=>ts,EnvironmentSchema:()=>Ns,HeaderAuthSchemeSchema:()=>ps,HttpHeaderSchema:()=>Sr,InferredAuthenticatedRequestHeader:()=>ns,InferredBearerAuthSchema:()=>os,InferredGetTokenEndpointSchema:()=>as,InferredGetTokenEndpointSchemaObject:()=>ss,ListValidationSchema:()=>Os,MapValidationSchema:()=>Ps,MultipleBaseUrlsEnvironmentSchema:()=>As,NumberValidationSchema:()=>Cs,OAuthAccessTokenRequestPropertiesSchema:()=>fs,OAuthAccessTokenResponsePropertiesSchema:()=>ms,OAuthGetTokenEndpointSchema:()=>ds,OAuthRefreshTokenEndpointSchema:()=>gs,OAuthRefreshTokenRequestPropertiesSchema:()=>hs,OAuthRefreshTokenResponsePropertiesSchema:()=>ys,OAuthSchemeSchema:()=>bs,ProtobufTypeSchema:()=>Ts,ServerVariableSchema:()=>xr,SingleBaseUrlEnvironmentSchema:()=>Is,StringValidationSchema:()=>_s,TokenBearerAuthSchema:()=>us,TypeReferenceDeclarationWithEnvOverride:()=>Bs,TypeReferenceDeclarationWithEnvOverrideSchema:()=>js,TypeReferenceDeclarationWithName:()=>Ls,ValidationSchema:()=>ks,WithAudiences:()=>At,WithAvailability:()=>ws,WithDocsSchema:()=>me,WithEnvironmentVariable:()=>gr,WithEnvironmentsSchema:()=>Rs,WithHeadersSchema:()=>Ds,WithName:()=>Tt,auth:()=>tu,availability:()=>ru,commons:()=>iu,encoding:()=>nu,environments:()=>su,file:()=>au,service:()=>ou,types:()=>uu,validation:()=>cu});n();a();s();n();a();s();var tu={};q(tu,{AnyAuthItem:()=>Zn,AnyAuthSchemesSchema:()=>es,ApiAuthSchema:()=>yr,AuthSchemeDeclarationSchema:()=>Et,AuthSchemeReferenceSchema:()=>hr,AuthScope:()=>ls,AuthVariable:()=>Kt,BasicAuthSchemeSchema:()=>is,BearerAuthSchemeSchema:()=>cs,EndpointSecuritySchema:()=>rs,EndpointSecuritySchemaDetails:()=>ts,HeaderAuthSchemeSchema:()=>ps,InferredAuthenticatedRequestHeader:()=>ns,InferredBearerAuthSchema:()=>os,InferredGetTokenEndpointSchema:()=>as,InferredGetTokenEndpointSchemaObject:()=>ss,OAuthAccessTokenRequestPropertiesSchema:()=>fs,OAuthAccessTokenResponsePropertiesSchema:()=>ms,OAuthGetTokenEndpointSchema:()=>ds,OAuthRefreshTokenEndpointSchema:()=>gs,OAuthRefreshTokenRequestPropertiesSchema:()=>hs,OAuthRefreshTokenResponsePropertiesSchema:()=>ys,OAuthSchemeSchema:()=>bs,TokenBearerAuthSchema:()=>us,WithEnvironmentVariable:()=>gr});n();a();s();n();a();s();n();a();s();n();a();s();var me=p.object({docs:p.string().optional()});var hr=p.object({scheme:p.string()}).extend(me);var Zn=p.undiscriminatedUnion([p.string(),hr]);n();a();s();var es=p.object({any:p.list(Zn)}).extend(me);n();a();s();n();a();s();n();a();s();var ts=p.object({});var rs=p.object({"endpoint-security":ts}).extend(me);var yr=p.undiscriminatedUnion([p.string(),hr,es,rs]);n();a();s();n();a();s();n();a();s();n();a();s();var Tt=p.object({name:p.string().optional()});n();a();s();var gr=p.object({env:p.string().optional()});var Kt=p.object({omit:p.boolean().optional()}).extend(gr).extend(Tt);var is=p.object({scheme:p.stringLiteral("basic"),username:Kt.optional(),password:Kt.optional()}).extend(me);n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var ns=p.object({"response-property":p.string(),"header-name":p.string(),"value-prefix":p.string().optional()});var ss=p.object({endpoint:p.string(),"expiry-response-property":p.string().optional(),"authenticated-request-headers":p.list(ns).optional()});var as=p.undiscriminatedUnion([p.string(),ss]);var os=p.object({scheme:p.stringLiteral("bearer"),"get-token":as}).extend(me);n();a();s();var us=p.object({scheme:p.stringLiteral("bearer"),token:Kt.optional()}).extend(me);var cs=p.undiscriminatedUnion([us,os]);n();a();s();var ps=p.object({header:p.string(),type:p.string().optional(),prefix:p.string().optional()}).extend(gr).extend(Tt).extend(me);n();a();s();n();a();s();var ls=p.string();n();a();s();n();a();s();var fs=p.object({"client-id":p.string().optional(),"client-secret":p.string().optional(),scopes:p.string().optional()});n();a();s();var ms=p.object({"access-token":p.string().optional(),"expires-in":p.string().optional(),"refresh-token":p.string().optional()});var ds=p.object({endpoint:p.string(),"request-properties":fs.optional(),"response-properties":ms.optional()});n();a();s();n();a();s();var hs=p.object({"refresh-token":p.string()});n();a();s();var ys=p.object({"access-token":p.string().optional(),"expires-in":p.string().optional(),"refresh-token":p.string().optional()});var gs=p.object({endpoint:p.string(),"request-properties":hs.optional(),"response-properties":ys.optional()});var bs=p.object({scheme:p.stringLiteral("oauth"),type:p.stringLiteral("client-credentials"),scopes:p.list(ls).optional(),"client-id-env":p.string().optional(),"client-secret-env":p.string().optional(),"token-prefix":p.string().optional(),"token-header":p.string().optional(),"get-token":ds,"refresh-token":gs.optional()}).extend(me);var Et=p.undiscriminatedUnion([bs,ps,is,cs]);var ru={};q(ru,{AvailabilitySchema:()=>xs,AvailabilityStatusSchema:()=>br,AvailabilityUnionSchema:()=>Ss});n();a();s();n();a();s();n();a();s();var br=p.enum_(["in-development","pre-release","deprecated","generally-available"]);var xs=p.object({status:br,message:p.string().optional()});n();a();s();var Ss=p.undiscriminatedUnion([br,xs]);var iu={};q(iu,{WithAudiences:()=>At,WithAvailability:()=>ws,WithDocsSchema:()=>me,WithName:()=>Tt});n();a();s();n();a();s();var At=p.object({audiences:p.list(p.string()).optional()});n();a();s();var ws=p.object({availability:Ss.optional()});var nu={};q(nu,{EncodingSchema:()=>Es,ProtobufTypeSchema:()=>Ts});n();a();s();n();a();s();n();a();s();var Ts=p.object({type:p.string()});var Es=p.object({proto:Ts.optional()});var su={};q(su,{EnvironmentSchema:()=>Ns,MultipleBaseUrlsEnvironmentSchema:()=>As,ServerVariableSchema:()=>xr,SingleBaseUrlEnvironmentSchema:()=>Is,WithEnvironmentsSchema:()=>Rs});n();a();s();n();a();s();n();a();s();n();a();s();var xr=p.object({id:p.string(),default:p.string().optional(),values:p.list(p.string()).optional()});var As=p.object({urls:p.record(p.string(),p.string()),"url-templates":p.record(p.string(),p.string()).optional(),"default-urls":p.record(p.string(),p.string()).optional(),variables:p.record(p.string(),p.list(xr)).optional()}).extend(At).extend(me);n();a();s();var Is=p.object({url:p.string(),"default-url":p.string().optional(),"url-template":p.string().optional(),variables:p.list(xr).optional()}).extend(At).extend(me);var Ns=p.undiscriminatedUnion([p.string(),Is,As]);n();a();s();var Rs=p.object({"default-url":p.string().optional(),"default-environment":p.string().optional(),environments:p.record(p.string(),Ns).optional()});var au={};q(au,{WithHeadersSchema:()=>Ds});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var Os=p.object({minItems:p.number().optional(),maxItems:p.number().optional()});n();a();s();var Ps=p.object({minProperties:p.number().optional(),maxProperties:p.number().optional()});n();a();s();var Cs=p.object({min:p.number().optional(),max:p.number().optional(),exclusiveMin:p.boolean().optional(),exclusiveMax:p.boolean().optional(),multipleOf:p.number().optional()});n();a();s();var _s=p.object({minLength:p.number().optional(),maxLength:p.number().optional(),pattern:p.string().optional(),format:p.string().optional()});var ks=p.undiscriminatedUnion([_s,Cs,Os,Ps]);var Fs=p.object({default:p.unknown().optional(),encoding:Es.optional(),validation:ks.optional()}).extend(me).extend(ws);var Ls=p.object({type:p.string()}).extend(Fs).extend(Tt).extend(At);var js=p.object({env:p.string().optional()}).extend(Ls);var Bs=p.undiscriminatedUnion([p.string(),js]);var Sr=Bs;var Ds=p.object({headers:p.record(p.string(),Sr).optional()});var ou={};q(ou,{HttpHeaderSchema:()=>Sr,TypeReferenceDeclarationWithEnvOverride:()=>Bs,TypeReferenceDeclarationWithEnvOverrideSchema:()=>js});n();a();s();var uu={};q(uu,{BaseTypeReferenceSchema:()=>Fs,TypeReferenceDeclarationWithName:()=>Ls});n();a();s();var cu={};q(cu,{ListValidationSchema:()=>Os,MapValidationSchema:()=>Ps,NumberValidationSchema:()=>Cs,StringValidationSchema:()=>_s,ValidationSchema:()=>ks});n();a();s();var lu={};q(lu,{ApiConfigurationSchema:()=>sa,ApiConfigurationSchemaInternal:()=>Pr,ApiConfigurationV2Schema:()=>ia,ApiConfigurationV2SettingsSchema:()=>kr,ApiConfigurationV2SpecsSchema:()=>Fr,ApiDefinitionList:()=>zs,ApiDefinitionPathSchema:()=>It,ApiDefinitionSchema:()=>Vs,ApiDefinitionSettingsSchema:()=>Ir,ApiDefinitionWithOverridesSchema:()=>Nr,AsyncApiSettingsSchema:()=>_r,AsyncApiSpecSchema:()=>Ys,BaseApiSettingsSchema:()=>Cr,CoerceConstsTo:()=>qs,ConjureSchema:()=>Qs,DefaultIntegerFormat:()=>Gs,ExampleStyle:()=>aa,FormParameterEncoding:()=>Ws,GeneratorImageObjectSchema:()=>oa,GeneratorsConfigurationSchema:()=>Yf,GeneratorsOpenApiObjectSchema:()=>Ba,GeneratorsOpenApiSchema:()=>Da,GitRemoteSchema:()=>Ms,GraphQlSpecSchema:()=>Xs,Language:()=>Ua,MessageNamingSettingsSchema:()=>wr,MultiServerStrategy:()=>Tr,NamespacedApiConfigurationSchema:()=>na,OpenApiExampleGenerationSchema:()=>$s,OpenApiFilterSchema:()=>Hs,OpenApiSettingsSchema:()=>Rt,OpenApiSpecSchema:()=>Zs,OpenRpcSpecSchema:()=>ea,OutputMetadataAuthor:()=>ua,OutputMetadataSchema:()=>Ot,OverridesSchema:()=>ze,PathParameterOrder:()=>Er,ProtobufApiDefinitionSchema:()=>Or,ProtobufDefinitionSchema:()=>Rr,ProtobufSpecSchema:()=>ta,ReadmeCustomSectionSchema:()=>Ma,ReadmeEndpointObjectSchema:()=>va,ReadmeEndpointSchema:()=>Wi,ReadmeSchema:()=>Va,RemoveDiscriminantsFromSchemas:()=>Ar,RequestOrResponseExampleGenerationSchema:()=>zi,ResolveAliases:()=>Ks,ResolveAliasesSchema:()=>Js,SpecGitSourceSchema:()=>vs,SpecSchema:()=>ra,SpecSourceSchema:()=>Nt,UnionSettingsSchema:()=>Us,WhitelabelConfigurationSchema:()=>qa,WhitelabelGithubConfigurationSchema:()=>za});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var It=p.string();n();a();s();n();a();s();n();a();s();var wr=p.enum_(["v1","v2"]);n();a();s();var Tr=p.enum_(["environment-per-server","urls-per-environment"]);n();a();s();var Er=p.enum_(["url-order","spec-order"]);n();a();s();var Ar=p.enum_(["always","never"]);n();a();s();var Us=p.enum_(["v1"]);var Ir=p.object({"use-title":p.boolean().optional(),unions:Us.optional(),"message-naming":wr.optional(),"respect-nullable-schemas":p.boolean().optional(),"only-include-referenced-schemas":p.boolean().optional(),"inline-path-parameters":p.boolean().optional(),"idiomatic-request-names":p.boolean().optional(),"wrap-references-to-nullable-in-optional":p.boolean().optional(),"coerce-optional-schemas-to-nullable":p.boolean().optional(),"group-environments-by-host":p.boolean().optional(),"multi-server-strategy":Tr.optional(),"remove-discriminants-from-schemas":Ar.optional(),"path-parameter-order":Er.optional()});n();a();s();var ze=p.undiscriminatedUnion([p.string(),p.list(p.string())]);var Nr=p.object({path:It,origin:p.string().optional(),overrides:ze.optional(),audiences:p.list(p.string()).optional(),settings:Ir.optional()});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var Ms=p.object({repo:p.string(),ref:p.string().optional(),path:p.string()});var vs=p.object({git:Ms});var Nt=p.undiscriminatedUnion([p.string(),vs]);var Rr=p.object({target:p.string().optional(),root:Nt,overrides:ze.optional(),"local-generation":p.boolean().optional(),"from-openapi":p.boolean().optional(),dependencies:p.list(p.string()).optional()});var Or=p.object({proto:Rr});var Vs=p.undiscriminatedUnion([It,Nr,Or]);var zs=p.list(Vs);var Pr=p.undiscriminatedUnion([It,Nr,zs,Or]);n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var qs=p.enum_(["literals","enums","enums-coerceable-to-literals"]);var Cr=p.object({"respect-nullable-schemas":p.boolean().optional(),"title-as-schema-name":p.boolean().optional(),"optional-additional-properties":p.boolean().optional(),"coerce-enums-to-literals":p.boolean().optional(),"idiomatic-request-names":p.boolean().optional(),"wrap-references-to-nullable-in-optional":p.boolean().optional(),"coerce-optional-schemas-to-nullable":p.boolean().optional(),"group-environments-by-host":p.boolean().optional(),"multi-server-strategy":Tr.optional(),"remove-discriminants-from-schemas":Ar.optional(),"path-parameter-order":Er.optional(),"resolve-schema-collisions":p.boolean().optional(),"infer-forward-compatible":p.boolean().optional(),"infer-default-environment":p.boolean().optional(),"coerce-consts-to":qs.optional()});var _r=p.object({"message-naming":wr.optional()}).extend(Cr);n();a();s();n();a();s();var Gs=p.enum_(["int32","int64","uint32","uint64"]);n();a();s();var Ws=p.enum_(["form","json"]);n();a();s();n();a();s();var zi=p.object({"max-depth":p.number().optional()});var $s=p.object({request:zi.optional(),response:zi.optional()});n();a();s();var Hs=p.object({endpoints:p.list(p.string()).optional()});n();a();s();n();a();s();var Js=p.object({except:p.list(p.string()).optional()});var Ks=p.undiscriminatedUnion([p.boolean(),Js]);var Rt=p.object({"only-include-referenced-schemas":p.boolean().optional(),"inline-path-parameters":p.boolean().optional(),"prefer-undiscriminated-unions-with-literals":p.boolean().optional(),"object-query-parameters":p.boolean().optional(),"respect-readonly-schemas":p.boolean().optional(),"use-read-variant-for-responses":p.boolean().optional(),"respect-forward-compatible-enums":p.boolean().optional(),"use-bytes-for-binary-response":p.boolean().optional(),"default-form-parameter-encoding":Ws.optional(),filter:Hs.optional(),"example-generation":$s.optional(),"additional-properties-defaults-to":p.boolean().optional(),"type-dates-as-strings":p.boolean().optional(),"preserve-single-schema-oneof":p.boolean().optional(),"inline-all-of-schemas":p.boolean().optional(),"resolve-aliases":Ks.optional(),"group-multi-api-environments":p.boolean().optional(),"default-integer-format":Gs.optional(),"infer-discriminated-union-base-properties":p.boolean().optional(),"disambiguate-request-names":p.boolean().optional(),"ignore-tags":p.boolean().optional()}).extend(Cr);var kr=p.object({"auto-generate-idempotency-key":p.unknown().optional()}).extend(Rt).extend(_r);n();a();s();n();a();s();var Qs=p.object({conjure:p.string()});n();a();s();n();a();s();var Ys=p.object({asyncapi:Nt,origin:p.string().optional(),overrides:ze.optional(),namespace:p.string().optional(),settings:_r.optional()});n();a();s();var Xs=p.object({graphql:p.string(),origin:p.string().optional(),overrides:p.string().optional(),examples:p.string().optional(),name:p.string().optional()});n();a();s();var Zs=p.object({openapi:Nt,origin:p.string().optional(),overrides:ze.optional(),overlays:p.string().optional(),namespace:p.string().optional(),settings:Rt.optional()});n();a();s();var ea=p.object({openrpc:p.string(),overrides:ze.optional(),namespace:p.string().optional()});n();a();s();var ta=p.object({proto:Rr});var ra=p.undiscriminatedUnion([Zs,Ys,ta,ea,Xs]);var Fr=p.undiscriminatedUnion([p.list(ra),Qs]);var ia=p.object({auth:yr.optional(),"auth-schemes":p.record(p.string(),Et).optional(),specs:Fr,settings:kr.optional()}).extend(Ds).extend(Rs);n();a();s();var na=p.object({namespaces:p.record(p.string(),Pr)});var sa=p.undiscriminatedUnion([Pr,na,ia]);n();a();s();var aa=p.enum_(["minimal","comprehensive"]);n();a();s();var oa=p.object({name:p.string(),registry:p.string()});n();a();s();n();a();s();n();a();s();n();a();s();var ua=p.object({name:p.string(),email:p.string()});var Ot=p.object({description:p.string().optional(),authors:p.list(ua).optional()});n();a();s();n();a();s();var qi=p.object({name:p.string()});var Pt=p.object({teams:p.list(qi).optional(),users:p.list(qi).optional()});n();a();s();n();a();s();n();a();s();n();a();s();var ca=p.object({auth:yr.optional(),"auth-schemes":p.record(p.string(),Et).optional(),headers:p.record(p.string(),Sr).optional(),settings:kr.optional(),specs:Fr.optional()});n();a();s();n();a();s();var pa=p.object({url:p.string().optional(),"package-name":p.string(),token:p.string().optional()});n();a();s();var la=p.object({path:p.string()});n();a();s();n();a();s();var fa=p.object({keyId:p.string(),password:p.string(),secretKey:p.string()});var ma=p.object({url:p.string().optional(),coordinate:p.string(),username:p.string().optional(),password:p.string().optional(),signature:fa.optional()});n();a();s();var da=p.object({url:p.string().optional(),"package-name":p.string(),token:p.string().optional()});n();a();s();var ha=p.object({url:p.string().optional(),"package-name":p.string(),"api-key":p.string().optional()});n();a();s();var ya=p.object({"api-key":p.string(),"workspace-id":p.string(),"collection-id":p.string().optional()});n();a();s();n();a();s();var ga=p.object({keywords:p.list(p.string()).optional(),"documentation-link":p.string().optional(),"homepage-link":p.string().optional()}).extend(Ot);var ba=p.object({url:p.string().optional(),"package-name":p.string(),token:p.string().optional(),username:p.string().optional(),password:p.string().optional(),metadata:ga.optional()});n();a();s();var xa=p.object({url:p.string().optional(),"package-name":p.string(),"api-key":p.string().optional()});var Sa=p.union("location",{npm:da,maven:ma,pypi:ba,postman:ya,"local-file-system":la,nuget:ha,rubygems:xa,crates:pa}).transform({transform:e=>e,untransform:e=>e});n();a();s();n();a();s();n();a();s();var wa=p.object({custom:p.string()});n();a();s();var Ta=p.enum_(["MIT","Apache-2.0"]);var qe=p.undiscriminatedUnion([Ta,wa]);var Gi=p.object({"package-description":p.string().optional(),email:p.string().optional(),"reference-url":p.string().optional(),author:p.string().optional(),license:qe.optional()});n();a();s();var Ea=p.object({path:p.string()});n();a();s();n();a();s();n();a();s();var Aa=p.enum_(["commit","release"]);var Ia=p.object({repository:p.string(),branch:p.string().optional(),license:qe.optional(),mode:Aa.optional()});n();a();s();var Na=p.object({repository:p.string(),branch:p.string().optional(),license:qe.optional(),mode:p.stringLiteral("pull-request"),reviewers:Pt.optional()});n();a();s();var Ra=p.object({repository:p.string(),license:qe.optional(),mode:p.stringLiteral("push"),branch:p.string().optional()});n();a();s();n();a();s();var Oa=p.enum_(["pull-request","push","commit-and-release"]);var Pa=p.object({uri:p.string(),token:p.string(),mode:Oa.optional(),branch:p.string().optional(),license:qe.optional()});var Ca=p.undiscriminatedUnion([Pa,Ia,Na,Ra]);var Lr=p.object({version:p.string(),output:Sa.optional(),github:Ca.optional(),config:p.unknown().optional(),metadata:Gi.optional(),keywords:p.list(p.string()).optional(),snippets:Ea.optional(),"ir-version":p.string().optional(),"smart-casing":p.boolean().optional(),"smart-casing-digit-word-boundary":p.boolean().optional(),api:ca.optional(),"disable-examples":p.boolean().optional(),"publish-metadata":Gi.optional(),autorelease:p.boolean().optional(),automation:wt.optional()});var _a=p.object({image:oa}).extend(Lr);n();a();s();var ka=p.object({name:p.string()}).extend(Lr);var Fa=p.undiscriminatedUnion([ka,_a]);var La=p.object({audiences:p.list(p.string()).optional(),generators:p.list(Fa),metadata:Ot.optional(),reviewers:Pt.optional(),automation:wt.optional()});n();a();s();var ja=p.object({enabled:p.boolean()});n();a();s();n();a();s();var Ba=p.object({path:p.string(),origin:p.string().optional(),overrides:p.string().optional(),"disable-examples":p.boolean().optional(),settings:Rt});var Da=p.undiscriminatedUnion([Ba,p.string()]);n();a();s();n();a();s();n();a();s();var Ua=p.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var Ma=p.object({title:p.string(),language:Ua,content:p.string()});n();a();s();n();a();s();var va=p.object({method:p.string(),path:p.string(),stream:p.boolean().optional()});var Wi=p.undiscriminatedUnion([p.string(),va]);var Va=p.object({bannerLink:p.string().optional(),introduction:p.string().optional(),apiReferenceLink:p.string().optional(),apiName:p.string().optional(),disabledSections:p.list(p.string()).optional(),defaultEndpoint:Wi.optional(),features:p.record(p.string(),p.list(Wi)).optional(),customSections:p.list(Ma).optional(),exampleStyle:aa.optional()});n();a();s();n();a();s();var za=p.object({username:p.string(),email:p.string(),token:p.string()});var qa=p.object({github:za.optional()});var Yf=p.object({"auth-schemes":p.record(p.string(),Et).optional(),api:sa.optional(),whitelabel:qa.optional(),metadata:Ot.optional(),readme:Va.optional(),"default-group":p.string().optional(),aliases:p.record(p.string(),p.list(p.string())).optional(),groups:p.record(p.string(),La).optional(),reviewers:Pt.optional(),replay:ja.optional(),ai:Xn.optional(),autorelease:p.boolean().optional(),automation:wt.optional(),openapi:Da.optional(),"openapi-overrides":p.string().optional(),"spec-origin":p.string().optional(),"async-api":p.string().optional(),"api-settings":Ir.optional()});var fu={};q(fu,{BaseGeneratorInvocationSchema:()=>Lr,CratesOutputLocationSchema:()=>pa,CustomGeneratorInvocationSchema:()=>_a,DefaultGeneratorInvocationSchema:()=>ka,GeneratorApiSettingsSchema:()=>ca,GeneratorGroupSchema:()=>La,GeneratorInvocationSchema:()=>Fa,GeneratorOutputSchema:()=>Sa,GeneratorPublishMetadataSchema:()=>Gi,GeneratorSnippetsSchema:()=>Ea,GithubCommitAndReleaseMode:()=>Aa,GithubCommitAndReleaseSchema:()=>Ia,GithubConfigurationSchema:()=>Ca,GithubPullRequestSchema:()=>Na,GithubPushSchema:()=>Ra,GithubSelfhostedMode:()=>Oa,GithubSelfhostedSchema:()=>Pa,LocalFileSystemOutputLocationSchema:()=>la,MavenOutputLocationSchema:()=>ma,MavenOutputSignatureSchema:()=>fa,NpmOutputLocationSchema:()=>da,NugetOutputLocationSchema:()=>ha,PostmanOutputLocationSchema:()=>ya,PypiOutputLocationSchema:()=>ba,PypiOutputMetadataSchema:()=>ga,RubyGemsOutputLocationSchema:()=>xa});n();a();s();var mu={};q(mu,{GithubLicenseCustomSchema:()=>wa,GithubLicenseSchema:()=>qe,GithubLicenseType:()=>Ta});n();a();s();var du={};q(du,{ReplayConfigSchema:()=>ja});n();a();s();var hu={};q(hu,{ReviewerSchema:()=>qi,ReviewersSchema:()=>Pt});n();a();s();n();a();s();n();a();s();function Xf(e){return e?.specs!=null}n();a();s();function Zf(e){return e?.asyncapi!=null}n();a();s();function em(e){return e?.conjure!=null}n();a();s();function tm(e){return e?.graphql!=null}n();a();s();function rm(e){return e?.namespaces!=null}n();a();s();function im(e){return e?.openapi!=null}n();a();s();function nm(e){return e?.openrpc!=null}n();a();s();function sm(e){return e?.proto!=null}var am={[Ge.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,Le(e)])),[Ge.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[Ge.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[Ge.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all","kwargs"]),[Ge.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","internal","map","package","range","return","select","struct","switch","type","var","vendor","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[Ge.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime","object_id","hash","eql?","equal?","method","send","respond_to?","respond_to_missing?","instance_of?","kind_of?","is_a?","extend","singleton_class","instance_variables","instance_variable_get","instance_variable_set","instance_variable_defined?","remove_instance_variable","public_methods","private_methods","protected_methods","singleton_methods"]),[Ge.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[Ge.GenerationLanguage.RUST]:new Set(["as","async","await","break","const","continue","crate","dyn","else","enum","extern","false","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","Self","static","struct","super","trait","true","type","union","unsafe","use","where","while","abstract","become","box","do","final","macro","override","priv","try","typeof","unsized","virtual","yield","bool","char","f32","f64","i8","i16","i32","i64","i128","isize","str","u8","u16","u32","u64","u128","usize","String","Vec","Option","Result","Box","Rc","Arc","Cell","RefCell","HashMap","HashSet","BTreeMap","BTreeSet"]),[Ge.GenerationLanguage.SWIFT]:new Set([])};var S0=["go","ruby"];function Ga(e,t,r){let{generationLanguage:i,keywords:o,smartCasing:c,smartCasingDigitWordBoundary:l}=r,b=P0(e),w=W=>({unsafeName:W,safeName:w0({name:W,keywords:T0({generationLanguage:i,keywords:o})})}),A=t.preserveUnderscores===!0,I=A?(W,z)=>gu(W,z):(W,z)=>z(W),P=I(b,lr),L=A?gu(b,W=>Le(lr(W))):Le(P),R=I(b,qn),{leading:F,trailing:U}=A?um(b):{leading:"",trailing:""},M=Li(P);if(c){!I0(M)&&(i==null||S0.includes(i))&&(P=F+M.map((z,oe)=>{if(oe>0){let H=Wa(z);if(H!=null)return H;if($a(z))return z.toUpperCase()}return z}).join("")+U,L=Le(F+M.map((z,oe)=>{let H=Wa(z);return H??($a(z)?z.toUpperCase():oe===0?Le(z):z)}).join("")+U));let W=z=>z.split(" ").map(oe=>{let H=oe.split(/(\d+)/);return H.map((K,C)=>{let D=qn(K),Z=H[C-1];return(l??!1)&&D!==""&&Z!=null&&/^\d+$/.test(Z)&&/^[^a-z0-9]/.test(K)?`_${D}`:D}).join("")}).join("_");R=A?gu(b,W):W(b)}return{originalName:e,camelCase:w(t.casingOverrides?.camel??P),snakeCase:w(t.casingOverrides?.snake??R),screamingSnakeCase:w(t.casingOverrides?.["screaming-snake"]??R.toUpperCase()),pascalCase:w(t.casingOverrides?.pascal??L)}}function om({generationLanguage:e,keywords:t,smartCasing:r,smartCasingDigitWordBoundary:i}){let o={generationLanguage:e,keywords:t,smartCasing:r,smartCasingDigitWordBoundary:i};return{generateName:(c,l)=>{if(typeof c=="string")return Ga(c,l??{},o);if("wireValue"in c){let b=c.name;return typeof b=="string"?Ga(b,l??{},o):b}return c},generateNameAndWireValue:(c,l)=>{if(typeof c=="string")return{wireValue:c,name:Ga(c,l??{},o)};let{name:b,wireValue:w}=c,A=typeof b=="string"?Ga(b,l??{},o):b;return{wireValue:w,name:A}}}}function w0({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":A0(e)?"_"+e:e}function T0({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return am[e]}var E0=/^[0-9]/;function A0(e){return E0.test(e)}function I0(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let o=Wa(i)!=null||$a(i),c=Wa(t)!=null||$a(t);return o&&c})}function Wa(e){return R0.get(e.toUpperCase())}function $a(e){return N0.has(e.toUpperCase())}var N0=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),R0=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]),O0=[[/\[\]/g,"Array"]];function P0(e){return O0.reduce((t,[r,i])=>t.replace(r,i),e)}function um(e){let t=e.match(/^(_+)/),r=e.match(/(_+)$/),i=t?.[1]??"",o=r?.[1]??"";if(i.length+o.length>=e.length)return{leading:e,trailing:"",core:""};let c=e.slice(i.length,e.length-o.length||void 0);return{leading:i,trailing:o,core:c}}function gu(e,t){let{leading:r,trailing:i,core:o}=um(e);return r===""&&i===""?t(e):`${r}${t(o)}${i}`}n();a();s();function $i(e){return typeof e=="string"?e:e.wireValue}var Hi=class e{constructor(t){y(this,"casingsGenerator");this.casingsGenerator=om(t)}static fromLanguage(t,r){return new e({generationLanguage:t,keywords:void 0,smartCasing:r})}resolve(t){return this.casingsGenerator.generateName(t)}resolveNameOrString(t){return this.casingsGenerator.generateName(t)}resolveNameAndWireValue(t){return this.casingsGenerator.generateNameAndWireValue(t)}camel(t){return this.resolve(t).camelCase}camelSafe(t){return this.camel(t).safeName}camelUnsafe(t){return this.camel(t).unsafeName}pascal(t){return this.resolve(t).pascalCase}pascalSafe(t){return this.pascal(t).safeName}pascalUnsafe(t){return this.pascal(t).unsafeName}snake(t){return this.resolve(t).snakeCase}snakeSafe(t){return this.snake(t).safeName}snakeUnsafe(t){return this.snake(t).unsafeName}screamingSnake(t){return this.resolve(t).screamingSnakeCase}screamingSnakeSafe(t){return this.screamingSnake(t).safeName}screamingSnakeUnsafe(t){return this.screamingSnake(t).unsafeName}};n();a();s();var Ke=class extends ut{constructor(r){super();y(this,"value");this.value=r}write(r){typeof this.value=="string"?r.write(this.value):typeof this.value=="function"?this.value(r):this.value.write(r)}};var k0=4;Ul({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Ji=class{constructor(){y(this,"lineBuffer",[]);y(this,"indentLevel",0);y(this,"hasWrittenAnything",!1);y(this,"lastCharacterIsSemicolon",!1);y(this,"lastCharacterIsNewline",!1);y(this,"nodeStackFrames",[])}get buffer(){return je&&this.nodeStackFrames.length>0&&this.writeInternal(`
6
6
  `),this.lineBuffer.join(`
7
7
  `)+(this.lastCharacterIsNewline?`
8
8
  `:"")}write(...t){for(let r of t)if(r!=null)if(typeof r=="string"){let i=r.length>0&&r.endsWith(`
@@ -30,7 +30,7 @@ ${Mi(this).map(r=>` ${r.fn} - ${r.path}:${r.position}`).join(`
30
30
  `),this.hasSameAccess(this.init)||r.write(`${this.init} `),r.writeTextStatement("init"),r.writeNoIndent(`#else
31
31
  `),r.writeTextStatement("set"),r.writeNoIndent(`#endif
32
32
  `)):(this.hasSameAccess(this.init)||r.write(`${this.init} `),this.accessors?.init?(r.write("init"),r.write(" => "),this.accessors.init(r),r.writeTextStatement("")):r.write("init; "))),this.set&&(this.hasSameAccess(this.set)||r.write(`${this.set} `),this.accessors?.set?(r.write("set"),r.write(" => "),this.accessors.set(r),r.writeTextStatement("")):r.write("set; ")),r.write("}")),this.initializer!=null?(c?r.write(" => "):r.write(" = "),this.initializer.write(r),r.writeLine(";")):!this.skipDefaultInitializer&&!i&&o?v.Type(this.type)&&this.type.writeEmptyCollectionInitializer(r):!this.get&&!this.init&&r.writeLine(";")}hasSameAccess(r){return r===!0||r===this.access}};n();a();s();var Xe;(function(e){e[e.INSTANCE=0]="INSTANCE",e[e.STATIC=1]="STATIC"})(Xe||(Xe={}));var Gt=class e extends Ct{constructor({name:r,isAsync:i,override:o,access:c,return_:l,body:b,noBody:w,bodyType:A,summary:I,doc:P,type:L,classReference:R,parameters:F,typeParameters:U,annotations:M,codeExample:W,interfaceReference:z,origin:oe,enclosingType:H},K){super({enclosingType:H},oe,K);y(this,"name");y(this,"isAsync");y(this,"access");y(this,"return");y(this,"noBody");y(this,"body");y(this,"bodyType");y(this,"summary");y(this,"doc");y(this,"type");y(this,"reference");y(this,"override");y(this,"parameters");y(this,"typeParameters");y(this,"annotations");y(this,"interfaceReference");this.name=r,this.isAsync=i??!1,this.override=o??!1,this.access=c,this.return=l,this.noBody=w??!1,this.body=b,this.bodyType=A??e.BodyType.Statement,this.summary=I,this.doc=this.csharp.xmlDocBlockOf(P??{summary:I,codeExample:W}),this.type=L??Xe.INSTANCE,this.reference=R,this.parameters=F??[],this.typeParameters=U??[],this.annotations=(M??[]).map(C=>C instanceof _e?this.csharp.annotation({reference:C}):C),this.interfaceReference=z}get isAsyncEnumerable(){return v.AsyncEnumerable(this.return)}addParameter(r){return r instanceof Ye||(r=new Ye(r,this.generation)),this.parameters.push(r),r}write(r){if(r.writeNode(this.doc),this.annotations.forEach(i=>{i.write(r)}),r.writeNewLineIfLastLineNot(),this.access&&r.write(`${this.access} `),this.type===Xe.STATIC&&r.write("static "),this.isAsync&&r.write("async "),this.override&&r.write("override "),this.return==null?this.isAsync?(r.writeNode(this.System.Threading.Tasks.Task()),r.write(" ")):r.write("void "):(this.isAsync&&!this.isAsyncEnumerable?r.writeNode(this.System.Threading.Tasks.Task(this.return)):this.return.write(r),r.write(" ")),this.interfaceReference&&r.write(`${this.interfaceReference.name}.`),r.write(this.name),this.typeParameters.length>0&&(r.write("<"),this.typeParameters.forEach((i,o)=>{i.write(r),o<this.typeParameters.length-1&&r.write(", ")}),r.write(">")),r.write("("),this.parameters.forEach((i,o)=>{i.write(r),o<this.parameters.length-1&&r.write(", ")}),r.write(")"),this.noBody)r.writeLine(";");else switch(this.bodyType){case e.BodyType.Statement:r.write(" "),r.pushScope(),this.body?.write(r),r.popScope();break;case e.BodyType.Expression:r.write(" => "),this.body?.write(r),r.writeSemicolonIfLastCharacterIsNot();break;default:ue(this.bodyType)}}getParameters(){return this.parameters}};(function(e){e.BodyType={Statement:"statement",Expression:"expression"}})(Gt||(Gt={}));var Ti=class extends Be{constructor({name:r,namespace:i,access:o,partial:c,interfaceReferences:l,enclosingType:b,origin:w},A){super(w,A);y(this,"access");y(this,"partial");y(this,"reference");y(this,"interfaceReferences");y(this,"fields",[]);y(this,"methods",[]);r=r||(w?this.model.getClassNameFor(w):de("Class/Interface name or origin is required")),this.reference=b?this.csharp.classReference({name:r,enclosingType:b}):this.csharp.classReference({name:r,namespace:i||de("Class/Interface: Namespace or enclosingType is required ")}),this.access=o,this.partial=c??!1,this.interfaceReferences=l??[]}get name(){return this.reference.name}get namespace(){return this.reference.namespace}get enclosingType(){return this.reference.enclosingType}get isNested(){return this.enclosingType!=null}explicit(r){return this.origin?this.model.explicit(v.Provenance(this.origin)?this.origin.node:this.origin,r):de(`Cannot create explicit named member '${r}' on '${this.name}' because the class is not bound to an origin.`)}getField(r){return this.fields.find(i=>this.model.provenance(i.origin)?.jsonPath===r.jsonPath)}addField(r){r.enclosingType=this.reference;let i=new wi(r,this.generation);return this.fields.push(i),i}addMethod(r){r.enclosingType=this.reference;let i=new Gt(r,this.generation);return this.methods.push(i),i}get multipartMethodName(){return"AddJsonPart"}get multipartMethodNameForCollection(){return"AddJsonParts"}get isOptional(){return!1}get isCollection(){return!1}get isReferenceType(){}asOptional(){return new $e(this,this.generation)}asNullable(){return new nr(this,this.generation)}asNonOptional(){return this}get defaultValue(){return this.csharp.Literal.null()}get fullyQualifiedName(){return this.reference.fullyQualifiedName}};var ve=class ve extends Ti{constructor({name:r,namespace:i,access:o,static_:c,abstract_:l,sealed:b,partial:w,readonly:A,parentClassReference:I,interfaceReferences:P,enclosingType:L,type:R,summary:F,doc:U,annotations:M,primaryConstructor:W,skipNamespaceDeclaration:z,origin:oe},H){super({name:r,namespace:i,access:o,partial:w,interfaceReferences:P,enclosingType:L,origin:oe},H);y(this,"static_");y(this,"abstract_");y(this,"sealed");y(this,"readonly");y(this,"parentClassReference");y(this,"type");y(this,"summary");y(this,"doc");y(this,"annotations",[]);y(this,"primaryConstructor");y(this,"namespaceReferences",[]);y(this,"skipNamespaceDeclaration");y(this,"constructors",[]);y(this,"operators",[]);y(this,"nestedClasses",[]);y(this,"nestedInterfaces",[]);y(this,"rawBodyBlocks",[]);this.skipNamespaceDeclaration=z??!1,this.static_=c??!1,this.abstract_=l??!1,this.sealed=b??!1,this.readonly=A??!1,this.type=R??ve.ClassType.Class,this.summary=F,this.doc=this.csharp.xmlDocBlockOf(U??{summary:F}),this.parentClassReference=I,this.annotations=(M??[]).map(K=>K instanceof _e?this.csharp.annotation({reference:K}):K),this.primaryConstructor=W}addConstructor(r){let i=new ve.Constructor(r,this.generation);return this.constructors.push(i),i}addNestedClass(r){if(r instanceof ve||(r.enclosingType=this.reference,r=new ve(r,this.generation)),!r.isNested)throw new Error(`Set the enclosingType of the class ${this.name} to add the nested class ${r.name}.`);return this.nestedClasses.push(r),r}addNestedClasses(r){r.forEach(i=>{i instanceof ve?this.addNestedClass(i):this.addNestedClass(i)})}addAnnotation(r){return r instanceof gt||(r=new gt(r,this.generation)),this.annotations.push(r),r}addOperator(r){this.operators.push(r)}addOperators(r){r.forEach(i=>this.addOperator(i))}addRawBodyContent(r){this.rawBodyBlocks.push(r)}write(r){if(this.namespaceReferences.forEach(i=>{r.addNamespace(i)}),!this.isNested&&!this.skipNamespaceDeclaration&&(r.writeLine(`namespace ${this.namespace};`),r.newLine()),r.writeNode(this.doc),this.annotations.forEach(i=>{i.write(r)}),this.skipNamespaceDeclaration||r.writeNewLineIfLastLineNot(),r.write(`${this.access}`),this.static_&&r.write(" static"),this.abstract_&&r.write(" abstract"),this.sealed&&r.write(" sealed"),this.readonly&&r.write(" readonly"),this.partial&&r.write(" partial"),r.write(` ${this.type}`),r.write(` ${this.name}`),this.primaryConstructor!=null&&this.primaryConstructor.parameters.length>0){let i=this.primaryConstructor;r.write("("),i.parameters.forEach((o,c)=>{c>0&&r.write(","),o.write(r)}),r.write(")")}if(this.parentClassReference!=null||this.interfaceReferences.length>0){if(r.write(" : "),this.parentClassReference!=null&&(this.parentClassReference.write(r),this.interfaceReferences.length>0&&r.write(", ")),this.primaryConstructor!=null&&this.primaryConstructor.superClassArguments.length>0){let i=this.primaryConstructor;r.write("("),this.primaryConstructor.superClassArguments.forEach((o,c)=>{o.write(r),c<i.superClassArguments.length-1&&r.write(", ")}),r.write(")")}this.interfaceReferences.forEach((i,o)=>{i.write(r),o<this.interfaceReferences.length-1&&r.write(", ")})}if(!this.hasBody()){r.write(";");return}r.writeNewLineIfLastLineNot(),r.pushScope(),r.pushTypeScope(this.reference.fullyQualifiedName),this.writeConsts(r),this.writeFieldFields(r),this.writeConstructors(r),this.writeProperties(r),this.writeMethods(r),this.writeOperators(r),this.writeRawBodyBlocks(r),this.writeNestedClasses(r),this.writeNestedInterfaces(r),r.popTypeScope(),r.popScope()}hasBody(){return this.fields.length>0||this.constructors.length>0||this.nestedClasses.length>0||this.nestedInterfaces.length>0||this.methods.length>0||this.operators.length>0||this.rawBodyBlocks.length>0}writeConstructors(r){this.constructors.forEach(i=>{r.writeNode(this.csharp.xmlDocBlockOf(i.doc)),i.annotations.forEach(o=>{o.write(r),r.writeNewLineIfLastLineNot()}),r.write(`${i.access} ${this.name} (`),i.parameters.forEach((o,c)=>{o.write(r),c<i.parameters.length-1&&r.write(", ")}),r.write(")"),i.baseConstructorCall!=null&&(r.write(" : "),i.baseConstructorCall.write(r)),r.pushScope(),i.body.write(r),r.popScope(),r.newLine()})}writeFields({writer:r,fields:i}){i.forEach((o,c)=>{o.write(r),r.writeNewLineIfLastLineNot(),c<this.fields.length-1&&r.newLine()})}writeConsts(r){this.writeFields({writer:r,fields:this.getFields().sort(Ei).sort(Zu).filter(this.fieldConstFilter())})}writeFieldFields(r){this.writeFields({writer:r,fields:this.getFields().sort(Ei).sort(Zu).filter(this.fieldFieldFilter())})}writeProperties(r){this.writeFields({writer:r,fields:this.getFields().sort(Ei).sort(Zu).filter(this.fieldPropertyFilter())})}writeMethods(r){this.methods.sort(Ei).sort(qy).sort(zy).forEach(i=>{i.write(r),r.writeNewLineIfLastLineNot(),r.newLine()})}writeOperators(r){this.operators.forEach(i=>{this.writeOperator({writer:r,operator:i}),r.newLine()})}writeRawBodyBlocks(r){this.rawBodyBlocks.forEach(i=>{i.write(r),r.writeNewLineIfLastLineNot()})}writeNestedClasses(r){this.nestedClasses.sort(Ei).forEach((i,o)=>{i.write(r),r.writeNewLineIfLastLineNot(),o<this.fields.length-1&&r.newLine()})}writeNestedInterfaces(r){this.nestedInterfaces.sort(Ei).forEach((i,o)=>{i.write(r),r.writeNewLineIfLastLineNot(),o<this.fields.length-1&&r.newLine()})}fieldConstFilter(){return r=>r.isConst}fieldFieldFilter(){return r=>r.isField}fieldPropertyFilter(){return r=>r.isProperty}getFields(){return this.fields}get isReferenceType(){return this.type===ve.ClassType.Class||this.type===ve.ClassType.Record}writeOperator({writer:r,operator:i}){if(r.write("public static "),i.type===ve.CastOperator.Type.Explicit||i.type===ve.CastOperator.Type.Implicit){r.write(`${i.type} `),r.write("operator ");let o=i.to??this.reference;r.writeNode(o),r.write("("),i.parameter.write(r)}else{let o=i;o.return.write(r),r.write(" operator "),r.write(`${i.type}(`),o.parameters.forEach((c,l)=>{c.write(r),l<o.parameters.length-1&&r.write(", ")})}i.useExpressionBody?(r.write(") => "),r.writeNodeStatement(i.body)):(r.write(") {"),r.writeNode(i.body),r.writeLine("}"))}addNamespaceReference(r){this.namespaceReferences.push(r)}};y(ve,"ClassType",{Class:"class",Record:"record",Struct:"struct",RecordStruct:"record struct"}),y(ve,"Access",ge);var nt=ve;(function(e){class t{constructor({doc:o,body:c,parameters:l,access:b,baseConstructorCall:w,annotations:A},I){y(this,"generation");y(this,"doc");y(this,"body");y(this,"parameters");y(this,"access");y(this,"baseConstructorCall");y(this,"annotations");this.generation=I,this.parameters=l??[],this.access=b??ge.Public,this.doc=o,this.annotations=A??[],this.body=new vt({},this.generation),c!=null&&this.body.append(c),this.baseConstructorCall=w}addParameter(o){let c=new Ye(o,this.generation);return this.parameters.push(c),c}}e.Constructor=t;let r;(function(i){i.Type={Implicit:"implicit",Explicit:"explicit"}})(r=e.CastOperator||(e.CastOperator={}))})(nt||(nt={}));function td(e){switch(e){case void 0:return 0;case ge.Private:return 1;case ge.Protected:return 2;case ge.Internal:return 3;case ge.Public:return 4}}function Ei(e,t){return td(e.access)-td(t.access)}function Zu(e,t){return e.isStatic===t.isStatic?0:e.isStatic?-1:1}function zy(e,t){return e.type===Xe.STATIC&&t.type!==Xe.STATIC?-1:e.type!==Xe.STATIC&&t.type===Xe.STATIC?1:0}function qy(e,t){return e.name==="FromProto"||e.name==="ToProto"?t.name==="Equals"||t.name==="ToString"?-1:1:t.name==="FromProto"||t.name==="ToProto"?e.name==="Equals"||e.name==="ToString"?1:-1:e.name==="ToString"?1:t.name==="ToString"?-1:e.name==="Equals"?t.name==="ToString"?-1:1:t.name==="Equals"?e.name==="ToString"?1:-1:0}n();a();s();var Ai=class extends Be{constructor({name:r,namespace:i,access:o,annotations:c,origin:l},b){super(l,b);y(this,"access");y(this,"reference");y(this,"annotations");y(this,"fields",[]);y(this,"generateSerializer",!1);y(this,"serializerClassReference");this.reference=this.csharp.classReference({name:r,namespace:i,origin:l}),this.access=o,this.annotations=c??[]}get name(){return this.reference.name}get namespace(){return this.reference.namespace}getNamespace(){return this.namespace}addAnnotation(r){this.annotations.push(r)}addMember(r){this.fields.push({name:r.name,wireValue:r.value,value:this.csharp.annotation({reference:this.System.Runtime.Serialization.EnumMember,argument:this.csharp.codeblock(i=>{i.write("Value = "),i.writeNode(this.csharp.string_({string:r.value}))})})})}enableSerializerGeneration(){return this.generateSerializer=!0,this.serializerClassReference=this.csharp.classReference({name:`${this.name}Serializer`,namespace:this.namespace}),this.serializerClassReference}write(r){r.writeLine(`namespace ${this.namespace};`),r.newLine();for(let i of this.annotations)i.write(r);r.writeNewLineIfLastLineNot(),r.write(`${this.access} `),r.write("enum "),r.writeLine(`${this.name}`),r.pushScope(),this.fields.forEach((i,o)=>{i.value.write(r),r.write(i.name),o<this.fields.length-1&&(r.writeLine(","),r.newLine())}),r.writeNewLineIfLastLineNot(),r.popScope(),this.generateSerializer&&this.writeSerializerClass(r)}writeSerializerClass(r){r.newLine(),r.writeLine(`internal class ${this.name}Serializer : global::System.Text.Json.Serialization.JsonConverter<${this.name}>`),r.pushScope(),r.writeLine(`private static readonly global::System.Collections.Generic.Dictionary<string, ${this.name}> _stringToEnum = new()`),r.pushScope();for(let i of this.fields)r.writeLine(`{ ${JSON.stringify($i(i))}, ${this.name}.${i.name} },`);r.popScope(!1),r.writeLine(";"),r.newLine(),r.writeLine(`private static readonly global::System.Collections.Generic.Dictionary<${this.name}, string> _enumToString = new()`),r.pushScope();for(let i of this.fields)r.writeLine(`{ ${this.name}.${i.name}, ${JSON.stringify($i(i))} },`);r.popScope(!1),r.writeLine(";"),r.newLine(),r.writeLine(`public override ${this.name} Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)`),r.pushScope(),r.writeLine('var stringValue = reader.GetString() ?? throw new global::System.Exception("The JSON value could not be read as a string.");'),r.writeLine("return _stringToEnum.TryGetValue(stringValue, out var enumValue) ? enumValue : default;"),r.popScope(),r.newLine(),r.writeLine(`public override void Write(global::System.Text.Json.Utf8JsonWriter writer, ${this.name} value, global::System.Text.Json.JsonSerializerOptions options)`),r.pushScope(),r.writeLine("writer.WriteStringValue(_enumToString.TryGetValue(value, out var stringValue) ? stringValue : null);"),r.popScope(),r.newLine(),r.writeLine(`public override ${this.name} ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)`),r.pushScope(),r.writeLine('var stringValue = reader.GetString() ?? throw new global::System.Exception("The JSON property name could not be read as a string.");'),r.writeLine("return _stringToEnum.TryGetValue(stringValue, out var enumValue) ? enumValue : default;"),r.popScope(),r.newLine(),r.writeLine(`public override void WriteAsPropertyName(global::System.Text.Json.Utf8JsonWriter writer, ${this.name} value, global::System.Text.Json.JsonSerializerOptions options)`),r.pushScope(),r.writeLine("writer.WritePropertyName(_enumToString.TryGetValue(value, out var stringValue) ? stringValue : value.ToString());"),r.popScope(),r.popScope()}};n();a();s();var Ii=class extends Ti{constructor({name:t,namespace:r,access:i,partial:o,interfaceReferences:c,enclosingType:l,origin:b},w){super({name:t,namespace:r,access:i,partial:o,interfaceReferences:c,enclosingType:l,origin:b},w)}write(t){this.isNested||(t.writeLine(`namespace ${this.namespace};`),t.newLine()),t.write(`${this.access} `),this.partial&&t.write("partial "),t.write("interface "),t.writeLine(`${this.name}`),this.interfaceReferences.length>0&&(t.write(" : "),this.interfaceReferences.forEach((r,i)=>{r.write(t),i<this.interfaceReferences.length-1&&t.write(", ")})),t.pushScope();for(let r of this.fields)r.write(t),t.writeLine("");t.dedent(),t.indent();for(let r of this.methods)r.write(t),t.writeLine("");t.popScope()}};n();a();s();var Ni=class extends Be{constructor({name:r,namespace:i,parentClassReference:o,origin:c},l){super(c,l);y(this,"reference");y(this,"parentClassReference");y(this,"testMethods",[]);this.reference=this.csharp.classReference({name:r,namespace:i,origin:c}),this.parentClassReference=o}get name(){return this.reference.name}get namespace(){return this.reference.namespace}write(r){r.writeNode(this.getClass())}getClass(){let r=[this.NUnit.Framework.TestFixture,this.csharp.annotation({reference:this.NUnit.Framework.Parallelizable,argument:"ParallelScope.Self"})],i=new nt({access:ge.Public,name:this.name,namespace:this.namespace,annotations:r,parentClassReference:this.parentClassReference,origin:this.origin},this.generation);for(let o of this.testMethods)i.addMethod({access:ge.Public,isAsync:o.isAsync,name:o.name,parameters:[],body:o.body,annotations:[this.NUnit.Framework.Test]});return i}addTestMethod(r){this.testMethods.push(r)}};n();a();s();n();a();s();n();a();s();n();a();s();var ec={System:["AccessViolationException","Action","Activator","AggregateException","AppContext","AppDomain","AppDomainSetup","AppDomainUnloadedException","ApplicationException","ApplicationId","ArgIterator","ArgumentException","ArgumentNullException","ArgumentOutOfRangeException","ArithmeticException","Array","ArrayTypeMismatchException","AssemblyLoadEventArgs","AssemblyLoadEventHandler","AsyncCallback","Attribute","AttributeTargets","AttributeUsageAttribute","BadImageFormatException","Base64FormattingOptions","BitConverter","Boolean","Buffer","Byte","CannotUnloadAppDomainException","Char","CharEnumerator","CLSCompliantAttribute","Console","ConsoleCancelEventArgs","ConsoleCancelEventHandler","ConsoleColor","ConsoleKey","ConsoleKeyInfo","ConsoleModifiers","ConsoleSpecialKey","ContextBoundObject","ContextMarshalException","ContextStaticAttribute","Convert","CultureAwareComparer","DataMisalignedException","DateOnly","DateTime","DateTimeKind","DateTimeOffset","DayOfWeek","DBNull","Decimal","Delegate","DivideByZeroException","DllNotFoundException","Double","DuplicateWaitObjectException","EntryPointNotFoundException","Enum","Environment","EnvironmentVariableTarget","EventArgs","EventHandler","Exception","ExecutionEngineException","FieldAccessException","FlagsAttribute","FormatException","FormattableString","GC","GCCollectionMode","GCGenerationInfo","GCKind","GCMemoryInfo","GCNotificationStatus","Guid","Half","HashCode","IAsyncDisposable","IAsyncResult","ICloneable","IComparable","IConvertible","ICustomFormatter","IDisposable","IFormatProvider","IFormattable","Index","IndexOutOfRangeException","InsufficientExecutionStackException","InsufficientMemoryException","Int128","Int16","Int32","Int64","IntPtr","InvalidCastException","InvalidOperationException","InvalidProgramException","InvalidTimeZoneException","ISpanFormattable","IUtf8SpanFormattable","LoaderOptimization","LoaderOptimizationAttribute","LocalDataStoreSlot","MarshalByRefObject","Math","MathF","MemberAccessException","MemoryExtensions","MethodAccessException","MidpointRounding","MissingFieldException","MissingMemberException","MissingMethodException","ModuleHandle","MTAThreadAttribute","MulticastDelegate","MulticastNotSupportedException","NonSerializedAttribute","NotFiniteNumberException","NotImplementedException","NotSupportedException","Nullable","NullReferenceException","Object","ObjectDisposedException","ObsoleteAttribute","OperatingSystem","OperationCanceledException","OrdinalComparer","OutOfMemoryException","OverflowException","ParamArrayAttribute","PlatformID","PlatformNotSupportedException","Random","Range","RankException","ResolveEventArgs","ResolveEventHandler","RuntimeArgumentHandle","RuntimeFieldHandle","RuntimeMethodHandle","RuntimeTypeHandle","SByte","SerializableAttribute","Single","StackOverflowException","STAThreadAttribute","String","StringComparer","StringComparison","StringNormalizationExtensions","StringSplitOptions","SystemException","ThreadStaticAttribute","TimeOnly","TimeoutException","TimeProvider","TimeSpan","TimeZone","TimeZoneInfo","TimeZoneNotFoundException","Tuple","TupleExtensions","Type","TypeAccessException","TypeCode","TypedReference","TypeInitializationException","TypeLoadException","TypeUnloadedException","UInt128","UInt16","UInt32","UInt64","UIntPtr","UnauthorizedAccessException","UnhandledExceptionEventArgs","UnhandledExceptionEventHandler","UnitySerializationHolder","ValueTuple","ValueType","Version","Void","WeakReference","Buffers","Collections","ComponentModel","Diagnostics","Globalization","IO","Linq","Net","Numerics","Reflection","Resources","Runtime","Security","Text","Threading"],"System.Collections.Generic":["ByteEqualityComparer","CollectionExtensions","IEnumerable","KeyNotFoundException","KeyValuePair","NonRandomizedStringEqualityComparer","ReferenceEqualityComparer"],"System.IO":["BinaryReader","BinaryWriter","BufferedStream","Directory","DirectoryInfo","DirectoryNotFoundException","EndOfStreamException","EnumerationOptions","File","FileAccess","FileAttributes","FileInfo","FileLoadException","FileMode","FileNotFoundException","FileOptions","FileShare","FileStream","FileStreamOptions","FileSystemInfo","HandleInheritability","InvalidDataException","IOException","MatchCasing","MatchType","MemoryStream","Path","PathTooLongException","RandomAccess","SearchOption","SeekOrigin","Stream","StreamReader","StreamWriter","StringReader","StringWriter","TextReader","TextWriter","UnixFileMode","UnmanagedMemoryAccessor","UnmanagedMemoryStream","System.IO.Enumeration"],"System.Linq":["Enumerable"],"System.Net.Http":["HttpClient","HttpMethod"],"System.Threading":["AbandonedMutexException","ApartmentState","AsyncFlowControl","AutoResetEvent","CancellationToken","CancellationTokenRegistration","CancellationTokenSource","CompressedStack","ContextCallback","EventResetMode","EventWaitHandle","ExecutionContext","Interlocked","IOCompletionCallback","IThreadPoolWorkItem","ITimer","LazyInitializer","LazyThreadSafetyMode","Lock","LockRecursionException","LockRecursionPolicy","ManualResetEvent","ManualResetEventSlim","Monitor","Mutex","NativeOverlapped","Overlapped","ParameterizedThreadStart","PeriodicTimer","PreAllocatedOverlapped","ReaderWriterLockSlim","RegisteredWaitHandle","Semaphore","SemaphoreFullException","SemaphoreSlim","SendOrPostCallback","SpinLock","SpinWait","SynchronizationContext","SynchronizationLockException","Thread","ThreadAbortException","ThreadExceptionEventArgs","ThreadExceptionEventHandler","ThreadInterruptedException","ThreadPool","ThreadPoolBoundHandle","ThreadPriority","ThreadStart","ThreadStartException","ThreadState","ThreadStateException","Timeout","Timer","TimerCallback","Volatile","WaitCallback","WaitHandle","WaitHandleCannotBeOpenedException","WaitHandleExtensions","WaitOrTimerCallback","Tasks"],"System.Threading.Tasks":["ConcurrentExclusiveSchedulerPair","ConfigureAwaitOptions","Task","TaskAsyncEnumerableExtensions","TaskCanceledException","TaskCompletionSource","TaskContinuationOptions","TaskCreationOptions","TaskExtensions","TaskFactory","TaskScheduler","TaskSchedulerException","TaskStatus","TaskToAsyncResult","UnobservedTaskExceptionEventArgs","ValueTask","Sources"]};var Gy=new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while"]);var Wy=new Set(["from","where","select","orderby","groupby","into","let","join","on","equals"]),$y=new Set(["async","await"]),Hy=new Set(["yield"]),Jy=new Set(["var","dynamic"]),Ky=new Set(["using","alias"]);var Qy=new Set(["required","scoped","unmanaged","managed"]),Yy=new Set(["when","and","or","not"]),Xy=new Set(["Equals","GetHashCode","ToString","GetType","MemberwiseClone","Finalize"]),Zy=new Set([...Gy,...Wy,...$y,...Hy,...Jy,...Ky,...Qy,...Yy]),xo=class{constructor(t,r,i){y(this,"registry");y(this,"name");y(this,"jsonPath");this.registry=t,this.name=r,this.jsonPath=i}};var So=class{constructor(t){y(this,"scope");y(this,"byName",new Map);y(this,"byPath",new Map);y(this,"redirections",new Map);this.scope=t}[Symbol.iterator](){return this.byName.values()}has(t){return this.byName.has(t)}getByJsonPath(t){return this.byPath.get(t)}getByName(t){return this.byName.get(t)}getRedirectedName(t){return this.redirections.get(t)}set(t){this.byName.has(t.name)&&de(`set: ${t.name} in ${this.scope.fullyQualifiedName} already exists`),t.jsonPath&&this.byPath.has(t.jsonPath)&&de(`set: ${t.name} in ${this.scope.fullyQualifiedName} already exists by jsonPath`),this.byName.set(t.name,t),t.jsonPath&&this.byPath.set(t.jsonPath,t)}redirect(t,r){this.redirections.has(t)&&de(`redirect: ${t} in ${this.scope.fullyQualifiedName} already has a redirect`),this.redirections.set(t,r)}},tc=class extends xo{constructor(r,i,o,c){super(r,i);y(this,"namespace");y(this,"fullyQualifiedName");y(this,"fields");y(this,"methods");this.namespace=o,this.fullyQualifiedName=c,this.fields=new So(this),this.methods=new So(this)}isKeyword(r){return Zy.has(r)}isBuiltinMemberName(r){return Xy.has(r)}isTypeName(r){return this.name===r}isField(r){return this.fields.has(r)}isMethod(r){return this.methods.has(r)}isMember(r){return this.isField(r)||this.isMethod(r)}nameBlocked(r){if(this.isKeyword(r))return"keyword";if(this.isBuiltinMemberName(r))return"builtin";if(this.isTypeName(r))return"typeName";if(this.isField(r))return"field";if(this.isMethod(r))return"method"}getAlternativeName(r){let i=`${r}_`,o=2;for(;this.nameBlocked(i);)i=`${r}_${o}`,o++;return i}getFieldByJsonPath(r){return r!==void 0?this.fields.getByJsonPath(r):void 0}getFieldByName(r){return this.fields.getByName(r)}getRedirectedFieldName(r){return this.fields.getRedirectedName(r)}registerField(r,i,o){let c=this.registry.model.jsonPath(i);if(c){let w=this.fields.getByJsonPath(c);if(w)return w.name}let l=this.fields.getByName(r);if(l&&c===l.jsonPath)return r;switch(this.nameBlocked(r)){case"field":i&&v.Provenance(i)&&i.explicit||de(`Field ${r} already exists - attempting to add a duplicate field with the same name that is not an explicitly named property`);break;case"keyword":case"builtin":case"typeName":case"method":break;default:return this.fields.set(new wo(this.registry,r,this,c,o)),this.registry.setFieldNameShortcut(c,r),r}let b=this.getAlternativeName(r);return this.fields.set(new wo(this.registry,b,this,c,o)),this.fields.redirect(r,b),this.registry.setFieldNameShortcut(c,b),b}getFieldName(r,i){let o=this.getFieldByJsonPath(this.registry.model.jsonPath(r))?.name;if(o)return o;if(v.Provenance(r)){let b=this.getRedirectedFieldName(i);if(b)return b;let w=this.getFieldByName(i);return w?this.registry.model.provenance(w.jsonPath)?.explicit?i:`${i}_`:i}let c=this.getFieldByName(i);if(c)return this.registry.model.provenance(c.jsonPath)?.explicit?i:c.name;let l=this.getRedirectedFieldName(i);if(l)return l;this.isMethod(i)}},rc=class extends xo{constructor(r,i,o,c){super(r,i,c);y(this,"scope");this.scope=o}},wo=class extends rc{constructor(r,i,o,c,l){super(r,i,o,c);y(this,"field");this.field=l}};var Oi=class e{constructor(t){y(this,"generation");y(this,"classReferenceByJsonPath",new Map);y(this,"typeRegistry",new Map);y(this,"namespaceRegistry",new Map);y(this,"typeNames",new Map);y(this,"namespaceNames",new Map);y(this,"nestedTypeShadows",new Map);y(this,"implicitNamespaces",new Set);y(this,"shortcuts",new Map);y(this,"knownBuiltInIdentifiers",new Set(["Text","Json","Xml","Security","Collections","Data","Diagnostics","Globalization","Math","Reflection","Runtime","Security","Serialization","Threading","Xml"]));this.generation=t,this.initializeBuiltIns()}get csharp(){return this.generation.csharp}get model(){return this.generation.model}initializeBuiltIns(){for(let[t,r]of Object.entries(ec))t.split(".").forEach(i=>this.knownBuiltInIdentifiers.add(i)),r.forEach(i=>this.knownBuiltInIdentifiers.add(i));for(let[t,r]of Object.entries(ec)){for(let o of r)this.typeNames.set(o,new Set([t]));let i=t.split(".")[0];i&&this.typeNames.set(i,new Set([t]))}this.typeNames.set("System",new Set(["System"])),this.typeNames.set("NUnit",new Set(["NUnit"])),this.typeNames.set("OneOf",new Set(["OneOf"])),this.knownBuiltInIdentifiers.add("NUnit"),this.knownBuiltInIdentifiers.add("OneOf")}setFieldNameShortcut(t,r){if(t){let i=this.shortcuts.get(t);i&&i!==r&&de(`BAD_BAD_BAD setFieldNameShortcut: ${t} already has a name: ${i} - while setting to ${r} - if this is happening, then you could be getting back the wrong name later!`),this.shortcuts.set(t,r)}}getFieldNameByOrigin(t){return this.shortcuts.get(this.model.jsonPath(t)??">ignore<")}isKnownBuiltInIdentifier(t){return!t||typeof t!="string"?!1:this.knownBuiltInIdentifiers.has(t)}isKnownNamespace(t){return!t||typeof t!="string"?!1:this.namespaceRegistry.has(t)}isRegisteredTypeName(t){return this.typeRegistry.has(t)}isAmbiguousTypeName(t){return t?(this.typeNames.get(t)?.size??0)>1:!1}isAmbiguousNamespaceName(t){return t?(this.namespaceNames.get(t)?.size??0)>1:!1}hasTypeNamespaceConflict(t){return!t||this.knownBuiltInIdentifiers.has(t)?!1:this.typeNames.has(t)&&(this.namespaceNames.get(t)?.has("")??!1)}hasNestedTypeShadowInScope(t,r){if(!t||this.knownBuiltInIdentifiers.has(t))return!1;let i=this.nestedTypeShadows.get(t);return i?r.some(o=>i.has(o)):!1}static fullyQualifiedNameOf(t){return t.enclosingType?`${t.enclosingType.fullyQualifiedName??`${t.namespace}.${t.enclosingType.name}`}+${t.name}`:`${t.namespace}.${t.name}`}registerNamespace(t,r){this.namespaceRegistry.has(t)&&this.namespaceRegistry.get(t)!==r||this.namespaceRegistry.set(t,r)}trackType(t,r){let{name:i,namespace:o,enclosingType:c,fullyQualifiedName:l,origin:b}=t;if(b){let w=this.model.jsonPath(b)??de(`JsonPath not found for origin: ${JSON.stringify(b).substring(0,100)}`);this.classReferenceByJsonPath.set(w,t)}if(r&&r!==l&&!this.typeRegistry.has(r)&&this.typeRegistry.set(r,t),!this.typeRegistry.has(l)){this.typeRegistry.set(l,t);for(let w of this.allNamespacesOf(o))this.registerNamespace(w,w);if(!c)this.trackTypeName(i,o);else if(i===o.split(".")[0]){let w=this.nestedTypeShadows.get(i);w||(w=new Set,this.nestedTypeShadows.set(i,w)),w.add(c.fullyQualifiedName)}for(let w of[this.generation.namespaces.root,...this.implicitNamespaces])if(o.startsWith(w)){let A=o.split(".")[w.split(".").length];A&&this.trackTypeName(A,o)}}return t}addImplicitNamespace(t){this.implicitNamespaces.add(t)}isNamespaceImplicit(t){return this.implicitNamespaces.has(t)}get implicitlyImportedNamespaces(){return[...this.implicitNamespaces]}trackTypeName(t,r){this.typeNames.has(t)?this.typeNames.get(t)?.add(r):this.typeNames.set(t,new Set([r]));let i=r.split("."),o="";for(let c of i)this.namespaceNames.has(c)?this.namespaceNames.get(c)?.add(o):this.namespaceNames.set(c,new Set([o])),o=o?`${o}.${c}`:c}allNamespacesOf(t){if(!t||typeof t!="string")return new Set;let r="",i=new Set;for(let o of t.split("."))o.trim()&&(r=r?`${r}.${o}`:`${o}`,i.add(r));return i}registerClassReference(t,r){let{name:i,namespace:o,enclosingType:c,origin:l}=t,b=this.model.jsonPath(l),w=(b?this.classReferenceByJsonPath.get(b):void 0)??this.typeRegistry.get(r),A=this.model.jsonPath(w?.origin),I=A&&b?A===b?"match":"mismatch":"no origin";if(w&&I!=="mismatch")return new _e({name:w.name,namespace:w.namespace,enclosingType:w.enclosingType,fullyQualifiedName:w.fullyQualifiedName,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,origin:w.origin??l,isCollection:w.isCollection,isReferenceType:w.isReferenceType,multipartMethodName:w.multipartMethodName,multipartMethodNameForCollection:w.multipartMethodNameForCollection},w.scope,this.generation);let P=!1,L=this.resolveNamespace(o);L!==o&&(o=L,P=!0);let R;e:for(;;){R=e.fullyQualifiedNameOf({name:i,namespace:o,enclosingType:c});let F="",U=o.split(".");for(let M=0;M<U.length;M++)if(F=F?`${F}.${U[M]}`:`${U[M]}`,this.typeRegistry.has(F)){U[M]=`${U[M]}_`,o=U.join("."),P=!0;continue e}if(P&&this.registerNamespace(t.namespace,o),I==="mismatch"&&w?.name===i){i=`${i}_`,P=!0;continue e}if(this.namespaceRegistry.has(R)){i=`${i}_`,P=!0;continue e}if(this.typeRegistry.has(R)){i=`${i}_`,P=!0;continue e}if(c){let M=R.replaceAll("+",".");if(this.typeRegistry.has(M)){i=`${i}_`,P=!0;continue e}if(this.namespaceRegistry.has(M)){i=`${i}_`,P=!0;continue e}}else{let M=R.split(".");for(let W=1;W<M.length;W++){let z=M.slice(0,W).join(".")+"+"+M.slice(W).join("+");if(this.typeRegistry.has(z)){i=`${i}_`,P=!0;continue e}}}break}return this.trackType(new _e({name:i,namespace:o,enclosingType:c,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,fullyQualifiedName:R,origin:l,isCollection:t.isCollection,isReferenceType:t.isReferenceType,multipartMethodName:t.multipartMethodName,multipartMethodNameForCollection:t.multipartMethodNameForCollection},new tc(this,i,o,R),this.generation),r)}resolveNamespace(t){let r=this.namespaceRegistry.get(t);if(r!==void 0)return r;let i=t.split(".");for(let o=i.length-1;o>=0;o--){let c=i.slice(0,o).join(".");if(this.namespaceRegistry.has(c)){let l=this.namespaceRegistry.get(c);if(l!==void 0){let b=i.slice(o).join("."),w=`${l}.${b}`;return this.registerNamespace(t,w),w}}}return t}canonicalizeNamespace(t){let r=this.namespaceRegistry.get(t);if(r!==void 0)return r;let i=!1,o=t;e:for(;;){let c="",l=o.split(".");for(let b=0;b<l.length;b++)if(c=c?`${c}.${l[b]}`:`${l[b]}`,this.typeRegistry.has(c)){l[b]=`${l[b]}_`,o=l.join("."),i=!0;continue e}break}return i&&this.registerNamespace(t,o),o}};var To=class{constructor(t){y(this,"generation");y(this,"frozen",!1);y(this,"extraClassReferences",new Map);y(this,"InstantiatedPrimitive",{string:t=>new Ne({type:"string",value:t},this.generation),boolean:t=>new Ne({type:"boolean",value:t},this.generation),integer:t=>new Ne({type:"integer",value:t},this.generation),long:t=>new Ne({type:"long",value:t},this.generation),uint:t=>new Ne({type:"uint",value:t},this.generation),ulong:t=>new Ne({type:"ulong",value:t},this.generation),float:t=>new Ne({type:"float",value:t},this.generation),double:t=>new Ne({type:"double",value:t},this.generation),date:t=>new Ne({type:"date",value:t},this.generation),dateTime:(t,r=!0)=>new Ne({type:"dateTime",value:t,parse:r},this.generation),uuid:t=>new Ne({type:"uuid",value:t},this.generation),null:()=>new Ne({type:"null"},this.generation)});y(this,"Literal",{class_:({reference:t,fields:r})=>new Y.Class_(t,r,this.generation),dictionary:({keyType:t,valueType:r,entries:i})=>new Y.Dictionary(t,r,i,this.generation),list:({valueType:t,values:r})=>new Y.List(t,r,this.generation),set:({valueType:t,values:r})=>new Y.Set(t,r,this.generation),boolean:t=>new Y.Boolean(t,this.generation),float:t=>new Y.Float(t,this.generation),date:t=>new Y.Date(t,this.generation),datetime:t=>new Y.DateTime(t,this.generation),decimal:t=>new Y.Decimal(t,this.generation),double:t=>new Y.Double(t,this.generation),integer:t=>new Y.Integer(t,this.generation),long:t=>new Y.Long(t,this.generation),uint:t=>new Y.Uint(t,this.generation),ulong:t=>new Y.Ulong(t,this.generation),reference:t=>new Y.Reference(t,this.generation),string:t=>new Y.String(t,this.generation),null:()=>new Y.Null(this.generation),nop:()=>new Y.Nop(this.generation),unknown:t=>new Y.Unknown(t,this.generation)});y(this,"VALID_READ_ONLY_MEMORY_TYPES",new Set(["int","long","uint","ulong","string","bool","float","double"]));this.generation=t}get model(){return this.generation.model}classReference(t){return this.classReferenceInternal(t)}classReferenceInternal(t){if(!t.name&&"origin"in t&&t.origin&&(t.name=this.model.getClassNameFor(t.origin)),t.enclosingType){if(t.namespace&&t.namespace!==t.enclosingType.namespace)throw new Error("ClassReference: Both enclosingType and namespace cannot be provided");t.namespace=t.enclosingType.namespace}let r=Oi.fullyQualifiedNameOf(t);if(this.frozen&&!this.generation.registry.isRegisteredTypeName(r)){let i=this.extraClassReferences.get(r);i||(i=new Set,this.extraClassReferences.set(r,i)),i.add(`${r} -
33
- ${Ui()}`)}return this.generation.registry.registerClassReference(t,r)}freezeClassReferences(){this.frozen=!0}getPropertyName(t,r){let i=this.model.getPropertyNameFor(r),o=this.model.origin(r);if(o){let c=t.getFieldName(o,i);if(c)return c}return i}class_(t){let r=t;return"reference"in t&&(r={...t.reference,...t}),new nt(r,this.generation)}testClass(t){return new Ni(t,this.generation)}annotation(t){return new gt(t,this.generation)}annotationGroup(t){return new yi(t,this.generation)}instantiateClass(t){return new Zr(t,this.generation)}invokeMethod(t){return new ii(t,this.generation)}codeblock(t){return new Mt(t,this.generation)}code(){return new vt({},this.generation)}anonymousFunction(t){return new gi(t)}parameter(t){return new Ye(t,this.generation)}interface_(t){return new Ii(t,this.generation)}enum_(t){return new Ai(t,this.generation)}dictionary(t){return new ei(t,this.generation)}list(t){return new ri(t,this.generation)}readOnlyMemory(t){return new ni(t,this.generation)}set(t){return new si(t,this.generation)}switch_(t){return new xi(t,this.generation)}ternary(t){return new Si(t,this.generation)}and(t){return new hi(t,this.generation)}or(t){return new bi(t,this.generation)}enumInstantiation(t){return new ti(t,this.generation)}string_(t){return new ai(t,this.generation)}xmlDocBlock(t){return new qt(t,this.generation)}xmlDocBlockOf(t){return t instanceof qt?t:new qt(t,this.generation)}validateReadOnlyMemoryTypes(){for(let t of this.generation.settings.readOnlyMemoryTypes)if(!this.VALID_READ_ONLY_MEMORY_TYPES.has(t))throw new Error(`Type "${t}" is not a valid 'read-only-memory-types' custom config option; expected one of ${JSON.stringify(this.VALID_READ_ONLY_MEMORY_TYPES)}.`)}};n();a();s();function J(e){let t={},r={};for(let[i,o]of Object.entries(e))o.length===0?Object.defineProperty(r,i,{get(){return i in t||(t[i]=o()),t[i]},enumerable:!0,configurable:!0}):r[i]=o;return r}n();a();s();var Eo=class{constructor(t){y(this,"generation");y(this,"System",J({Action:t=>this.csharp.classReference({name:"Action",namespace:"System",generics:t||void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),Func:(t,r)=>this.csharp.classReference({name:"Func",namespace:"System",generics:t?r?[...t,r]:t:r?[r]:void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),DateOnly:()=>this.csharp.classReference({name:"DateOnly",namespace:"System"}),DateTime:()=>this.csharp.classReference({name:"DateTime",namespace:"System"}),Enum:()=>this.csharp.classReference({name:"Enum",namespace:"System"}),Exception:()=>this.csharp.classReference({name:"Exception",namespace:"System"}),ReadOnlyMemory:t=>this.csharp.classReference({name:"ReadOnlyMemory",namespace:"System",generics:[t]}),Serializable:()=>this.csharp.classReference({name:"SerializableAttribute",namespace:"System"}),String:()=>this.csharp.classReference({name:"String",namespace:"System"}),Type:()=>this.csharp.classReference({name:"Type",namespace:"System",isReferenceType:!0,multipartMethodName:null,multipartMethodNameForCollection:null,fullyQualified:!0}),TimeSpan:()=>this.csharp.classReference({name:"TimeSpan",namespace:"System"}),Uri:()=>this.csharp.classReference({name:"Uri",namespace:"System"}),UriBuilder:()=>this.csharp.classReference({name:"UriBuilder",namespace:"System"}),Runtime:()=>J({Serialization:()=>J({EnumMember:()=>this.csharp.classReference({name:"EnumMemberAttribute",namespace:"System.Runtime.Serialization"})})}),Collections:()=>J({Generic:()=>J({IAsyncEnumerable:t=>this.csharp.classReference({name:"IAsyncEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),IEnumerable:t=>this.csharp.classReference({name:"IEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),KeyValuePair:(t,r)=>this.csharp.classReference({name:"KeyValuePair",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0}),List:t=>this.csharp.classReference({name:"List",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),HashSet:t=>this.csharp.classReference({name:"HashSet",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),Dictionary:(t,r)=>this.csharp.classReference({name:"Dictionary",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0,isCollection:!0}),IDictionary:(t,r)=>this.csharp.classReference({name:"IDictionary",namespace:"System.Collections.Generic",generics:[t,r]})}),Linq:()=>J({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>J({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>J({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>J({Http:()=>J({HttpClient:()=>this.csharp.classReference({name:"HttpClient",namespace:"System.Net.Http"}),HttpMethod:()=>this.csharp.classReference({name:"HttpMethod",namespace:"System.Net.Http"}),HttpResponseHeaders:()=>this.csharp.classReference({name:"HttpResponseHeaders",namespace:"System.Net.Http.Headers"})}),ServerSentEvents:()=>J({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>J({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>J({MemoryStream:()=>this.csharp.classReference({name:"MemoryStream",namespace:"System.IO"}),Stream:()=>this.csharp.classReference({name:"Stream",namespace:"System.IO"}),StreamReader:()=>this.csharp.classReference({name:"StreamReader",namespace:"System.IO"})}),Text:()=>J({Encoding:()=>this.csharp.classReference({name:"Encoding",namespace:"System.Text"}),Encoding_UTF8:()=>this.csharp.classReference({name:"UTF8",enclosingType:this.csharp.classReference({name:"Encoding",namespace:"System.Text"})}),Json:()=>J({JsonElement:()=>this.csharp.classReference({name:"JsonElement",namespace:"System.Text.Json"}),JsonDocument:()=>this.csharp.classReference({name:"JsonDocument",namespace:"System.Text.Json"}),JsonException:()=>this.csharp.classReference({name:"JsonException",namespace:"System.Text.Json"}),Utf8JsonReader:()=>this.csharp.classReference({name:"Utf8JsonReader",namespace:"System.Text.Json"}),JsonSerializerOptions:()=>this.csharp.classReference({name:"JsonSerializerOptions",namespace:"System.Text.Json"}),JsonSerializer:()=>this.csharp.classReference({name:"JsonSerializer",namespace:"System.Text.Json"}),Utf8JsonWriter:()=>this.csharp.classReference({name:"Utf8JsonWriter",namespace:"System.Text.Json"}),Nodes:()=>J({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>J({IJsonOnDeserialized:()=>this.csharp.classReference({name:"IJsonOnDeserialized",namespace:"System.Text.Json.Serialization"}),IJsonOnSerializing:()=>this.csharp.classReference({name:"IJsonOnSerializing",namespace:"System.Text.Json.Serialization"}),JsonOnDeserializedAttribute:()=>this.csharp.classReference({name:"JsonOnDeserializedAttribute",namespace:"System.Text.Json.Serialization"}),JsonExtensionData:()=>this.csharp.classReference({name:"JsonExtensionDataAttribute",namespace:"System.Text.Json.Serialization"}),JsonConverter:t=>this.csharp.classReference({name:"JsonConverter",namespace:"System.Text.Json.Serialization",generics:t?[t]:void 0}),JsonIgnore:()=>this.csharp.classReference({name:"JsonIgnoreAttribute",namespace:"System.Text.Json.Serialization"}),JsonPropertyName:()=>this.csharp.classReference({name:"JsonPropertyNameAttribute",namespace:"System.Text.Json.Serialization"})})})}),Threading:()=>J({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>J({Task:t=>this.csharp.classReference({name:"Task",namespace:"System.Threading.Tasks",generics:t?[t]:void 0}),ValueTask:t=>this.csharp.classReference({name:"ValueTask",namespace:"System.Threading.Tasks",generics:t?[t]:void 0})})}),ComponentModel:()=>J({INotifyPropertyChanged:()=>this.csharp.classReference({name:"INotifyPropertyChanged",namespace:"System.ComponentModel"}),PropertyChangedEventHandler:()=>this.csharp.classReference({name:"PropertyChangedEventHandler",namespace:"System.ComponentModel"})}),IAsyncDisposable:()=>this.csharp.classReference({name:"IAsyncDisposable",namespace:"System"}),IDisposable:()=>this.csharp.classReference({name:"IDisposable",namespace:"System"})}));y(this,"NUnit",J({Framework:()=>J({TestFixture:()=>this.csharp.classReference({name:"TestFixture",namespace:"NUnit.Framework"}),Test:()=>this.csharp.classReference({name:"Test",namespace:"NUnit.Framework"}),OneTimeTearDown:()=>this.csharp.classReference({name:"OneTimeTearDown",namespace:"NUnit.Framework"}),OneTimeSetUp:()=>this.csharp.classReference({name:"OneTimeSetUp",namespace:"NUnit.Framework"}),SetUpFixture:()=>this.csharp.classReference({name:"SetUpFixture",namespace:"NUnit.Framework"}),Parallelizable:()=>this.csharp.classReference({name:"Parallelizable",namespace:"NUnit.Framework"})})}));y(this,"OneOf",J({OneOf:t=>this.csharp.classReference({name:"OneOf",namespace:"OneOf",generics:t}),OneOfBase:t=>this.csharp.classReference({name:"OneOfBase",namespace:"OneOf",generics:t})}));y(this,"Google",J({Protobuf:()=>J({ByteString:()=>this.csharp.classReference({name:"ByteString",namespace:"Google.Protobuf"}),WellKnownTypes:()=>J({Struct:()=>this.csharp.classReference({name:"Struct",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Value:()=>this.csharp.classReference({name:"Value",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),ListValue:()=>this.csharp.classReference({name:"ListValue",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Timestamp:()=>this.csharp.classReference({name:"Timestamp",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"})})})}));y(this,"WireMock",J({Server:()=>this.csharp.classReference({name:"WireMockServer",namespace:"WireMock.Server"}),WireMockServerSettings:()=>this.csharp.classReference({name:"WireMockServerSettings",namespace:"WireMock.Settings"}),WireMockConsoleLogger:()=>this.csharp.classReference({name:"WireMockConsoleLogger",namespace:"WireMock.Logging"})}));y(this,"Grpc",J({Core:()=>J({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};n();a();s();var ic=new Set(["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"]);function eg(e,t){return ic.has(t)?e??"":e?`${e}.${t}`:t}var Ao=class{constructor(t,r){y(this,"generation");y(this,"indexByObject",new Map);y(this,"indexByPath",new Map);y(this,"explicitByObject",new Map);y(this,"explicitByPath",new Map);y(this,"root");y(this,"ir");this.generation=r,this.root=this.createIndex(t),this.ir=t}get csharp(){return this.generation.csharp}get registry(){return this.generation.registry}createIndex(t,r="",i){let o=eg(i?.jsonPath,r);if(this.indexByPath.has(o)){i||de(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,i);let l=ic.has(r);for(let[b,w]of Object.entries(t))typeof w=="object"&&w!==null&&(l&&ic.has(b)?this.indexByObject.set(w,i):this.createIndex(w,b,i));return i}let c={jsonPath:o,name:r,node:t,parent:i};this.indexByObject.set(t,c),this.indexByPath.set(o,c);for(let[l,b]of Object.entries(t))typeof b=="object"&&b!==null&&this.createIndex(b,l,c);return c}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){let i=this.provenance(t)??de(`Provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),o={...i,jsonPath:`${i.jsonPath}+${r}`,name:r,node:i.node,parent:i,explicit:!0},c=this.explicitByObject.get(i.node);return c?c.add(o):this.explicitByObject.set(i.node,new Set([o])),this.explicitByPath.set(o.jsonPath,o),o}provenance(t){if(t!==void 0)return v.string(t)?this.explicitByPath.get(t)??this.indexByPath.get(t):v.Provenance(t)?this.explicitByPath.get(t.jsonPath)??this.indexByPath.get(t.jsonPath):this.indexByObject.get(t)}origin(t){let r=this.provenance(t);return r?.explicit?r:r?.node}irNode(t){return this.provenance(t)?.node}jsonPath(t){return this.provenance(t)?.jsonPath}getEnumValueName(t,r){let i=v.IR.ExampleEnumType(r)?r.value:r,o=t.values.find(c=>this.nameEquals(c.name,i));return o?this.getPropertyNameFor(o):de(`Unexpected - can't find enum value ${JSON.stringify(i)} in enum`)}getPropertyNameFor(t){let r=this.registry.getFieldNameByOrigin(t);if(r)return r;if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${this.jsonPath(t)}`)}getClassNameFor(t){if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.TypeDeclaration(t))return this.generation.case.pascalSafe(t.name.name);if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${JSON.stringify(t)}`)}nameEquals(t,r){return this.generation.case.camelSafe(t)===this.generation.case.camelSafe(r)}dereferenceType(t){let r=v.string(t)?t:v.IR.NamedType(t)||v.IR.DeclaredTypeName(t)?t.typeId:v.IR.ExampleNamedType(t)?t.typeName.typeId:t.name.typeId,i=this.irNode(this.ir.types[r]);if(v.IR.TypeDeclaration(i))return{typeId:r,typeDeclaration:i};de(`dereferenceType: typeId ${r} not resolved.`)}};function Io(...e){return e.filter(Boolean).join("/")}var jn=class{constructor(t,r,i,o,c={makeRelativeFilePath:l=>l,makeAbsoluteFilePath:l=>l,getNamespaceForTypeId:l=>"",getDirectoryForTypeId:l=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:l=>[]}){y(this,"intermediateRepresentation");y(this,"apiName");y(this,"customConfig");y(this,"generatorConfig");y(this,"support");y(this,"ir");y(this,"dir");y(this,"csharp",new To(this));y(this,"registry",new Oi(this));y(this,"model");y(this,"case");y(this,"extern",new Eo(this));y(this,"settings",J({namespace:()=>this.customConfig.namespace??co(po(`${this.generatorConfig.organization}_${this.apiName}`)),readOnlyMemoryTypes:()=>this.customConfig["read-only-memory-types"]??[],simplifyObjectDictionaries:()=>this.customConfig["simplify-object-dictionaries"]??!1,useFullyQualifiedNamespaces:()=>this.customConfig["experimental-fully-qualified-namespaces"]??!1,useDotnetFormat:()=>this.customConfig["experimental-dotnet-format"]??!1,enableWebsockets:()=>this.customConfig["experimental-enable-websockets"]??!1,enableReadonlyConstants:()=>this.customConfig["experimental-readonly-constants"]??!1,generateLiterals:()=>this.customConfig["generate-literals"]??this.customConfig["experimental-readonly-constants"]??!1,enableExplicitNullableOptional:()=>this.customConfig["experimental-explicit-nullable-optional"]??!1,useDefaultRequestParameterValues:()=>this.customConfig["use-default-request-parameter-values"]??!1,redactResponseBodyOnError:()=>this.customConfig["redact-response-body-on-error"]??!1,enableInlineTypes:()=>this.customConfig["enable-inline-types"]??!1,temporaryWebsocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},baseApiExceptionClassName:()=>this.customConfig["base-api-exception-class-name"]??"",baseExceptionClassName:()=>this.customConfig["base-exception-class-name"]??"",shouldGeneratedDiscriminatedUnions:()=>this.customConfig["use-discriminated-unions"]??!0,shouldGenerateUndiscriminatedUnions:()=>this.customConfig["use-undiscriminated-unions"]??!1,dedupeUnionBaseProperties:()=>this.customConfig["dedupe-union-base-properties"]??!1,exportedClientClassName:()=>this.customConfig["exported-client-class-name"]??"",clientClassName:()=>this.customConfig["client-class-name"]??"",rootNamespaceForCoreClasses:()=>this.customConfig["root-namespace-for-core-classes"]??!0,packageId:()=>this.customConfig["package-id"]??"",isForwardCompatibleEnumsEnabled:()=>this.customConfig["enable-forward-compatible-enums"]??this.customConfig["experimental-enable-forward-compatible-enums"]??!0,websocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},customPagerName:()=>this.customConfig["custom-pager-name"]??"",usePageIndexSemantics:()=>this.customConfig["offset-semantics"]==="page-index",environmentClassName:()=>this.customConfig["environment-class-name"]??"",generateErrorTypes:()=>this.customConfig["generate-error-types"]??!0,shouldInlinePathParameters:()=>this.customConfig["inline-path-parameters"]??!0,includeExceptionHandler:()=>this.customConfig["include-exception-handler"]??!1,exceptionInterceptorClassName:()=>this.customConfig["exception-interceptor-class-name"]??"",shouldGenerateMockServerTests:()=>this.customConfig["generate-mock-server-tests"]??this.customConfig["enable-wire-tests"]??!0,rootClientAccess:()=>this.customConfig["root-client-class-access"]=="internal"?ge.Internal:ge.Public,extraDependencies:()=>this.customConfig["extra-dependencies"]??{},omitFernHeaders:()=>this.customConfig["omit-fern-headers"]??!1,includePlatformHeaders:()=>this.customConfig["include-platform-headers"]??!1,userAgentNameFromPackage:()=>this.customConfig["user-agent-name-from-package"]??!1,unifiedClientOptions:()=>this.customConfig["unified-client-options"]??!1,pascalCaseEnvironments:()=>this.customConfig["pascal-case-environments"]??!0,slnFormat:()=>this.customConfig["sln-format"]??"slnx",explicitNamespaces:()=>this.customConfig["explicit-namespaces"]===!0,maxRetries:()=>this.customConfig.maxRetries,retryStatusCodes:()=>this.customConfig.retryStatusCodes??"legacy",defaultTimeoutInMilliseconds:()=>{let t=this.customConfig["default-timeout-in-milliseconds"];if(t!=null)return t;let r=this.customConfig["default-timeout-in-seconds"];if(r!=null)return r==="infinity"?"infinity":r*1e3},outputPath:()=>{let t=this.customConfig["output-path"];return t==null?{library:"src",test:"src",solution:".",other:"."}:typeof t=="string"?{library:t,test:t,solution:".",other:"."}:{library:t.library??"src",test:t.test??"src",solution:t.solution??".",other:t.other??"."}}}));y(this,"constants",{folders:J({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath(Io(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(Io(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(Io(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(Io(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:J({indent:()=>" "}),defaults:J({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});y(this,"namespaces",J({root:()=>this.settings.namespace,core:()=>`${this.namespaces.root}.Core`,qualifiedRoot:()=>this.qualifyNamespace(this.namespaces.root),qualifiedCore:()=>this.qualifyNamespace(this.namespaces.core),test:()=>this.registry.canonicalizeNamespace(`${this.namespaces.root}.Test`),testUtils:()=>`${this.namespaces.test}.Utils`,mockServerTest:()=>`${this.namespaces.test}.Unit.MockServer`,publicCore:()=>this.namespaces.root,webSocketsCore:()=>`${this.namespaces.core}.WebSockets`,publicCoreTest:()=>`${this.namespaces.root}.Test.PublicCore`,asIsTestUtils:()=>`${this.namespaces.root}.Test.Utils`,publicCoreClasses:()=>this.settings.rootNamespaceForCoreClasses?this.namespaces.root:this.namespaces.core,implicit:()=>new Set(["System","System.Collections.Generic","System.IO","System.Linq","System.Threading","System.Threading.Tasks","System.Net.Http"])}));y(this,"names",{classes:J({baseApiException:()=>this.settings.baseApiExceptionClassName||`${this.names.project.clientPrefix}ApiException`,baseException:()=>this.settings.baseExceptionClassName||`${this.names.project.clientPrefix}Exception`,rootClient:()=>this.settings.clientClassName||`${this.names.project.clientPrefix}Client`,rootClientForSnippets:()=>this.settings.exportedClientClassName||this.names.classes.rootClient,customPager:()=>this.settings.customPagerName||`${this.names.project.packageId.replace(/[^a-zA-Z0-9]/g,"")}Pager`,environment:()=>this.settings.environmentClassName||`${this.names.project.clientPrefix}Environment`,exceptionInterceptor:()=>this.settings.exceptionInterceptorClassName||`${this.names.project.packageId.replace(/[^a-zA-Z0-9]/g,"")}ExceptionInterceptor`}),project:J({client:()=>co(po(`${this.generatorConfig.organization}_${this.generatorConfig.workspaceName}`)),clientPrefix:()=>this.settings.exportedClientClassName||this.settings.clientClassName||this.names.project.client,packageId:()=>this.settings.packageId||this.namespaces.root}),files:J({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:J({mockOauth:()=>"MockOAuthEndpoint",mockInferredAuth:()=>"MockInferredAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync",getAuthHeadersAsync:()=>"GetAuthHeadersAsync"}),variables:J({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:J({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});y(this,"Types",J({Arbitrary:t=>new re.ArbitraryType(t,this),HttpMethodExtensions:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HttpMethodExtensions")}),FormRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("FormRequest")}),Optional:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("Optional")}),ClientOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("ClientOptions"),namespace:this.namespaces.publicCoreClasses}),RawClient:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("RawClient")}),RequestOptions:()=>this.csharp.classReference({namespace:this.namespaces.publicCoreClasses,origin:this.model.staticExplicit("RequestOptions")}),RequestOptionsInterface:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("IRequestOptions")}),JsonRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("JsonRequest")}),Version:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("Version")}),ValueConvert:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("ValueConvert")}),FileParameter:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("FileParameter"),multipartMethodName:"AddFileParameterPart",multipartMethodNameForCollection:"AddFileParameterParts",isReferenceType:!0}),DefaultHttpClientFactory:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("DefaultHttpClientFactory")}),Headers:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("Headers")}),HeaderValue:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HeaderValue")}),RootClient:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClient),namespace:this.namespaces.root}),RootClientForSnippets:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClientForSnippets),namespace:this.namespaces.root}),BaseApiException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseApiException),namespace:this.namespaces.publicCoreClasses}),BaseException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseException),namespace:this.namespaces.publicCoreClasses}),ExceptionInterceptor:()=>this.csharp.classReference({origin:this.model.staticExplicit("IExceptionInterceptor"),namespace:this.namespaces.core}),ExceptionHandler:()=>this.csharp.classReference({origin:this.model.staticExplicit("ExceptionHandler"),namespace:this.namespaces.core}),CustomExceptionInterceptor:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.exceptionInterceptor),namespace:this.namespaces.core}),ProtoAnyMapper:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoAnyMapper"),namespace:this.namespaces.core}),Constants:()=>this.csharp.classReference({origin:this.model.staticExplicit("Constants"),namespace:this.namespaces.core}),DateTimeSerializer:()=>this.csharp.classReference({origin:this.model.staticExplicit("DateTimeSerializer"),namespace:this.namespaces.core}),JsonUtils:()=>this.csharp.classReference({origin:this.model.staticExplicit("JsonUtils"),namespace:this.namespaces.core}),JsonAssert:()=>this.csharp.classReference({origin:this.model.staticExplicit("JsonAssert"),namespace:this.namespaces.testUtils}),CustomPagerFactory:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Factory`),namespace:this.namespaces.core}),CustomPagerContext:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Context`),namespace:this.namespaces.core}),Environments:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.environment),namespace:this.namespaces.publicCoreClasses}),TestClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("TestClient"),namespace:this.namespaces.test}),BaseMockServerTest:()=>this.csharp.classReference({origin:this.model.staticExplicit("BaseMockServerTest"),namespace:this.namespaces.mockServerTest}),IdempotentRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("IdempotentRequestOptions"),namespace:this.namespaces.publicCoreClasses}),IdempotentRequestOptionsInterface:()=>this.csharp.classReference({origin:this.model.staticExplicit("IIdempotentRequestOptions"),namespace:this.namespaces.core}),IStringEnum:()=>this.csharp.classReference({origin:this.model.staticExplicit("IStringEnum"),namespace:this.namespaces.core}),WebSocketClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("WebSocketClient"),namespace:this.namespaces.webSocketsCore}),QueryBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("Query"),namespace:this.namespaces.webSocketsCore}),QueryStringBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("QueryStringBuilder"),namespace:this.namespaces.core}),QueryStringBuilderBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("QueryStringBuilder.Builder"),namespace:this.namespaces.core}),OAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("OAuthTokenProvider"),namespace:this.namespaces.core}),InferredAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("InferredAuthTokenProvider"),namespace:this.namespaces.core}),ProtoConverter:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoConverter"),namespace:this.namespaces.core}),RawGrpcClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("RawGrpcClient"),namespace:this.namespaces.core}),Extensions:()=>this.csharp.classReference({origin:this.model.staticExplicit("Extensions"),namespace:this.namespaces.core}),GrpcRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcRequestOptions"),namespace:this.namespaces.root}),GrpcChannelOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcChannelOptions"),namespace:"Grpc.Net.Client"}),StringEnum:t=>this.csharp.classReference({origin:this.model.staticExplicit("StringEnum"),namespace:this.namespaces.core,generics:t?[t]:void 0}),WebSocketEvent:t=>this.csharp.classReference({origin:this.model.staticExplicit("Event"),namespace:this.namespaces.webSocketsCore,generics:[t]}),ConnectionStatus:()=>this.csharp.classReference({origin:this.model.staticExplicit("ConnectionStatus"),namespace:this.namespaces.webSocketsCore}),WebSocketConnected:()=>this.csharp.classReference({origin:this.model.staticExplicit("Connected"),namespace:this.namespaces.webSocketsCore}),WebSocketClosed:()=>this.csharp.classReference({origin:this.model.staticExplicit("Closed"),namespace:this.namespaces.webSocketsCore}),ReconnectionInfo:()=>this.csharp.classReference({origin:this.model.staticExplicit("ReconnectionInfo"),namespace:this.namespaces.webSocketsCore}),CustomPagerClass:t=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.customPager),namespace:this.namespaces.core,generics:[t]}),Pager:t=>this.csharp.classReference({origin:this.model.staticExplicit("Pager"),namespace:this.namespaces.core,generics:[t]}),OffsetPager:({requestType:t,requestOptionsType:r,responseType:i,offsetType:o,stepType:c,itemType:l})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,o,c,l]}),CursorPager:({requestType:t,requestOptionsType:r,responseType:i,cursorType:o,itemType:c})=>this.csharp.classReference({origin:this.model.staticExplicit("CursorPager"),namespace:this.namespaces.core,generics:[t,r,i,o,c]}),CollectionItemSerializer:(t,r)=>this.csharp.classReference({origin:this.model.staticExplicit("CollectionItemSerializer"),namespace:this.namespaces.core,generics:[t,r]}),OneOfSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("OneOfSerializer"),namespace:this.namespaces.core,generics:[t]}),AdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("AdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0}),ReadOnlyAdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("ReadOnlyAdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0})}));y(this,"Primitive",J({string:()=>new re.String(this),boolean:()=>new re.Boolean(this),integer:()=>new re.Integer(this),long:()=>new re.Long(this),uint:()=>new re.Uint(this),ulong:()=>new re.ULong(this),float:()=>new re.Float(this),double:()=>new re.Double(this),object:()=>new re.Object(this)}));y(this,"Value",J({binary:()=>new Ue.Binary(this),dateOnly:()=>new Ue.DateOnly(this),dateTime:()=>new Ue.DateTime(this),uuid:()=>new Ue.Uuid(this),stringEnum:t=>new Ue.StringEnum(t,this)}));y(this,"Collection",J({array:t=>new we.Array(t,this),listType:t=>new we.ListType(t,this),list:t=>new we.List(t,this),set:t=>new we.Set(t,this),map:(t,r,i)=>new we.Map(t,r,this,i),idictionary:(t,r,i)=>new we.IDictionary(t,r,this,i),keyValuePair:(t,r)=>new we.KeyValuePair(t,r,this)}));y(this,"format",J({private:t=>`_${lo.camelCase(t)}`}));y(this,"initializers",J({implicitNamespaces:()=>{for(let t of this.namespaces.implicit)this.registry.addImplicitNamespace(t);return!0}}));this.intermediateRepresentation=t,this.apiName=r,this.customConfig=i,this.generatorConfig=o,this.support=c;let l=v.IR.IntermediateRepresentation(t)?t.casingsConfig:void 0;this.case=new Hi({generationLanguage:"csharp",keywords:l?.keywords,smartCasing:l?.smartCasing??!0}),this.model=new Ao(t,this),this.ir=v.IR.IntermediateRepresentation(t)?t:{},this.dir=v.DynamicIR.DynamicIntermediateRepresentation(t)?t:{}}initialize(){return this.initializers.implicitNamespaces}get System(){return this.extern.System}get NUnit(){return this.extern.NUnit}get OneOf(){return this.extern.OneOf}get Google(){return this.extern.Google}get Grpc(){return this.extern.Grpc}get WireMock(){return this.extern.WireMock}qualifyNamespace(t){let r=t.split(".")[0];return r&&this.registry.hasTypeNamespaceConflict(r)?`global::${t}`:t}};n();a();s();var Ze=class{constructor(t){y(this,"generation");this.generation=t}get csharp(){return this.generation.csharp}get case(){return this.generation.case}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get namespaces(){return this.generation.namespaces}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get registry(){return this.generation.registry}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get Grpc(){return this.generation.extern.Grpc}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}};n();a();s();var No=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){if(r.value===null)return this.context.isNullable(r.typeReference)?this.csharp.Literal.null():(this.context.errors.add({severity:te.Critical,message:"Expected non-null value, but got null"}),this.csharp.Literal.nop());if(r.value===void 0&&!r.fallbackToDefault)return this.csharp.Literal.nop();switch(r.typeReference.type){case"list":return this.convertList({list:r.typeReference.value,value:r.value,fallbackToDefault:r.fallbackToDefault});case"literal":return this.convertLiteral({literal:r.typeReference.value,fallbackToDefault:r.forceLiteral?r.fallbackToDefault:void 0,value:r.value,forceLiteral:r.forceLiteral});case"map":return this.convertMap({map:r.typeReference,value:r.value,fallbackToDefault:r.fallbackToDefault});case"named":{let i=this.context.resolveNamedType({typeId:r.typeReference.value});return i==null?this.csharp.Literal.nop():this.convertNamed({named:i,value:r.value,as:r.as,fallbackToDefault:r.fallbackToDefault})}case"nullable":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as,forceLiteral:r.forceLiteral});case"optional":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as,forceLiteral:r.forceLiteral});case"primitive":return this.convertPrimitive({primitive:r.typeReference.value,value:r.value,as:r.as,fallbackToDefault:r.fallbackToDefault});case"set":return this.convertSet({set:r.typeReference.value,value:r.value,fallbackToDefault:r.fallbackToDefault});case"unknown":return this.convertUnknown({value:r.value,fallbackToDefault:r.fallbackToDefault});default:ue(r.typeReference)}}convertList({list:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((c,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:te.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertLiteral({literal:r,value:i,fallbackToDefault:o,forceLiteral:c}){if(this.settings.generateLiterals&&!c)return this.csharp.Literal.nop();switch(r.type){case"boolean":{let l=this.context.getValueAsBoolean({value:i});return l==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(l)}case"string":{let l=this.context.getValueAsString({value:i});return l==null?o?this.Primitive.string.getDeterminsticDefault(o):this.csharp.Literal.nop():this.csharp.Literal.string(l)}default:ue(r)}}convertSet({set:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((c,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:te.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertMap({map:r,value:i,fallbackToDefault:o}){return typeof i!="object"||i==null?(this.context.errors.add({severity:te.Critical,message:`Expected object but got: ${i==null?"null":typeof i}`}),this.csharp.Literal.nop()):this.csharp.Literal.dictionary({keyType:this.context.dynamicTypeMapper.convert({typeReference:r.key}),valueType:r.value.type==="unknown"?this.context.dynamicTypeMapper.convert({typeReference:r.value}).asOptional():this.context.dynamicTypeMapper.convert({typeReference:r.value}),entries:Object.entries(i).map(([c,l])=>{this.context.errors.scope(c);try{return{key:this.convert({typeReference:r.key,value:c,as:"key"}),value:this.convert({typeReference:r.value,value:l})}}finally{this.context.errors.unscope()}})})}convertNamed({named:r,value:i,as:o,fallbackToDefault:c}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),arguments_:[]})):this.convert({typeReference:r.typeReference,value:i,as:o,fallbackToDefault:c});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:c}):this.convertUnknown({value:i,fallbackToDefault:c});case"enum":return this.getEnumValue(r,i);case"object":return this.convertObject({object_:r,value:i,fallbackToDefault:c});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:c});default:ue(r)}}convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:o}){let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:i});if(l==null)return this.csharp.Literal.nop();let b=l.singleDiscriminatedUnionType,w=this.getBaseProperties({discriminatedUnionTypeInstance:l,singleDiscriminatedUnionType:b});switch(b.type){case"samePropertiesAsObject":{let A=this.context.resolveNamedType({typeId:b.typeId});return A==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.convertNamed({named:A,value:l.value})]})}case"singleProperty":{if(this.context.getRecord(l.value)==null)return this.csharp.Literal.nop();try{let I=["Value","Type"].includes(b.discriminantValue.name.pascalCase.safeName)?`${b.discriminantValue.name.pascalCase.safeName}Inner`:b.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(b.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:I,enclosingType:c}),arguments_:[this.convert({typeReference:b.typeReference,value:b.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:l.discriminantValue,enclosingType:c}),arguments_:[]})]});default:ue(b)}}getBaseProperties({discriminatedUnionTypeInstance:r,singleDiscriminatedUnionType:i}){return this.context.associateByWireValue({parameters:i.properties??[],values:this.context.getRecord(r.value)??{},ignoreMissingParameters:!0}).map(c=>{this.context.errors.scope(c.name.wireValue);try{return{name:this.context.getPropertyName(c.name.name),assignment:this.convert(c)}}finally{this.context.errors.unscope()}})}instantiateUnionWithBaseProperties({classReference:r,arguments_:i,baseProperties:o}){let c=this.csharp.instantiateClass({classReference:r,arguments_:i,multiline:!0});return o.length===0?this.csharp.Literal.reference(c):this.csharp.Literal.reference(this.csharp.codeblock(l=>{l.write(c," "),l.pushScope();for(let b of o)l.write(b.name," = ",b.assignment,",");l.popScope(!1)}))}getEnumValue(r,i){if(typeof i!="string")return this.context.errors.add({severity:te.Critical,message:`Expected enum value string, got: ${typeof i}`}),this.csharp.Literal.nop();let o=r.values.find(b=>b.wireValue===i);if(o==null)return this.context.errors.add({severity:te.Critical,message:`An enum value named "${i}" does not exist in this context`}),this.csharp.Literal.nop();let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=c.registerField(this.model.getPropertyNameFor(o),o);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:c,value:l}))}convertObject({object_:r,value:i,fallbackToDefault:o}){let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=this.getOmittedBasePropertyWireValues(r),b=l.size===0?r.properties:r.properties.filter(F=>!l.has(F.name.wireValue)),w=new Map;for(let F of b){let U=this.context.resolvePropertyName(c,F.name.name);w.set(F.name.wireValue,U)}let A=this.context.getRecord(i)??{},I=l.size===0?A:Object.fromEntries(Object.entries(A).filter(([F])=>!l.has(F))),L=this.context.associateByWireValue({parameters:b,values:I}).map(F=>{this.context.errors.scope(F.name.wireValue);try{return{name:w.get(F.name.wireValue)??this.context.getClassName(F.name.name),value:this.convert(F)}}finally{this.context.errors.unscope()}}),R=new Set(Object.keys(I));for(let F of b){let U=w.get(F.name.wireValue)??this.context.getClassName(F.name.name);if(R.has(F.name.wireValue)){if(this.isRequiredProperty(F.typeReference)){let M=L.find(W=>W.name===U);if(M!=null&&v.Literal.nop(M.value)){let W=this.getDefaultLiteralForType(F.typeReference);W!=null&&(M.value=W)}}continue}if(this.isRequiredProperty(F.typeReference)){let M=this.getDefaultLiteralForType(F.typeReference);M!=null&&L.push({name:U,value:M})}}return this.csharp.Literal.class_({reference:c,fields:L})}getOmittedBasePropertyWireValues(r){return this.settings.dedupeUnionBaseProperties?new Set((r.deferredUnionBaseProperties??[]).map(i=>i.wireValue)):new Set}isRequiredProperty(r){return!(this.context.isOptional(r)||this.context.isNullable(r)||r.type==="list"||r.type==="set"||r.type==="map")}getDefaultLiteralForType(r,i){switch(r.type){case"primitive":return this.getDefaultLiteralForPrimitive(r.value);case"literal":return this.convertLiteral({literal:r.value,value:r.value.value});case"named":{let o=this.context.resolveNamedType({typeId:r.value});if(o==null)return;if(o.type==="alias")return this.getDefaultLiteralForType(o.typeReference,i);if(o.type==="enum"&&o.values.length>0){let c=o.values[0];if(c!=null)return this.getEnumValue(o,c.wireValue)}return o.type==="undiscriminatedUnion"?this.getDefaultLiteralForUndiscriminatedUnion(o,i):o.type==="object"?this.getDefaultLiteralForObject(o,r.value,i):void 0}default:return}}getDefaultLiteralForObject(r,i,o){let c=o??new Set;if(c.has(i))return;c.add(i);let l=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),b=[];for(let w of r.properties)if(this.isRequiredProperty(w.typeReference)){let A=this.getDefaultLiteralForType(w.typeReference,c);A!=null&&b.push({name:this.context.resolvePropertyName(l,w.name.name),value:A})}return c.delete(i),this.csharp.Literal.class_({reference:l,fields:b})}getDefaultLiteralForUndiscriminatedUnion(r,i){for(let o of r.types){let c=this.getDefaultLiteralForType(o,i);if(c!=null)return c}}getDefaultLiteralForPrimitive(r){switch(r){case"INTEGER":return this.csharp.Literal.integer(0);case"LONG":return this.csharp.Literal.long(0);case"UINT":return this.csharp.Literal.uint(0);case"UINT_64":return this.csharp.Literal.ulong(0);case"FLOAT":return this.csharp.Literal.float(0);case"DOUBLE":return this.csharp.Literal.double(0);case"BOOLEAN":return this.csharp.Literal.boolean(!1);case"STRING":case"UUID":case"BASE_64":case"BIG_INTEGER":return this.csharp.Literal.string("");case"DATE":return this.csharp.Literal.date("0001-01-01");case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.csharp.Literal.datetime("0001-01-01T00:00:00.000Z");default:ue(r)}}convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:o}){let c=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i});return c==null?this.csharp.Literal.nop():c.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i}){for(let o of r.types){let c=this.context.errors.size();try{let l=this.convert({typeReference:o,value:i});if(v.Literal.nop(l)||this.context.errors.size()>c){this.context.errors.truncate(c);continue}return{valueTypeReference:o,typeLiteral:l}}catch{this.context.errors.truncate(c);continue}}this.context.errors.add({severity:te.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof i}" value`})}convertUnknown({value:r,fallbackToDefault:i}){return this.csharp.Literal.unknown(r)}convertPrimitive({primitive:r,value:i,as:o,fallbackToDefault:c}){switch(r){case"INTEGER":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.integer.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.integer(l)}case"LONG":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.long.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.long(l)}case"UINT":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.uint.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.uint(l)}case"UINT_64":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.ulong.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.ulong(l)}case"FLOAT":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.float.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.float(l)}case"DOUBLE":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.double.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.double(l)}case"BOOLEAN":{let l=this.getValueAsBoolean({value:i,as:o});return l==null?c?this.Primitive.boolean.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.boolean(l)}case"STRING":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"DATE":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Value.dateOnly.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.date(l)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Value.dateTime.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.datetime(l)}case"UUID":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"BASE_64":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"BIG_INTEGER":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(l)}default:ue(r)}}getValueAsNumber({value:r,as:i}){let o=i==="key"&&typeof r=="string"?Number(r):r;return this.context.getValueAsNumber({value:o})}getValueAsBoolean({value:r,as:i}){let o=i==="key"?typeof r=="string"?r==="true":r==="false"?!1:r:r;return this.context.getValueAsBoolean({value:o})}};n();a();s();var Ro=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){switch(r.typeReference.type){case"list":return this.Collection.list(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"literal":return this.convertLiteral({literal:r.typeReference.value});case"map":return this.Collection.map(this.convert({typeReference:r.typeReference.key}),this.convert({typeReference:r.typeReference.value}));case"named":{let i=this.context.resolveNamedType({typeId:r.typeReference.value});return i==null?this.convertUnknown():this.convertNamed({named:i,typeId:r.typeReference.value})}case"optional":case"nullable":{let i=this.convert({typeReference:r.typeReference.value});return r.unboxOptionals?i.asNonOptional():i.asOptional()}case"primitive":return this.convertPrimitive({primitive:r.typeReference.value});case"set":return this.Collection.set(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:ue(r.typeReference)}}convertToClassReference(r,i){return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)})}convertNamed({named:r,typeId:i}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.convert({typeReference:r.typeReference});case"enum":case"object":return this.convertToClassReference(r,i);case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertToClassReference(r,i):this.Primitive.object;case"undiscriminatedUnion":return this.settings.shouldGenerateUndiscriminatedUnions?this.convertToClassReference(r,i):this.OneOf.OneOf(r.types.map(o=>this.convert({typeReference:o})));default:ue(r)}}convertLiteral({literal:r}){switch(r.type){case"boolean":return this.Primitive.boolean;case"string":return this.Primitive.string}}convertUnknown(){return this.Primitive.object}convertPrimitive({primitive:r}){switch(r){case"INTEGER":return this.Primitive.integer;case"UINT":return this.Primitive.uint;case"LONG":return this.Primitive.long;case"UINT_64":return this.Primitive.ulong;case"FLOAT":return this.Primitive.float;case"DOUBLE":return this.Primitive.double;case"BOOLEAN":return this.Primitive.boolean;case"STRING":return this.Primitive.string;case"DATE":return this.Value.dateOnly;case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.Value.dateTime;case"UUID":return this.Primitive.string;case"BASE_64":return this.Primitive.string;case"BIG_INTEGER":return this.Primitive.string;default:ue(r)}}};n();a();s();var Oo=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}getFilePropertyInfo({body:r,value:i}){let o={fileFields:[],bodyPropertyFields:[]},c=this.context.getRecord(i)??{};for(let l of r.properties)switch(l.type){case"file":v.Record.missingKey(c,l.wireValue)&&(c[l.wireValue]="[bytes]"),o.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getSingleFileProperty({property:l,record:c})});break;case"fileArray":v.Record.missingKey(c,l.wireValue)&&(c[l.wireValue]=["[bytes]"]),o.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getArrayFileProperty({property:l,record:c})});break;case"bodyProperty":if(v.Record.missingKey(c,l.name.wireValue))switch(l.typeReference.type){case"optional":break;case"primitive":{switch(l.typeReference.value.toLowerCase()){case"integer":{c[l.name.wireValue]=123;break}case"string":{c[l.name.wireValue]="[string]";break}case"boolean":{c[l.name.wireValue]=!0;break}case"double":{c[l.name.wireValue]=123.456;break}case"float":{c[l.name.wireValue]=123.456;break}case"long":{c[l.name.wireValue]=123456789;break}case"uint":{c[l.name.wireValue]=123;break}case"uint64":{c[l.name.wireValue]=12345;break}case"date":{c[l.name.wireValue]=new Date(2021,1,1);break}case"datetime":{c[l.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{c[l.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{c[l.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{c[l.name.wireValue]="12345678901234567890";break}}break}default:break}o.bodyPropertyFields.push({name:this.context.getPropertyName(l.name.name),value:this.getBodyProperty({property:l,record:c})});break;default:ue(l)}return o}getSingleFileProperty({property:r,record:i}){let o=this.context.getSingleFileValue({property:r,record:i});return o==null?this.csharp.Literal.nop():this.context.getFileParameterForString(o)}getArrayFileProperty({property:r,record:i}){let o=this.context.getFileArrayValues({property:r,record:i});return o==null?this.csharp.Literal.nop():this.csharp.Literal.list({valueType:this.Types.FileParameter,values:o.map(c=>this.context.getFileParameterForString(c))})}getBodyProperty({property:r,record:i}){let o=i[r.name.wireValue];return o==null?this.csharp.Literal.nop():this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:o})}};var Po=class e extends en{constructor({ir:r,config:i,options:o,generation:c}){super({ir:r,config:i,options:o});y(this,"ir");y(this,"dynamicTypeMapper");y(this,"dynamicLiteralMapper");y(this,"filePropertyMapper");y(this,"generation");this.ir=r,this.generation=c??new jn(r,i.workspaceName,i.customConfig!=null?i.customConfig:{},i),this.dynamicTypeMapper=new Ro({context:this}),this.dynamicLiteralMapper=new No({context:this}),this.filePropertyMapper=new Oo({context:this})}get namespaces(){return this.generation.namespaces}get registry(){return this.generation.registry}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get csharp(){return this.generation.csharp}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}clone(){return new e({ir:this.ir,config:this.config,options:this.options,generation:this.generation})}getFileParameterForString(r){return this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.FileParameter,arguments_:[],properties:[{name:"Stream",value:this.getMemoryStreamForString(r)}],multiline:!0}))}getMemoryStreamForString(r){return this.System.IO.MemoryStream.new({arguments_:[this.csharp.invokeMethod({on:this.System.Text.Encoding_UTF8,method:"GetBytes",arguments_:[this.csharp.Literal.string(r)]})]})}getClassName(r){return r.pascalCase.safeName}getParameterName(r){return r.camelCase.safeName}getPropertyName(r){return r.pascalCase.safeName}resolvePropertyName(r,i){let o=i.pascalCase.safeName,c=r.scope.getRedirectedFieldName(o);return c||(r.scope.isField(o)?o:r.registerField(o))}getMethodName(r){return`${r.pascalCase.safeName}Async`}getNamespace(r,i){let o=this.getNamespaceSegments(r);return o=i!=null?[...o,i]:o,[this.namespaces.root,...o].join(".")}getEnvironmentTypeReferenceFromID(r){let i=this.resolveEnvironmentName(r);if(i!=null)return this.getEnvironmentClassReferenceForEnumName(i)}getEnvironmentClassReferenceForEnumName(r){return this.csharp.classReference({name:`${this.generation.Types.Environments.name}.${this.getClassName(r)}`,namespace:this.namespaces.root})}getNamespaceSegments(r){return(this.settings.explicitNamespaces?r.allParts:r.packagePath).map(o=>o.pascalCase.safeName)}precalculate(r){this.generation.initialize(),this.System.Collections.Generic.KeyValuePair(),this.System.Collections.Generic.IEnumerable(),this.System.Collections.Generic.IAsyncEnumerable(),this.System.Collections.Generic.HashSet(),this.System.Collections.Generic.List(),this.System.Collections.Generic.Dictionary(),this.System.Threading.Tasks.Task(),Object.entries(this.ir.types).sort((i,o)=>i[0].length-o[0].length).forEach(([i,o])=>{this.dynamicTypeMapper.convertToClassReference(o,i)});for(let[i,o]of r.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${i}`),namespace:"Usage"}),o.endpoint){let c=this.resolveEndpointLocation(o.endpoint);for(let l of c)switch(l.request.type){case"inlined":this.csharp.classReference({origin:l.request.declaration.name,namespace:this.getNamespace(l.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClientForSnippets,this.csharp.freezeClassReferences()}};n();a();s();var rd="request",Co=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}async generateSnippet({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}generateSnippetSync({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}async generateSnippetAst({endpoint:r,request:i,options:o}){throw new Error("Unsupported")}buildCodeBlock({endpoint:r,snippet:i,options:o}){if(r.examples&&v.DynamicIR.EndpointExample(i)&&!r.examples.find(b=>b.id===i.id))throw new Error("Endpoint does not have an example that matches the snippet");let c=this.csharp.codeblock(b=>{b.writeNodeStatement(this.constructClient({endpoint:r,snippet:i})),b.newLine(),b.writeNodeStatement(this.callMethod({endpoint:r,snippet:i}))}),l=this.getStyle(o);switch(l){case Qt.Concise:return c;case Qt.Full:return this.buildFullCodeBlock({body:c,options:o});default:ue(l)}}buildFullCodeBlock({body:r,options:i}){let o=this.getConfig(i),c=o.fullStyleMethodName??o.fullStyleClassName??"Example",l=this.csharp.class_({name:"Examples",namespace:"Examples",partial:!0,skipNamespaceDeclaration:!0,access:Ri.Access.Public});return l.addNamespaceReference(this.Types.RootClientForSnippets.namespace),l.addMethod({name:c,access:Ri.Access.Public,isAsync:!0,parameters:[],body:r}),l}constructClient({endpoint:r,snippet:i}){return this.csharp.codeblock(o=>{o.write("var client = "),o.writeNode(this.getRootClientConstructorInvocation(this.getConstructorArgs({endpoint:r,snippet:i})))})}callMethod({endpoint:r,snippet:i}){let o=r.response?.type==="streaming"||r.response?.type==="streamParameter",c=this.csharp.invokeMethod({on:this.csharp.codeblock("client"),method:this.getMethod({endpoint:r}),arguments_:this.getMethodArgs({endpoint:r,snippet:i}),async:!0,configureAwait:!0,multiline:!0,isAsyncEnumerable:o});return o?this.csharp.codeblock(l=>{l.write("await foreach (var item in "),l.writeNode(c),l.writeLine(")"),l.pushScope(),l.writeLine("/* consume each item */"),l.popScope()}):c}getConstructorArgs({endpoint:r,snippet:i}){let o=[];r.auth!=null&&(i.auth!=null?o.push(...this.getConstructorAuthArgs({auth:r.auth,values:i.auth})):this.context.errors.add({severity:te.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let c=[],l=this.getConstructorBaseUrlArgs({baseUrl:i.baseURL,environment:i.environment});l.length>0&&c.push(...l),this.context.errors.scope(tt.Headers);let b=[];if(this.context.ir.headers!=null&&i.headers!=null&&b.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:i.headers})),this.context.errors.unscope(),this.settings.unifiedClientOptions){let w=[...o.map(A=>({name:Le(A.name),assignment:A.assignment})),...b.map(A=>({name:Le(A.name),assignment:A.assignment})),...c.map(A=>({name:A.name,assignment:A.assignment}))];return w.length===0?[]:[{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:w,multiline:!0})}]}return c.length===0?[...o,...b]:[...o,...b,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:c.map(w=>({name:w.name,assignment:w.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:r,environment:i}){let o=this.getBaseUrlArg({baseUrl:r,environment:i});return v.Literal.nop(o)?[]:[{name:this.getBaseUrlOptionName(),assignment:o}]}getBaseUrlArg({baseUrl:r,environment:i}){if(r!=null&&i!=null)return this.context.errors.add({severity:te.Critical,message:"Cannot specify both baseUrl and environment options"}),this.csharp.Literal.nop();if(r!=null)return this.context.ir.environments?.environments.type==="multipleBaseUrls"?(this.context.errors.add({severity:te.Critical,message:"The C# SDK doesn't support a baseUrl when multiple URL environments are configured"}),this.csharp.Literal.nop()):this.csharp.Literal.string(r);if(i!=null){if(this.context.isSingleEnvironmentID(i)){let o=this.context.getEnvironmentTypeReferenceFromID(i);return o==null?(this.context.errors.add({severity:te.Warning,message:`Environment ${JSON.stringify(i)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(o)}if(this.context.isMultiEnvironmentValues(i))return this.context.validateMultiEnvironmentUrlValues(i)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(i).map(([o,c])=>({name:Le(lr(o)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:c})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:r,values:i}){if(i.type!==r.type)return this.addError(this.context.newAuthMismatchError({auth:r,values:i}).message),[];switch(r.type){case"basic":return i.type==="basic"?this.getConstructorBasicAuthArg({auth:r,values:i}):[];case"bearer":return i.type==="bearer"?this.getConstructorBearerAuthArgs({auth:r,values:i}):[];case"header":return i.type==="header"?this.getConstructorHeaderAuthArgs({auth:r,values:i}):[];case"oauth":return i.type==="oauth"?this.getConstructorOAuthArgs({auth:r,values:i}):[];case"inferred":return i.type==="inferred"?this.getConstructorInferredAuthArgs({auth:r,values:i}):[];default:ue(r)}}addError(r){this.context.errors.add({severity:te.Critical,message:r})}addWarning(r){this.context.errors.add({severity:te.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:i}){let o=r,c=!!o.usernameOmit,l=!!o.passwordOmit,b=[];return c||b.push({name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(i.username)}),l||b.push({name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(i.password)}),b}getConstructorBearerAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.token),assignment:this.csharp.Literal.string(i.token)}]}getConstructorHeaderAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.header.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:r.header.typeReference,value:i.value,fallbackToDefault:r.header.name.wireValue})}]}getConstructorOAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.clientId),assignment:this.csharp.Literal.string(i.clientId)},{name:this.context.getParameterName(r.clientSecret),assignment:this.csharp.Literal.string(i.clientSecret)}]}getConstructorInferredAuthArgs({auth:r,values:i}){let o=[];if(r.parameters!=null)for(let c of r.parameters){let l=c.name.wireValue,b=i.values?.[l];o.push({name:this.context.getParameterName(c.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:c.typeReference,value:b,fallbackToDefault:l})})}else this.context.errors.add({severity:te.Critical,message:"Inferred auth parameters are not defined in the IR. Please ensure you're using IR version 62.3.0 or later."});return o}getConstructorHeaderArgs({headers:r,values:i}){let o=[];for(let c of r){let l=i[c.name.wireValue],b=this.getConstructorHeaderArg({header:c,value:l});b!=null&&o.push({name:this.context.getParameterName(c.name.name),assignment:b})}return o}getConstructorHeaderArg({header:r,value:i}){let o=this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:i,fallbackToDefault:r.name.wireValue});if(!v.Literal.nop(o))return o}getMethodArgs({endpoint:r,snippet:i}){switch(r.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:r.request,snippet:i});case"body":return this.getMethodArgsForBodyRequest({request:r.request,snippet:i});default:ue(r.request)}}getMethodArgsForInlinedRequest({request:r,snippet:i}){this.context.errors.scope(tt.PathParameters);let o=[...this.context.ir.pathParameters??[],...r.pathParameters??[]],c=this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters}),l=c?this.getPathParameters({namedParameters:o,snippet:i}):[],b=c?[]:this.getPathParameterArguments({namedParameters:o,snippet:i});this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let w=this.getFilePropertyInfo({request:r,snippet:i});this.context.errors.unscope();let A=this.getInlinedRequestArg({request:r,snippet:i,pathParameterFields:l,filePropertyInfo:w});return b.length>0?[...b.map(I=>this.namedArgument({name:I.name,value:I.value})),this.namedArgument({name:rd,value:A})]:[A]}getFilePropertyInfo({request:r,snippet:i}){return r.body==null||!this.context.isFileUploadRequestBody(r.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:r.body,value:i.requestBody})}getInlinedRequestArg({request:r,snippet:i,pathParameterFields:o,filePropertyInfo:c}){let l=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)});this.context.errors.scope(tt.QueryParameters);let w=this.context.associateQueryParametersByWireValue({parameters:r.queryParameters??[],values:i.queryParameters??{}}).map(L=>({name:this.context.resolvePropertyName(l,L.name.name),value:this.context.dynamicLiteralMapper.convert(L)}));this.context.errors.unscope(),this.context.errors.scope(tt.Headers);let I=this.context.associateByWireValue({parameters:r.headers??[],values:i.headers??{}}).map(L=>({name:this.context.resolvePropertyName(l,L.name.name),value:this.context.dynamicLiteralMapper.convert({...L,fallbackToDefault:L.name.wireValue})}));this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let P=r.body!=null?this.getInlinedRequestBodyConstructorFields({body:r.body,value:i.requestBody,filePropertyInfo:c,classReference:l}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:l,fields:[...o,...w,...I,...P]})}getInlinedRequestBodyConstructorFields({body:r,value:i,filePropertyInfo:o,classReference:c}){switch(r.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:r.value,value:i,classReference:c});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:c})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:o});default:ue(r)}}getInlinedRequestBodyPropertyConstructorFields({parameters:r,value:i,classReference:o}){let c=[],l=this.context.associateByWireValue({parameters:r,values:this.context.getRecord(i)??{}});for(let b of l)c.push({name:this.context.resolvePropertyName(o,b.name.name),value:this.context.dynamicLiteralMapper.convert({...b,fallbackToDefault:b.name.wireValue})});return c}getFileUploadRequestBodyConstructorFields({filePropertyInfo:r}){return[...r.fileFields,...r.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:o}){return{name:this.context.resolvePropertyName(o,r.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:r.bodyType,value:i})}}getReferencedRequestBodyPropertyLiteral({body:r,value:i}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:i});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:i,fallbackToDefault:JSON.stringify(r.value)});default:ue(r)}}getMethodArgsForBodyRequest({request:r,snippet:i}){this.context.errors.scope(tt.PathParameters);let o=[...this.context.ir.pathParameters??[],...r.pathParameters??[]],c=this.getPathParameterArguments({namedParameters:o,snippet:i});this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let l=r.body!=null?this.getBodyRequestArg({body:r.body,value:i.requestBody}):void 0;if(this.context.errors.unscope(),c.length>0&&l!=null)return[...c.map(w=>this.namedArgument({name:w.name,value:w.value})),this.namedArgument({name:rd,value:l})];let b=c.map(w=>w.value);return l!=null&&b.push(l),b}getPathParameterArguments({namedParameters:r,snippet:i}){return this.context.associateByWireValueOrDefault({parameters:r,values:i.pathParameters??{}}).map(c=>({name:this.context.getParameterName(c.name.name),value:this.context.dynamicLiteralMapper.convert({...c,fallbackToDefault:c.name.wireValue,forceLiteral:!0})}))}namedArgument({name:r,value:i}){return this.csharp.codeblock(o=>{o.write(`${r}: `),o.writeNode(i)})}getBodyRequestArg({body:r,value:i}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:i});case"typeReference":return r.value.type==="optional"&&i==null?this.csharp.Literal.null():this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:i,fallbackToDefault:JSON.stringify(r.value)});default:ue(r)}}getBytesBodyRequestArg({value:r}){let i=this.context.getValueAsString({value:r});return i==null&&(this.context.errors.add({severity:te.Critical,message:"The bytes request body must be provided in string format"}),i="[bytes]"),this.csharp.Literal.reference(this.context.getMemoryStreamForString(i))}getRootClientConstructorInvocation(r){return this.csharp.instantiateClass({classReference:this.Types.RootClientForSnippets,arguments_:r,forceUseConstructor:!0,multiline:!0})}getPathParameters({namedParameters:r,snippet:i}){let o=[],c=this.context.associateByWireValueOrDefault({parameters:r,values:i.pathParameters??{}});for(let l of c)o.push({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicLiteralMapper.convert({...l,fallbackToDefault:l.name.wireValue})});return o}getMethod({endpoint:r}){return r.declaration.fernFilepath.allParts.length>0?`${r.declaration.fernFilepath.allParts.map(i=>this.context.getClassName(i)).join(".")}.${this.context.getMethodName(r.declaration.name)}`:this.context.getMethodName(r.declaration.name)}getBaseUrlOptionName(){return this.context.ir.environments?.environments.type==="multipleBaseUrls"?"Environment":"BaseUrl"}getStyle(r){return r.style??this.context.options.style??Qt.Full}getConfig(r){return r.config??this.context.options.config??{}}};var nc=class extends Yi{constructor({ir:t,config:r,options:i={}}){super(new Po({ir:t,config:r,options:i}))}precalculate(t){this.context.precalculate(t)}async generate(t,r={}){return super.generate(t,r)}generateSync(t,r={}){return super.generateSync(t,r)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new Co({context:t})}};export{nc as DynamicSnippetsGenerator,Sd as buildSnippetTestGeneratorConfig};
33
+ ${Ui()}`)}return this.generation.registry.registerClassReference(t,r)}freezeClassReferences(){this.frozen=!0}getPropertyName(t,r){let i=this.model.getPropertyNameFor(r),o=this.model.origin(r);if(o){let c=t.getFieldName(o,i);if(c)return c}return i}class_(t){let r=t;return"reference"in t&&(r={...t.reference,...t}),new nt(r,this.generation)}testClass(t){return new Ni(t,this.generation)}annotation(t){return new gt(t,this.generation)}annotationGroup(t){return new yi(t,this.generation)}instantiateClass(t){return new Zr(t,this.generation)}invokeMethod(t){return new ii(t,this.generation)}codeblock(t){return new Mt(t,this.generation)}code(){return new vt({},this.generation)}anonymousFunction(t){return new gi(t)}parameter(t){return new Ye(t,this.generation)}interface_(t){return new Ii(t,this.generation)}enum_(t){return new Ai(t,this.generation)}dictionary(t){return new ei(t,this.generation)}list(t){return new ri(t,this.generation)}readOnlyMemory(t){return new ni(t,this.generation)}set(t){return new si(t,this.generation)}switch_(t){return new xi(t,this.generation)}ternary(t){return new Si(t,this.generation)}and(t){return new hi(t,this.generation)}or(t){return new bi(t,this.generation)}enumInstantiation(t){return new ti(t,this.generation)}string_(t){return new ai(t,this.generation)}xmlDocBlock(t){return new qt(t,this.generation)}xmlDocBlockOf(t){return t instanceof qt?t:new qt(t,this.generation)}validateReadOnlyMemoryTypes(){for(let t of this.generation.settings.readOnlyMemoryTypes)if(!this.VALID_READ_ONLY_MEMORY_TYPES.has(t))throw new Error(`Type "${t}" is not a valid 'read-only-memory-types' custom config option; expected one of ${JSON.stringify(this.VALID_READ_ONLY_MEMORY_TYPES)}.`)}};n();a();s();function J(e){let t={},r={};for(let[i,o]of Object.entries(e))o.length===0?Object.defineProperty(r,i,{get(){return i in t||(t[i]=o()),t[i]},enumerable:!0,configurable:!0}):r[i]=o;return r}n();a();s();var Eo=class{constructor(t){y(this,"generation");y(this,"System",J({Action:t=>this.csharp.classReference({name:"Action",namespace:"System",generics:t||void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),Func:(t,r)=>this.csharp.classReference({name:"Func",namespace:"System",generics:t?r?[...t,r]:t:r?[r]:void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),DateOnly:()=>this.csharp.classReference({name:"DateOnly",namespace:"System"}),DateTime:()=>this.csharp.classReference({name:"DateTime",namespace:"System"}),Enum:()=>this.csharp.classReference({name:"Enum",namespace:"System"}),Exception:()=>this.csharp.classReference({name:"Exception",namespace:"System"}),ReadOnlyMemory:t=>this.csharp.classReference({name:"ReadOnlyMemory",namespace:"System",generics:[t]}),Serializable:()=>this.csharp.classReference({name:"SerializableAttribute",namespace:"System"}),String:()=>this.csharp.classReference({name:"String",namespace:"System"}),Type:()=>this.csharp.classReference({name:"Type",namespace:"System",isReferenceType:!0,multipartMethodName:null,multipartMethodNameForCollection:null,fullyQualified:!0}),TimeSpan:()=>this.csharp.classReference({name:"TimeSpan",namespace:"System"}),Uri:()=>this.csharp.classReference({name:"Uri",namespace:"System"}),UriBuilder:()=>this.csharp.classReference({name:"UriBuilder",namespace:"System"}),Runtime:()=>J({Serialization:()=>J({EnumMember:()=>this.csharp.classReference({name:"EnumMemberAttribute",namespace:"System.Runtime.Serialization"})})}),Collections:()=>J({Generic:()=>J({IAsyncEnumerable:t=>this.csharp.classReference({name:"IAsyncEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),IEnumerable:t=>this.csharp.classReference({name:"IEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),KeyValuePair:(t,r)=>this.csharp.classReference({name:"KeyValuePair",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0}),List:t=>this.csharp.classReference({name:"List",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),HashSet:t=>this.csharp.classReference({name:"HashSet",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),Dictionary:(t,r)=>this.csharp.classReference({name:"Dictionary",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0,isCollection:!0}),IDictionary:(t,r)=>this.csharp.classReference({name:"IDictionary",namespace:"System.Collections.Generic",generics:[t,r]})}),Linq:()=>J({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>J({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>J({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>J({Http:()=>J({HttpClient:()=>this.csharp.classReference({name:"HttpClient",namespace:"System.Net.Http"}),HttpMethod:()=>this.csharp.classReference({name:"HttpMethod",namespace:"System.Net.Http"}),HttpResponseHeaders:()=>this.csharp.classReference({name:"HttpResponseHeaders",namespace:"System.Net.Http.Headers"})}),ServerSentEvents:()=>J({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>J({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>J({MemoryStream:()=>this.csharp.classReference({name:"MemoryStream",namespace:"System.IO"}),Stream:()=>this.csharp.classReference({name:"Stream",namespace:"System.IO"}),StreamReader:()=>this.csharp.classReference({name:"StreamReader",namespace:"System.IO"})}),Text:()=>J({Encoding:()=>this.csharp.classReference({name:"Encoding",namespace:"System.Text"}),Encoding_UTF8:()=>this.csharp.classReference({name:"UTF8",enclosingType:this.csharp.classReference({name:"Encoding",namespace:"System.Text"})}),Json:()=>J({JsonElement:()=>this.csharp.classReference({name:"JsonElement",namespace:"System.Text.Json"}),JsonDocument:()=>this.csharp.classReference({name:"JsonDocument",namespace:"System.Text.Json"}),JsonException:()=>this.csharp.classReference({name:"JsonException",namespace:"System.Text.Json"}),Utf8JsonReader:()=>this.csharp.classReference({name:"Utf8JsonReader",namespace:"System.Text.Json"}),JsonSerializerOptions:()=>this.csharp.classReference({name:"JsonSerializerOptions",namespace:"System.Text.Json"}),JsonSerializer:()=>this.csharp.classReference({name:"JsonSerializer",namespace:"System.Text.Json"}),Utf8JsonWriter:()=>this.csharp.classReference({name:"Utf8JsonWriter",namespace:"System.Text.Json"}),Nodes:()=>J({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>J({IJsonOnDeserialized:()=>this.csharp.classReference({name:"IJsonOnDeserialized",namespace:"System.Text.Json.Serialization"}),IJsonOnSerializing:()=>this.csharp.classReference({name:"IJsonOnSerializing",namespace:"System.Text.Json.Serialization"}),JsonOnDeserializedAttribute:()=>this.csharp.classReference({name:"JsonOnDeserializedAttribute",namespace:"System.Text.Json.Serialization"}),JsonExtensionData:()=>this.csharp.classReference({name:"JsonExtensionDataAttribute",namespace:"System.Text.Json.Serialization"}),JsonConverter:t=>this.csharp.classReference({name:"JsonConverter",namespace:"System.Text.Json.Serialization",generics:t?[t]:void 0}),JsonIgnore:()=>this.csharp.classReference({name:"JsonIgnoreAttribute",namespace:"System.Text.Json.Serialization"}),JsonPropertyName:()=>this.csharp.classReference({name:"JsonPropertyNameAttribute",namespace:"System.Text.Json.Serialization"})})})}),Threading:()=>J({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>J({Task:t=>this.csharp.classReference({name:"Task",namespace:"System.Threading.Tasks",generics:t?[t]:void 0}),ValueTask:t=>this.csharp.classReference({name:"ValueTask",namespace:"System.Threading.Tasks",generics:t?[t]:void 0})})}),ComponentModel:()=>J({INotifyPropertyChanged:()=>this.csharp.classReference({name:"INotifyPropertyChanged",namespace:"System.ComponentModel"}),PropertyChangedEventHandler:()=>this.csharp.classReference({name:"PropertyChangedEventHandler",namespace:"System.ComponentModel"})}),IAsyncDisposable:()=>this.csharp.classReference({name:"IAsyncDisposable",namespace:"System"}),IDisposable:()=>this.csharp.classReference({name:"IDisposable",namespace:"System"})}));y(this,"NUnit",J({Framework:()=>J({TestFixture:()=>this.csharp.classReference({name:"TestFixture",namespace:"NUnit.Framework"}),Test:()=>this.csharp.classReference({name:"Test",namespace:"NUnit.Framework"}),OneTimeTearDown:()=>this.csharp.classReference({name:"OneTimeTearDown",namespace:"NUnit.Framework"}),OneTimeSetUp:()=>this.csharp.classReference({name:"OneTimeSetUp",namespace:"NUnit.Framework"}),SetUpFixture:()=>this.csharp.classReference({name:"SetUpFixture",namespace:"NUnit.Framework"}),Parallelizable:()=>this.csharp.classReference({name:"Parallelizable",namespace:"NUnit.Framework"})})}));y(this,"OneOf",J({OneOf:t=>this.csharp.classReference({name:"OneOf",namespace:"OneOf",generics:t}),OneOfBase:t=>this.csharp.classReference({name:"OneOfBase",namespace:"OneOf",generics:t})}));y(this,"Google",J({Protobuf:()=>J({ByteString:()=>this.csharp.classReference({name:"ByteString",namespace:"Google.Protobuf"}),WellKnownTypes:()=>J({Struct:()=>this.csharp.classReference({name:"Struct",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Value:()=>this.csharp.classReference({name:"Value",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),ListValue:()=>this.csharp.classReference({name:"ListValue",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Timestamp:()=>this.csharp.classReference({name:"Timestamp",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"})})})}));y(this,"WireMock",J({Server:()=>this.csharp.classReference({name:"WireMockServer",namespace:"WireMock.Server"}),WireMockServerSettings:()=>this.csharp.classReference({name:"WireMockServerSettings",namespace:"WireMock.Settings"}),WireMockConsoleLogger:()=>this.csharp.classReference({name:"WireMockConsoleLogger",namespace:"WireMock.Logging"})}));y(this,"Grpc",J({Core:()=>J({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};n();a();s();var ic=new Set(["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"]);function eg(e,t){return ic.has(t)?e??"":e?`${e}.${t}`:t}var Ao=class{constructor(t,r){y(this,"generation");y(this,"indexByObject",new Map);y(this,"indexByPath",new Map);y(this,"explicitByObject",new Map);y(this,"explicitByPath",new Map);y(this,"root");y(this,"ir");this.generation=r,this.root=this.createIndex(t),this.ir=t}get csharp(){return this.generation.csharp}get registry(){return this.generation.registry}createIndex(t,r="",i){let o=eg(i?.jsonPath,r);if(this.indexByPath.has(o)){i||de(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,i);let l=ic.has(r);for(let[b,w]of Object.entries(t))typeof w=="object"&&w!==null&&(l&&ic.has(b)?this.indexByObject.set(w,i):this.createIndex(w,b,i));return i}let c={jsonPath:o,name:r,node:t,parent:i};this.indexByObject.set(t,c),this.indexByPath.set(o,c);for(let[l,b]of Object.entries(t))typeof b=="object"&&b!==null&&this.createIndex(b,l,c);return c}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){let i=this.provenance(t)??de(`Provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),o={...i,jsonPath:`${i.jsonPath}+${r}`,name:r,node:i.node,parent:i,explicit:!0},c=this.explicitByObject.get(i.node);return c?c.add(o):this.explicitByObject.set(i.node,new Set([o])),this.explicitByPath.set(o.jsonPath,o),o}provenance(t){if(t!==void 0)return v.string(t)?this.explicitByPath.get(t)??this.indexByPath.get(t):v.Provenance(t)?this.explicitByPath.get(t.jsonPath)??this.indexByPath.get(t.jsonPath):this.indexByObject.get(t)}origin(t){let r=this.provenance(t);return r?.explicit?r:r?.node}irNode(t){return this.provenance(t)?.node}jsonPath(t){return this.provenance(t)?.jsonPath}getEnumValueName(t,r){let i=v.IR.ExampleEnumType(r)?r.value:r,o=t.values.find(c=>this.nameEquals(c.name,i));return o?this.getPropertyNameFor(o):de(`Unexpected - can't find enum value ${JSON.stringify(i)} in enum`)}getPropertyNameFor(t){let r=this.registry.getFieldNameByOrigin(t);if(r)return r;if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${this.jsonPath(t)}`)}getClassNameFor(t){if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.TypeDeclaration(t))return this.generation.case.pascalSafe(t.name.name);if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${JSON.stringify(t)}`)}nameEquals(t,r){return this.generation.case.camelSafe(t)===this.generation.case.camelSafe(r)}dereferenceType(t){let r=v.string(t)?t:v.IR.NamedType(t)||v.IR.DeclaredTypeName(t)?t.typeId:v.IR.ExampleNamedType(t)?t.typeName.typeId:t.name.typeId,i=this.irNode(this.ir.types[r]);if(v.IR.TypeDeclaration(i))return{typeId:r,typeDeclaration:i};de(`dereferenceType: typeId ${r} not resolved.`)}};function Io(...e){return e.filter(Boolean).join("/")}var jn=class{constructor(t,r,i,o,c={makeRelativeFilePath:l=>l,makeAbsoluteFilePath:l=>l,getNamespaceForTypeId:l=>"",getDirectoryForTypeId:l=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:l=>[]}){y(this,"intermediateRepresentation");y(this,"apiName");y(this,"customConfig");y(this,"generatorConfig");y(this,"support");y(this,"ir");y(this,"dir");y(this,"csharp",new To(this));y(this,"registry",new Oi(this));y(this,"model");y(this,"case");y(this,"extern",new Eo(this));y(this,"settings",J({namespace:()=>this.customConfig.namespace??co(po(`${this.generatorConfig.organization}_${this.apiName}`)),readOnlyMemoryTypes:()=>this.customConfig["read-only-memory-types"]??[],simplifyObjectDictionaries:()=>this.customConfig["simplify-object-dictionaries"]??!1,useFullyQualifiedNamespaces:()=>this.customConfig["experimental-fully-qualified-namespaces"]??!1,useDotnetFormat:()=>this.customConfig["experimental-dotnet-format"]??!1,enableWebsockets:()=>this.customConfig["experimental-enable-websockets"]??!1,enableReadonlyConstants:()=>this.customConfig["experimental-readonly-constants"]??!1,generateLiterals:()=>this.customConfig["generate-literals"]??this.customConfig["experimental-readonly-constants"]??!1,enableExplicitNullableOptional:()=>this.customConfig["experimental-explicit-nullable-optional"]??!1,useDefaultRequestParameterValues:()=>this.customConfig["use-default-request-parameter-values"]??!1,redactResponseBodyOnError:()=>this.customConfig["redact-response-body-on-error"]??!1,enableInlineTypes:()=>this.customConfig["enable-inline-types"]??!1,temporaryWebsocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},baseApiExceptionClassName:()=>this.customConfig["base-api-exception-class-name"]??"",baseExceptionClassName:()=>this.customConfig["base-exception-class-name"]??"",shouldGeneratedDiscriminatedUnions:()=>this.customConfig["use-discriminated-unions"]??!0,shouldGenerateUndiscriminatedUnions:()=>this.customConfig["use-undiscriminated-unions"]??!1,dedupeUnionBaseProperties:()=>this.customConfig["dedupe-union-base-properties"]??!1,exportedClientClassName:()=>this.customConfig["exported-client-class-name"]??"",clientClassName:()=>this.customConfig["client-class-name"]??"",rootNamespaceForCoreClasses:()=>this.customConfig["root-namespace-for-core-classes"]??!0,packageId:()=>this.customConfig["package-id"]??"",isForwardCompatibleEnumsEnabled:()=>this.customConfig["enable-forward-compatible-enums"]??this.customConfig["experimental-enable-forward-compatible-enums"]??!0,websocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},customPagerName:()=>this.customConfig["custom-pager-name"]??"",usePageIndexSemantics:()=>this.customConfig["offset-semantics"]==="page-index",environmentClassName:()=>this.customConfig["environment-class-name"]??"",generateErrorTypes:()=>this.customConfig["generate-error-types"]??!0,shouldInlinePathParameters:()=>this.customConfig["inline-path-parameters"]??!0,includeExceptionHandler:()=>this.customConfig["include-exception-handler"]??!1,exceptionInterceptorClassName:()=>this.customConfig["exception-interceptor-class-name"]??"",shouldGenerateMockServerTests:()=>this.customConfig["generate-mock-server-tests"]??this.customConfig["enable-wire-tests"]??!0,rootClientAccess:()=>this.customConfig["root-client-class-access"]=="internal"?ge.Internal:ge.Public,extraDependencies:()=>this.customConfig["extra-dependencies"]??{},omitFernHeaders:()=>this.customConfig["omit-fern-headers"]??!1,includePlatformHeaders:()=>this.customConfig["include-platform-headers"]??!1,userAgentNameFromPackage:()=>this.customConfig["user-agent-name-from-package"]??!1,unifiedClientOptions:()=>this.customConfig["unified-client-options"]??!1,serverUrlVariables:()=>this.customConfig["server-url-variables"]??!0,pascalCaseEnvironments:()=>this.customConfig["pascal-case-environments"]??!0,slnFormat:()=>this.customConfig["sln-format"]??"slnx",explicitNamespaces:()=>this.customConfig["explicit-namespaces"]===!0,maxRetries:()=>this.customConfig.maxRetries,retryStatusCodes:()=>this.customConfig.retryStatusCodes??"legacy",defaultTimeoutInMilliseconds:()=>{let t=this.customConfig["default-timeout-in-milliseconds"];if(t!=null)return t;let r=this.customConfig["default-timeout-in-seconds"];if(r!=null)return r==="infinity"?"infinity":r*1e3},outputPath:()=>{let t=this.customConfig["output-path"];return t==null?{library:"src",test:"src",solution:".",other:"."}:typeof t=="string"?{library:t,test:t,solution:".",other:"."}:{library:t.library??"src",test:t.test??"src",solution:t.solution??".",other:t.other??"."}}}));y(this,"constants",{folders:J({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath(Io(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(Io(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(Io(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(Io(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:J({indent:()=>" "}),defaults:J({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});y(this,"namespaces",J({root:()=>this.settings.namespace,core:()=>`${this.namespaces.root}.Core`,qualifiedRoot:()=>this.qualifyNamespace(this.namespaces.root),qualifiedCore:()=>this.qualifyNamespace(this.namespaces.core),test:()=>this.registry.canonicalizeNamespace(`${this.namespaces.root}.Test`),testUtils:()=>`${this.namespaces.test}.Utils`,mockServerTest:()=>`${this.namespaces.test}.Unit.MockServer`,publicCore:()=>this.namespaces.root,webSocketsCore:()=>`${this.namespaces.core}.WebSockets`,publicCoreTest:()=>`${this.namespaces.root}.Test.PublicCore`,asIsTestUtils:()=>`${this.namespaces.root}.Test.Utils`,publicCoreClasses:()=>this.settings.rootNamespaceForCoreClasses?this.namespaces.root:this.namespaces.core,implicit:()=>new Set(["System","System.Collections.Generic","System.IO","System.Linq","System.Threading","System.Threading.Tasks","System.Net.Http"])}));y(this,"names",{classes:J({baseApiException:()=>this.settings.baseApiExceptionClassName||`${this.names.project.clientPrefix}ApiException`,baseException:()=>this.settings.baseExceptionClassName||`${this.names.project.clientPrefix}Exception`,rootClient:()=>this.settings.clientClassName||`${this.names.project.clientPrefix}Client`,rootClientForSnippets:()=>this.settings.exportedClientClassName||this.names.classes.rootClient,customPager:()=>this.settings.customPagerName||`${this.names.project.packageId.replace(/[^a-zA-Z0-9]/g,"")}Pager`,environment:()=>this.settings.environmentClassName||`${this.names.project.clientPrefix}Environment`,exceptionInterceptor:()=>this.settings.exceptionInterceptorClassName||`${this.names.project.packageId.replace(/[^a-zA-Z0-9]/g,"")}ExceptionInterceptor`}),project:J({client:()=>co(po(`${this.generatorConfig.organization}_${this.generatorConfig.workspaceName}`)),clientPrefix:()=>this.settings.exportedClientClassName||this.settings.clientClassName||this.names.project.client,packageId:()=>this.settings.packageId||this.namespaces.root}),files:J({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:J({mockOauth:()=>"MockOAuthEndpoint",mockInferredAuth:()=>"MockInferredAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync",getAuthHeadersAsync:()=>"GetAuthHeadersAsync"}),variables:J({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:J({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});y(this,"Types",J({Arbitrary:t=>new re.ArbitraryType(t,this),HttpMethodExtensions:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HttpMethodExtensions")}),FormRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("FormRequest")}),Optional:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("Optional")}),ClientOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("ClientOptions"),namespace:this.namespaces.publicCoreClasses}),RawClient:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("RawClient")}),RequestOptions:()=>this.csharp.classReference({namespace:this.namespaces.publicCoreClasses,origin:this.model.staticExplicit("RequestOptions")}),RequestOptionsInterface:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("IRequestOptions")}),JsonRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("JsonRequest")}),Version:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("Version")}),ValueConvert:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("ValueConvert")}),FileParameter:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("FileParameter"),multipartMethodName:"AddFileParameterPart",multipartMethodNameForCollection:"AddFileParameterParts",isReferenceType:!0}),DefaultHttpClientFactory:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("DefaultHttpClientFactory")}),Headers:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("Headers")}),HeaderValue:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HeaderValue")}),RootClient:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClient),namespace:this.namespaces.root}),RootClientForSnippets:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClientForSnippets),namespace:this.namespaces.root}),BaseApiException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseApiException),namespace:this.namespaces.publicCoreClasses}),BaseException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseException),namespace:this.namespaces.publicCoreClasses}),ExceptionInterceptor:()=>this.csharp.classReference({origin:this.model.staticExplicit("IExceptionInterceptor"),namespace:this.namespaces.core}),ExceptionHandler:()=>this.csharp.classReference({origin:this.model.staticExplicit("ExceptionHandler"),namespace:this.namespaces.core}),CustomExceptionInterceptor:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.exceptionInterceptor),namespace:this.namespaces.core}),ProtoAnyMapper:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoAnyMapper"),namespace:this.namespaces.core}),Constants:()=>this.csharp.classReference({origin:this.model.staticExplicit("Constants"),namespace:this.namespaces.core}),DateTimeSerializer:()=>this.csharp.classReference({origin:this.model.staticExplicit("DateTimeSerializer"),namespace:this.namespaces.core}),JsonUtils:()=>this.csharp.classReference({origin:this.model.staticExplicit("JsonUtils"),namespace:this.namespaces.core}),JsonAssert:()=>this.csharp.classReference({origin:this.model.staticExplicit("JsonAssert"),namespace:this.namespaces.testUtils}),CustomPagerFactory:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Factory`),namespace:this.namespaces.core}),CustomPagerContext:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Context`),namespace:this.namespaces.core}),Environments:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.environment),namespace:this.namespaces.publicCoreClasses}),TestClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("TestClient"),namespace:this.namespaces.test}),BaseMockServerTest:()=>this.csharp.classReference({origin:this.model.staticExplicit("BaseMockServerTest"),namespace:this.namespaces.mockServerTest}),IdempotentRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("IdempotentRequestOptions"),namespace:this.namespaces.publicCoreClasses}),IdempotentRequestOptionsInterface:()=>this.csharp.classReference({origin:this.model.staticExplicit("IIdempotentRequestOptions"),namespace:this.namespaces.core}),IStringEnum:()=>this.csharp.classReference({origin:this.model.staticExplicit("IStringEnum"),namespace:this.namespaces.core}),WebSocketClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("WebSocketClient"),namespace:this.namespaces.webSocketsCore}),QueryBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("Query"),namespace:this.namespaces.webSocketsCore}),QueryStringBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("QueryStringBuilder"),namespace:this.namespaces.core}),QueryStringBuilderBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("QueryStringBuilder.Builder"),namespace:this.namespaces.core}),OAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("OAuthTokenProvider"),namespace:this.namespaces.core}),InferredAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("InferredAuthTokenProvider"),namespace:this.namespaces.core}),ProtoConverter:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoConverter"),namespace:this.namespaces.core}),RawGrpcClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("RawGrpcClient"),namespace:this.namespaces.core}),Extensions:()=>this.csharp.classReference({origin:this.model.staticExplicit("Extensions"),namespace:this.namespaces.core}),GrpcRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcRequestOptions"),namespace:this.namespaces.root}),GrpcChannelOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcChannelOptions"),namespace:"Grpc.Net.Client"}),StringEnum:t=>this.csharp.classReference({origin:this.model.staticExplicit("StringEnum"),namespace:this.namespaces.core,generics:t?[t]:void 0}),WebSocketEvent:t=>this.csharp.classReference({origin:this.model.staticExplicit("Event"),namespace:this.namespaces.webSocketsCore,generics:[t]}),ConnectionStatus:()=>this.csharp.classReference({origin:this.model.staticExplicit("ConnectionStatus"),namespace:this.namespaces.webSocketsCore}),WebSocketConnected:()=>this.csharp.classReference({origin:this.model.staticExplicit("Connected"),namespace:this.namespaces.webSocketsCore}),WebSocketClosed:()=>this.csharp.classReference({origin:this.model.staticExplicit("Closed"),namespace:this.namespaces.webSocketsCore}),ReconnectionInfo:()=>this.csharp.classReference({origin:this.model.staticExplicit("ReconnectionInfo"),namespace:this.namespaces.webSocketsCore}),CustomPagerClass:t=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.customPager),namespace:this.namespaces.core,generics:[t]}),Pager:t=>this.csharp.classReference({origin:this.model.staticExplicit("Pager"),namespace:this.namespaces.core,generics:[t]}),OffsetPager:({requestType:t,requestOptionsType:r,responseType:i,offsetType:o,stepType:c,itemType:l})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,o,c,l]}),CursorPager:({requestType:t,requestOptionsType:r,responseType:i,cursorType:o,itemType:c})=>this.csharp.classReference({origin:this.model.staticExplicit("CursorPager"),namespace:this.namespaces.core,generics:[t,r,i,o,c]}),CollectionItemSerializer:(t,r)=>this.csharp.classReference({origin:this.model.staticExplicit("CollectionItemSerializer"),namespace:this.namespaces.core,generics:[t,r]}),OneOfSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("OneOfSerializer"),namespace:this.namespaces.core,generics:[t]}),AdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("AdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0}),ReadOnlyAdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("ReadOnlyAdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0})}));y(this,"Primitive",J({string:()=>new re.String(this),boolean:()=>new re.Boolean(this),integer:()=>new re.Integer(this),long:()=>new re.Long(this),uint:()=>new re.Uint(this),ulong:()=>new re.ULong(this),float:()=>new re.Float(this),double:()=>new re.Double(this),object:()=>new re.Object(this)}));y(this,"Value",J({binary:()=>new Ue.Binary(this),dateOnly:()=>new Ue.DateOnly(this),dateTime:()=>new Ue.DateTime(this),uuid:()=>new Ue.Uuid(this),stringEnum:t=>new Ue.StringEnum(t,this)}));y(this,"Collection",J({array:t=>new we.Array(t,this),listType:t=>new we.ListType(t,this),list:t=>new we.List(t,this),set:t=>new we.Set(t,this),map:(t,r,i)=>new we.Map(t,r,this,i),idictionary:(t,r,i)=>new we.IDictionary(t,r,this,i),keyValuePair:(t,r)=>new we.KeyValuePair(t,r,this)}));y(this,"format",J({private:t=>`_${lo.camelCase(t)}`}));y(this,"initializers",J({implicitNamespaces:()=>{for(let t of this.namespaces.implicit)this.registry.addImplicitNamespace(t);return!0}}));this.intermediateRepresentation=t,this.apiName=r,this.customConfig=i,this.generatorConfig=o,this.support=c;let l=v.IR.IntermediateRepresentation(t)?t.casingsConfig:void 0;this.case=new Hi({generationLanguage:"csharp",keywords:l?.keywords,smartCasing:l?.smartCasing??!0}),this.model=new Ao(t,this),this.ir=v.IR.IntermediateRepresentation(t)?t:{},this.dir=v.DynamicIR.DynamicIntermediateRepresentation(t)?t:{}}initialize(){return this.initializers.implicitNamespaces}get System(){return this.extern.System}get NUnit(){return this.extern.NUnit}get OneOf(){return this.extern.OneOf}get Google(){return this.extern.Google}get Grpc(){return this.extern.Grpc}get WireMock(){return this.extern.WireMock}qualifyNamespace(t){let r=t.split(".")[0];return r&&this.registry.hasTypeNamespaceConflict(r)?`global::${t}`:t}};n();a();s();var Ze=class{constructor(t){y(this,"generation");this.generation=t}get csharp(){return this.generation.csharp}get case(){return this.generation.case}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get namespaces(){return this.generation.namespaces}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get registry(){return this.generation.registry}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get Grpc(){return this.generation.extern.Grpc}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}};n();a();s();var No=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){if(r.value===null)return this.context.isNullable(r.typeReference)?this.csharp.Literal.null():(this.context.errors.add({severity:te.Critical,message:"Expected non-null value, but got null"}),this.csharp.Literal.nop());if(r.value===void 0&&!r.fallbackToDefault)return this.csharp.Literal.nop();switch(r.typeReference.type){case"list":return this.convertList({list:r.typeReference.value,value:r.value,fallbackToDefault:r.fallbackToDefault});case"literal":return this.convertLiteral({literal:r.typeReference.value,fallbackToDefault:r.forceLiteral?r.fallbackToDefault:void 0,value:r.value,forceLiteral:r.forceLiteral});case"map":return this.convertMap({map:r.typeReference,value:r.value,fallbackToDefault:r.fallbackToDefault});case"named":{let i=this.context.resolveNamedType({typeId:r.typeReference.value});return i==null?this.csharp.Literal.nop():this.convertNamed({named:i,value:r.value,as:r.as,fallbackToDefault:r.fallbackToDefault})}case"nullable":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as,forceLiteral:r.forceLiteral});case"optional":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as,forceLiteral:r.forceLiteral});case"primitive":return this.convertPrimitive({primitive:r.typeReference.value,value:r.value,as:r.as,fallbackToDefault:r.fallbackToDefault});case"set":return this.convertSet({set:r.typeReference.value,value:r.value,fallbackToDefault:r.fallbackToDefault});case"unknown":return this.convertUnknown({value:r.value,fallbackToDefault:r.fallbackToDefault});default:ue(r.typeReference)}}convertList({list:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((c,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:te.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertLiteral({literal:r,value:i,fallbackToDefault:o,forceLiteral:c}){if(this.settings.generateLiterals&&!c)return this.csharp.Literal.nop();switch(r.type){case"boolean":{let l=this.context.getValueAsBoolean({value:i});return l==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(l)}case"string":{let l=this.context.getValueAsString({value:i});return l==null?o?this.Primitive.string.getDeterminsticDefault(o):this.csharp.Literal.nop():this.csharp.Literal.string(l)}default:ue(r)}}convertSet({set:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((c,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:te.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertMap({map:r,value:i,fallbackToDefault:o}){return typeof i!="object"||i==null?(this.context.errors.add({severity:te.Critical,message:`Expected object but got: ${i==null?"null":typeof i}`}),this.csharp.Literal.nop()):this.csharp.Literal.dictionary({keyType:this.context.dynamicTypeMapper.convert({typeReference:r.key}),valueType:r.value.type==="unknown"?this.context.dynamicTypeMapper.convert({typeReference:r.value}).asOptional():this.context.dynamicTypeMapper.convert({typeReference:r.value}),entries:Object.entries(i).map(([c,l])=>{this.context.errors.scope(c);try{return{key:this.convert({typeReference:r.key,value:c,as:"key"}),value:this.convert({typeReference:r.value,value:l})}}finally{this.context.errors.unscope()}})})}convertNamed({named:r,value:i,as:o,fallbackToDefault:c}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),arguments_:[]})):this.convert({typeReference:r.typeReference,value:i,as:o,fallbackToDefault:c});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:c}):this.convertUnknown({value:i,fallbackToDefault:c});case"enum":return this.getEnumValue(r,i);case"object":return this.convertObject({object_:r,value:i,fallbackToDefault:c});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:c});default:ue(r)}}convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:o}){let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:i});if(l==null)return this.csharp.Literal.nop();let b=l.singleDiscriminatedUnionType,w=this.getBaseProperties({discriminatedUnionTypeInstance:l,singleDiscriminatedUnionType:b});switch(b.type){case"samePropertiesAsObject":{let A=this.context.resolveNamedType({typeId:b.typeId});return A==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.convertNamed({named:A,value:l.value})]})}case"singleProperty":{if(this.context.getRecord(l.value)==null)return this.csharp.Literal.nop();try{let I=["Value","Type"].includes(b.discriminantValue.name.pascalCase.safeName)?`${b.discriminantValue.name.pascalCase.safeName}Inner`:b.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(b.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:I,enclosingType:c}),arguments_:[this.convert({typeReference:b.typeReference,value:b.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:l.discriminantValue,enclosingType:c}),arguments_:[]})]});default:ue(b)}}getBaseProperties({discriminatedUnionTypeInstance:r,singleDiscriminatedUnionType:i}){return this.context.associateByWireValue({parameters:i.properties??[],values:this.context.getRecord(r.value)??{},ignoreMissingParameters:!0}).map(c=>{this.context.errors.scope(c.name.wireValue);try{return{name:this.context.getPropertyName(c.name.name),assignment:this.convert(c)}}finally{this.context.errors.unscope()}})}instantiateUnionWithBaseProperties({classReference:r,arguments_:i,baseProperties:o}){let c=this.csharp.instantiateClass({classReference:r,arguments_:i,multiline:!0});return o.length===0?this.csharp.Literal.reference(c):this.csharp.Literal.reference(this.csharp.codeblock(l=>{l.write(c," "),l.pushScope();for(let b of o)l.write(b.name," = ",b.assignment,",");l.popScope(!1)}))}getEnumValue(r,i){if(typeof i!="string")return this.context.errors.add({severity:te.Critical,message:`Expected enum value string, got: ${typeof i}`}),this.csharp.Literal.nop();let o=r.values.find(b=>b.wireValue===i);if(o==null)return this.context.errors.add({severity:te.Critical,message:`An enum value named "${i}" does not exist in this context`}),this.csharp.Literal.nop();let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=c.registerField(this.model.getPropertyNameFor(o),o);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:c,value:l}))}convertObject({object_:r,value:i,fallbackToDefault:o}){let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=this.getOmittedBasePropertyWireValues(r),b=l.size===0?r.properties:r.properties.filter(F=>!l.has(F.name.wireValue)),w=new Map;for(let F of b){let U=this.context.resolvePropertyName(c,F.name.name);w.set(F.name.wireValue,U)}let A=this.context.getRecord(i)??{},I=l.size===0?A:Object.fromEntries(Object.entries(A).filter(([F])=>!l.has(F))),L=this.context.associateByWireValue({parameters:b,values:I}).map(F=>{this.context.errors.scope(F.name.wireValue);try{return{name:w.get(F.name.wireValue)??this.context.getClassName(F.name.name),value:this.convert(F)}}finally{this.context.errors.unscope()}}),R=new Set(Object.keys(I));for(let F of b){let U=w.get(F.name.wireValue)??this.context.getClassName(F.name.name);if(R.has(F.name.wireValue)){if(this.isRequiredProperty(F.typeReference)){let M=L.find(W=>W.name===U);if(M!=null&&v.Literal.nop(M.value)){let W=this.getDefaultLiteralForType(F.typeReference);W!=null&&(M.value=W)}}continue}if(this.isRequiredProperty(F.typeReference)){let M=this.getDefaultLiteralForType(F.typeReference);M!=null&&L.push({name:U,value:M})}}return this.csharp.Literal.class_({reference:c,fields:L})}getOmittedBasePropertyWireValues(r){return this.settings.dedupeUnionBaseProperties?new Set((r.deferredUnionBaseProperties??[]).map(i=>i.wireValue)):new Set}isRequiredProperty(r){return!(this.context.isOptional(r)||this.context.isNullable(r)||r.type==="list"||r.type==="set"||r.type==="map")}getDefaultLiteralForType(r,i){switch(r.type){case"primitive":return this.getDefaultLiteralForPrimitive(r.value);case"literal":return this.convertLiteral({literal:r.value,value:r.value.value});case"named":{let o=this.context.resolveNamedType({typeId:r.value});if(o==null)return;if(o.type==="alias")return this.getDefaultLiteralForType(o.typeReference,i);if(o.type==="enum"&&o.values.length>0){let c=o.values[0];if(c!=null)return this.getEnumValue(o,c.wireValue)}return o.type==="undiscriminatedUnion"?this.getDefaultLiteralForUndiscriminatedUnion(o,i):o.type==="object"?this.getDefaultLiteralForObject(o,r.value,i):void 0}default:return}}getDefaultLiteralForObject(r,i,o){let c=o??new Set;if(c.has(i))return;c.add(i);let l=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),b=[];for(let w of r.properties)if(this.isRequiredProperty(w.typeReference)){let A=this.getDefaultLiteralForType(w.typeReference,c);A!=null&&b.push({name:this.context.resolvePropertyName(l,w.name.name),value:A})}return c.delete(i),this.csharp.Literal.class_({reference:l,fields:b})}getDefaultLiteralForUndiscriminatedUnion(r,i){for(let o of r.types){let c=this.getDefaultLiteralForType(o,i);if(c!=null)return c}}getDefaultLiteralForPrimitive(r){switch(r){case"INTEGER":return this.csharp.Literal.integer(0);case"LONG":return this.csharp.Literal.long(0);case"UINT":return this.csharp.Literal.uint(0);case"UINT_64":return this.csharp.Literal.ulong(0);case"FLOAT":return this.csharp.Literal.float(0);case"DOUBLE":return this.csharp.Literal.double(0);case"BOOLEAN":return this.csharp.Literal.boolean(!1);case"STRING":case"UUID":case"BASE_64":case"BIG_INTEGER":return this.csharp.Literal.string("");case"DATE":return this.csharp.Literal.date("0001-01-01");case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.csharp.Literal.datetime("0001-01-01T00:00:00.000Z");default:ue(r)}}convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:o}){let c=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i});return c==null?this.csharp.Literal.nop():c.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i}){for(let o of r.types){let c=this.context.errors.size();try{let l=this.convert({typeReference:o,value:i});if(v.Literal.nop(l)||this.context.errors.size()>c){this.context.errors.truncate(c);continue}return{valueTypeReference:o,typeLiteral:l}}catch{this.context.errors.truncate(c);continue}}this.context.errors.add({severity:te.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof i}" value`})}convertUnknown({value:r,fallbackToDefault:i}){return this.csharp.Literal.unknown(r)}convertPrimitive({primitive:r,value:i,as:o,fallbackToDefault:c}){switch(r){case"INTEGER":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.integer.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.integer(l)}case"LONG":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.long.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.long(l)}case"UINT":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.uint.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.uint(l)}case"UINT_64":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.ulong.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.ulong(l)}case"FLOAT":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.float.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.float(l)}case"DOUBLE":{let l=this.getValueAsNumber({value:i,as:o});return l==null?c?this.Primitive.double.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.double(l)}case"BOOLEAN":{let l=this.getValueAsBoolean({value:i,as:o});return l==null?c?this.Primitive.boolean.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.boolean(l)}case"STRING":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"DATE":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Value.dateOnly.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.date(l)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Value.dateTime.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.datetime(l)}case"UUID":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"BASE_64":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"BIG_INTEGER":{let l=this.context.getValueAsString({value:i});return l==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(l)}default:ue(r)}}getValueAsNumber({value:r,as:i}){let o=i==="key"&&typeof r=="string"?Number(r):r;return this.context.getValueAsNumber({value:o})}getValueAsBoolean({value:r,as:i}){let o=i==="key"?typeof r=="string"?r==="true":r==="false"?!1:r:r;return this.context.getValueAsBoolean({value:o})}};n();a();s();var Ro=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){switch(r.typeReference.type){case"list":return this.Collection.list(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"literal":return this.convertLiteral({literal:r.typeReference.value});case"map":return this.Collection.map(this.convert({typeReference:r.typeReference.key}),this.convert({typeReference:r.typeReference.value}));case"named":{let i=this.context.resolveNamedType({typeId:r.typeReference.value});return i==null?this.convertUnknown():this.convertNamed({named:i,typeId:r.typeReference.value})}case"optional":case"nullable":{let i=this.convert({typeReference:r.typeReference.value});return r.unboxOptionals?i.asNonOptional():i.asOptional()}case"primitive":return this.convertPrimitive({primitive:r.typeReference.value});case"set":return this.Collection.set(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:ue(r.typeReference)}}convertToClassReference(r,i){return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)})}convertNamed({named:r,typeId:i}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.convert({typeReference:r.typeReference});case"enum":case"object":return this.convertToClassReference(r,i);case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertToClassReference(r,i):this.Primitive.object;case"undiscriminatedUnion":return this.settings.shouldGenerateUndiscriminatedUnions?this.convertToClassReference(r,i):this.OneOf.OneOf(r.types.map(o=>this.convert({typeReference:o})));default:ue(r)}}convertLiteral({literal:r}){switch(r.type){case"boolean":return this.Primitive.boolean;case"string":return this.Primitive.string}}convertUnknown(){return this.Primitive.object}convertPrimitive({primitive:r}){switch(r){case"INTEGER":return this.Primitive.integer;case"UINT":return this.Primitive.uint;case"LONG":return this.Primitive.long;case"UINT_64":return this.Primitive.ulong;case"FLOAT":return this.Primitive.float;case"DOUBLE":return this.Primitive.double;case"BOOLEAN":return this.Primitive.boolean;case"STRING":return this.Primitive.string;case"DATE":return this.Value.dateOnly;case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.Value.dateTime;case"UUID":return this.Primitive.string;case"BASE_64":return this.Primitive.string;case"BIG_INTEGER":return this.Primitive.string;default:ue(r)}}};n();a();s();var Oo=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}getFilePropertyInfo({body:r,value:i}){let o={fileFields:[],bodyPropertyFields:[]},c=this.context.getRecord(i)??{};for(let l of r.properties)switch(l.type){case"file":v.Record.missingKey(c,l.wireValue)&&(c[l.wireValue]="[bytes]"),o.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getSingleFileProperty({property:l,record:c})});break;case"fileArray":v.Record.missingKey(c,l.wireValue)&&(c[l.wireValue]=["[bytes]"]),o.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getArrayFileProperty({property:l,record:c})});break;case"bodyProperty":if(v.Record.missingKey(c,l.name.wireValue))switch(l.typeReference.type){case"optional":break;case"primitive":{switch(l.typeReference.value.toLowerCase()){case"integer":{c[l.name.wireValue]=123;break}case"string":{c[l.name.wireValue]="[string]";break}case"boolean":{c[l.name.wireValue]=!0;break}case"double":{c[l.name.wireValue]=123.456;break}case"float":{c[l.name.wireValue]=123.456;break}case"long":{c[l.name.wireValue]=123456789;break}case"uint":{c[l.name.wireValue]=123;break}case"uint64":{c[l.name.wireValue]=12345;break}case"date":{c[l.name.wireValue]=new Date(2021,1,1);break}case"datetime":{c[l.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{c[l.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{c[l.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{c[l.name.wireValue]="12345678901234567890";break}}break}default:break}o.bodyPropertyFields.push({name:this.context.getPropertyName(l.name.name),value:this.getBodyProperty({property:l,record:c})});break;default:ue(l)}return o}getSingleFileProperty({property:r,record:i}){let o=this.context.getSingleFileValue({property:r,record:i});return o==null?this.csharp.Literal.nop():this.context.getFileParameterForString(o)}getArrayFileProperty({property:r,record:i}){let o=this.context.getFileArrayValues({property:r,record:i});return o==null?this.csharp.Literal.nop():this.csharp.Literal.list({valueType:this.Types.FileParameter,values:o.map(c=>this.context.getFileParameterForString(c))})}getBodyProperty({property:r,record:i}){let o=i[r.name.wireValue];return o==null?this.csharp.Literal.nop():this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:o})}};var Po=class e extends en{constructor({ir:r,config:i,options:o,generation:c}){super({ir:r,config:i,options:o});y(this,"ir");y(this,"dynamicTypeMapper");y(this,"dynamicLiteralMapper");y(this,"filePropertyMapper");y(this,"generation");this.ir=r,this.generation=c??new jn(r,i.workspaceName,i.customConfig!=null?i.customConfig:{},i),this.dynamicTypeMapper=new Ro({context:this}),this.dynamicLiteralMapper=new No({context:this}),this.filePropertyMapper=new Oo({context:this})}get namespaces(){return this.generation.namespaces}get registry(){return this.generation.registry}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get csharp(){return this.generation.csharp}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}clone(){return new e({ir:this.ir,config:this.config,options:this.options,generation:this.generation})}getFileParameterForString(r){return this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.FileParameter,arguments_:[],properties:[{name:"Stream",value:this.getMemoryStreamForString(r)}],multiline:!0}))}getMemoryStreamForString(r){return this.System.IO.MemoryStream.new({arguments_:[this.csharp.invokeMethod({on:this.System.Text.Encoding_UTF8,method:"GetBytes",arguments_:[this.csharp.Literal.string(r)]})]})}getClassName(r){return r.pascalCase.safeName}getParameterName(r){return r.camelCase.safeName}getPropertyName(r){return r.pascalCase.safeName}resolvePropertyName(r,i){let o=i.pascalCase.safeName,c=r.scope.getRedirectedFieldName(o);return c||(r.scope.isField(o)?o:r.registerField(o))}getMethodName(r){return`${r.pascalCase.safeName}Async`}getNamespace(r,i){let o=this.getNamespaceSegments(r);return o=i!=null?[...o,i]:o,[this.namespaces.root,...o].join(".")}getEnvironmentTypeReferenceFromID(r){let i=this.resolveEnvironmentName(r);if(i!=null)return this.getEnvironmentClassReferenceForEnumName(i)}getEnvironmentClassReferenceForEnumName(r){return this.csharp.classReference({name:`${this.generation.Types.Environments.name}.${this.getClassName(r)}`,namespace:this.namespaces.root})}getNamespaceSegments(r){return(this.settings.explicitNamespaces?r.allParts:r.packagePath).map(o=>o.pascalCase.safeName)}precalculate(r){this.generation.initialize(),this.System.Collections.Generic.KeyValuePair(),this.System.Collections.Generic.IEnumerable(),this.System.Collections.Generic.IAsyncEnumerable(),this.System.Collections.Generic.HashSet(),this.System.Collections.Generic.List(),this.System.Collections.Generic.Dictionary(),this.System.Threading.Tasks.Task(),Object.entries(this.ir.types).sort((i,o)=>i[0].length-o[0].length).forEach(([i,o])=>{this.dynamicTypeMapper.convertToClassReference(o,i)});for(let[i,o]of r.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${i}`),namespace:"Usage"}),o.endpoint){let c=this.resolveEndpointLocation(o.endpoint);for(let l of c)switch(l.request.type){case"inlined":this.csharp.classReference({origin:l.request.declaration.name,namespace:this.getNamespace(l.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClientForSnippets,this.csharp.freezeClassReferences()}};n();a();s();var rd="request",Co=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}async generateSnippet({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}generateSnippetSync({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}async generateSnippetAst({endpoint:r,request:i,options:o}){throw new Error("Unsupported")}buildCodeBlock({endpoint:r,snippet:i,options:o}){if(r.examples&&v.DynamicIR.EndpointExample(i)&&!r.examples.find(b=>b.id===i.id))throw new Error("Endpoint does not have an example that matches the snippet");let c=this.csharp.codeblock(b=>{b.writeNodeStatement(this.constructClient({endpoint:r,snippet:i})),b.newLine(),b.writeNodeStatement(this.callMethod({endpoint:r,snippet:i}))}),l=this.getStyle(o);switch(l){case Qt.Concise:return c;case Qt.Full:return this.buildFullCodeBlock({body:c,options:o});default:ue(l)}}buildFullCodeBlock({body:r,options:i}){let o=this.getConfig(i),c=o.fullStyleMethodName??o.fullStyleClassName??"Example",l=this.csharp.class_({name:"Examples",namespace:"Examples",partial:!0,skipNamespaceDeclaration:!0,access:Ri.Access.Public});return l.addNamespaceReference(this.Types.RootClientForSnippets.namespace),l.addMethod({name:c,access:Ri.Access.Public,isAsync:!0,parameters:[],body:r}),l}constructClient({endpoint:r,snippet:i}){return this.csharp.codeblock(o=>{o.write("var client = "),o.writeNode(this.getRootClientConstructorInvocation(this.getConstructorArgs({endpoint:r,snippet:i})))})}callMethod({endpoint:r,snippet:i}){let o=r.response?.type==="streaming"||r.response?.type==="streamParameter",c=this.csharp.invokeMethod({on:this.csharp.codeblock("client"),method:this.getMethod({endpoint:r}),arguments_:this.getMethodArgs({endpoint:r,snippet:i}),async:!0,configureAwait:!0,multiline:!0,isAsyncEnumerable:o});return o?this.csharp.codeblock(l=>{l.write("await foreach (var item in "),l.writeNode(c),l.writeLine(")"),l.pushScope(),l.writeLine("/* consume each item */"),l.popScope()}):c}getConstructorArgs({endpoint:r,snippet:i}){let o=[];r.auth!=null&&(i.auth!=null?o.push(...this.getConstructorAuthArgs({auth:r.auth,values:i.auth})):this.context.errors.add({severity:te.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let c=[],l=this.getConstructorBaseUrlArgs({baseUrl:i.baseURL,environment:i.environment});l.length>0&&c.push(...l),this.context.errors.scope(tt.Headers);let b=[];if(this.context.ir.headers!=null&&i.headers!=null&&b.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:i.headers})),this.context.errors.unscope(),this.settings.unifiedClientOptions){let w=[...o.map(A=>({name:Le(A.name),assignment:A.assignment})),...b.map(A=>({name:Le(A.name),assignment:A.assignment})),...c.map(A=>({name:A.name,assignment:A.assignment}))];return w.length===0?[]:[{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:w,multiline:!0})}]}return c.length===0?[...o,...b]:[...o,...b,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:c.map(w=>({name:w.name,assignment:w.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:r,environment:i}){let o=this.getBaseUrlArg({baseUrl:r,environment:i});return v.Literal.nop(o)?[]:[{name:this.getBaseUrlOptionName(),assignment:o}]}getBaseUrlArg({baseUrl:r,environment:i}){if(r!=null&&i!=null)return this.context.errors.add({severity:te.Critical,message:"Cannot specify both baseUrl and environment options"}),this.csharp.Literal.nop();if(r!=null)return this.context.ir.environments?.environments.type==="multipleBaseUrls"?(this.context.errors.add({severity:te.Critical,message:"The C# SDK doesn't support a baseUrl when multiple URL environments are configured"}),this.csharp.Literal.nop()):this.csharp.Literal.string(r);if(i!=null){if(this.context.isSingleEnvironmentID(i)){let o=this.context.getEnvironmentTypeReferenceFromID(i);return o==null?(this.context.errors.add({severity:te.Warning,message:`Environment ${JSON.stringify(i)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(o)}if(this.context.isMultiEnvironmentValues(i))return this.context.validateMultiEnvironmentUrlValues(i)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(i).map(([o,c])=>({name:Le(lr(o)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:c})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:r,values:i}){if(i.type!==r.type)return this.addError(this.context.newAuthMismatchError({auth:r,values:i}).message),[];switch(r.type){case"basic":return i.type==="basic"?this.getConstructorBasicAuthArg({auth:r,values:i}):[];case"bearer":return i.type==="bearer"?this.getConstructorBearerAuthArgs({auth:r,values:i}):[];case"header":return i.type==="header"?this.getConstructorHeaderAuthArgs({auth:r,values:i}):[];case"oauth":return i.type==="oauth"?this.getConstructorOAuthArgs({auth:r,values:i}):[];case"inferred":return i.type==="inferred"?this.getConstructorInferredAuthArgs({auth:r,values:i}):[];default:ue(r)}}addError(r){this.context.errors.add({severity:te.Critical,message:r})}addWarning(r){this.context.errors.add({severity:te.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:i}){let o=r,c=!!o.usernameOmit,l=!!o.passwordOmit,b=[];return c||b.push({name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(i.username)}),l||b.push({name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(i.password)}),b}getConstructorBearerAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.token),assignment:this.csharp.Literal.string(i.token)}]}getConstructorHeaderAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.header.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:r.header.typeReference,value:i.value,fallbackToDefault:r.header.name.wireValue})}]}getConstructorOAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.clientId),assignment:this.csharp.Literal.string(i.clientId)},{name:this.context.getParameterName(r.clientSecret),assignment:this.csharp.Literal.string(i.clientSecret)}]}getConstructorInferredAuthArgs({auth:r,values:i}){let o=[];if(r.parameters!=null)for(let c of r.parameters){let l=c.name.wireValue,b=i.values?.[l];o.push({name:this.context.getParameterName(c.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:c.typeReference,value:b,fallbackToDefault:l})})}else this.context.errors.add({severity:te.Critical,message:"Inferred auth parameters are not defined in the IR. Please ensure you're using IR version 62.3.0 or later."});return o}getConstructorHeaderArgs({headers:r,values:i}){let o=[];for(let c of r){let l=i[c.name.wireValue],b=this.getConstructorHeaderArg({header:c,value:l});b!=null&&o.push({name:this.context.getParameterName(c.name.name),assignment:b})}return o}getConstructorHeaderArg({header:r,value:i}){let o=this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:i,fallbackToDefault:r.name.wireValue});if(!v.Literal.nop(o))return o}getMethodArgs({endpoint:r,snippet:i}){switch(r.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:r.request,snippet:i});case"body":return this.getMethodArgsForBodyRequest({request:r.request,snippet:i});default:ue(r.request)}}getMethodArgsForInlinedRequest({request:r,snippet:i}){this.context.errors.scope(tt.PathParameters);let o=[...this.context.ir.pathParameters??[],...r.pathParameters??[]],c=this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters}),l=c?this.getPathParameters({namedParameters:o,snippet:i}):[],b=c?[]:this.getPathParameterArguments({namedParameters:o,snippet:i});this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let w=this.getFilePropertyInfo({request:r,snippet:i});this.context.errors.unscope();let A=this.getInlinedRequestArg({request:r,snippet:i,pathParameterFields:l,filePropertyInfo:w});return b.length>0?[...b.map(I=>this.namedArgument({name:I.name,value:I.value})),this.namedArgument({name:rd,value:A})]:[A]}getFilePropertyInfo({request:r,snippet:i}){return r.body==null||!this.context.isFileUploadRequestBody(r.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:r.body,value:i.requestBody})}getInlinedRequestArg({request:r,snippet:i,pathParameterFields:o,filePropertyInfo:c}){let l=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)});this.context.errors.scope(tt.QueryParameters);let w=this.context.associateQueryParametersByWireValue({parameters:r.queryParameters??[],values:i.queryParameters??{}}).map(L=>({name:this.context.resolvePropertyName(l,L.name.name),value:this.context.dynamicLiteralMapper.convert(L)}));this.context.errors.unscope(),this.context.errors.scope(tt.Headers);let I=this.context.associateByWireValue({parameters:r.headers??[],values:i.headers??{}}).map(L=>({name:this.context.resolvePropertyName(l,L.name.name),value:this.context.dynamicLiteralMapper.convert({...L,fallbackToDefault:L.name.wireValue})}));this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let P=r.body!=null?this.getInlinedRequestBodyConstructorFields({body:r.body,value:i.requestBody,filePropertyInfo:c,classReference:l}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:l,fields:[...o,...w,...I,...P]})}getInlinedRequestBodyConstructorFields({body:r,value:i,filePropertyInfo:o,classReference:c}){switch(r.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:r.value,value:i,classReference:c});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:c})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:o});default:ue(r)}}getInlinedRequestBodyPropertyConstructorFields({parameters:r,value:i,classReference:o}){let c=[],l=this.context.associateByWireValue({parameters:r,values:this.context.getRecord(i)??{}});for(let b of l)c.push({name:this.context.resolvePropertyName(o,b.name.name),value:this.context.dynamicLiteralMapper.convert({...b,fallbackToDefault:b.name.wireValue})});return c}getFileUploadRequestBodyConstructorFields({filePropertyInfo:r}){return[...r.fileFields,...r.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:o}){return{name:this.context.resolvePropertyName(o,r.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:r.bodyType,value:i})}}getReferencedRequestBodyPropertyLiteral({body:r,value:i}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:i});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:i,fallbackToDefault:JSON.stringify(r.value)});default:ue(r)}}getMethodArgsForBodyRequest({request:r,snippet:i}){this.context.errors.scope(tt.PathParameters);let o=[...this.context.ir.pathParameters??[],...r.pathParameters??[]],c=this.getPathParameterArguments({namedParameters:o,snippet:i});this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let l=r.body!=null?this.getBodyRequestArg({body:r.body,value:i.requestBody}):void 0;if(this.context.errors.unscope(),c.length>0&&l!=null)return[...c.map(w=>this.namedArgument({name:w.name,value:w.value})),this.namedArgument({name:rd,value:l})];let b=c.map(w=>w.value);return l!=null&&b.push(l),b}getPathParameterArguments({namedParameters:r,snippet:i}){return this.context.associateByWireValueOrDefault({parameters:r,values:i.pathParameters??{}}).map(c=>({name:this.context.getParameterName(c.name.name),value:this.context.dynamicLiteralMapper.convert({...c,fallbackToDefault:c.name.wireValue,forceLiteral:!0})}))}namedArgument({name:r,value:i}){return this.csharp.codeblock(o=>{o.write(`${r}: `),o.writeNode(i)})}getBodyRequestArg({body:r,value:i}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:i});case"typeReference":return r.value.type==="optional"&&i==null?this.csharp.Literal.null():this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:i,fallbackToDefault:JSON.stringify(r.value)});default:ue(r)}}getBytesBodyRequestArg({value:r}){let i=this.context.getValueAsString({value:r});return i==null&&(this.context.errors.add({severity:te.Critical,message:"The bytes request body must be provided in string format"}),i="[bytes]"),this.csharp.Literal.reference(this.context.getMemoryStreamForString(i))}getRootClientConstructorInvocation(r){return this.csharp.instantiateClass({classReference:this.Types.RootClientForSnippets,arguments_:r,forceUseConstructor:!0,multiline:!0})}getPathParameters({namedParameters:r,snippet:i}){let o=[],c=this.context.associateByWireValueOrDefault({parameters:r,values:i.pathParameters??{}});for(let l of c)o.push({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicLiteralMapper.convert({...l,fallbackToDefault:l.name.wireValue})});return o}getMethod({endpoint:r}){return r.declaration.fernFilepath.allParts.length>0?`${r.declaration.fernFilepath.allParts.map(i=>this.context.getClassName(i)).join(".")}.${this.context.getMethodName(r.declaration.name)}`:this.context.getMethodName(r.declaration.name)}getBaseUrlOptionName(){return this.context.ir.environments?.environments.type==="multipleBaseUrls"?"Environment":"BaseUrl"}getStyle(r){return r.style??this.context.options.style??Qt.Full}getConfig(r){return r.config??this.context.options.config??{}}};var nc=class extends Yi{constructor({ir:t,config:r,options:i={}}){super(new Po({ir:t,config:r,options:i}))}precalculate(t){this.context.precalculate(t)}async generate(t,r={}){return super.generate(t,r)}generateSync(t,r={}){return super.generateSync(t,r)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new Co({context:t})}};export{nc as DynamicSnippetsGenerator,Sd as buildSnippetTestGeneratorConfig};
34
34
  /*! Bundled license information:
35
35
 
36
36
  @jspm/core/nodelibs/browser/chunk-DtuTasat.js: