@fern-api/csharp-dynamic-snippets 2.59.1 → 2.59.3
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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ ${ii(this).map(r=>` ${r.fn} - ${r.path}:${r.position}`).join(`
|
|
|
30
30
|
`),r.writeTextStatement("set"),r.writeNoIndent(`#endif
|
|
31
31
|
`)):(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?C.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 je;(function(e){e[e.INSTANCE=0]="INSTANCE",e[e.STATIC=1]="STATIC"})(je||(je={}));var mt=class e extends Xe{constructor({name:r,isAsync:i,override:o,access:c,return_:d,body:y,noBody:g,bodyType:x,summary:S,doc:A,type:O,classReference:w,parameters:V,typeParameters:G,annotations:U,codeExample:z,interfaceReference:ie,origin:de,enclosingType:X},te){super({enclosingType:X},de,te);m(this,"name");m(this,"isAsync");m(this,"access");m(this,"return");m(this,"noBody");m(this,"body");m(this,"bodyType");m(this,"summary");m(this,"doc");m(this,"type");m(this,"reference");m(this,"override");m(this,"parameters");m(this,"typeParameters");m(this,"annotations");m(this,"interfaceReference");this.name=r,this.isAsync=i??!1,this.override=o??!1,this.access=c,this.return=d,this.noBody=g??!1,this.body=y,this.bodyType=x??e.BodyType.Statement,this.summary=S,this.doc=this.csharp.xmlDocBlockOf(A??{summary:S,codeExample:z}),this.type=O??je.INSTANCE,this.reference=w,this.parameters=V??[],this.typeParameters=G??[],this.annotations=(U??[]).map(I=>I instanceof ge?this.csharp.annotation({reference:I}):I),this.interfaceReference=ie}get isAsyncEnumerable(){return C.AsyncEnumerable(this.return)}addParameter(r){return r instanceof Le||(r=new Le(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===je.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:Q(this.bodyType)}}getParameters(){return this.parameters}};(function(e){e.BodyType={Statement:"statement",Expression:"expression"}})(mt||(mt={}));var Sr=class extends Te{constructor({name:r,namespace:i,access:o,partial:c,interfaceReferences:d,enclosingType:y,origin:g},x){super(g,x);m(this,"access");m(this,"partial");m(this,"reference");m(this,"interfaceReferences");m(this,"fields",[]);m(this,"methods",[]);r=r||(g?this.model.getClassNameFor(g):re("Class/Interface name or origin is required")),this.reference=y?this.csharp.classReference({name:r,enclosingType:y}):this.csharp.classReference({name:r,namespace:i||re("Class/Interface: Namespace or enclosingType is required ")}),this.access=o,this.partial=c??!1,this.interfaceReferences=d??[]}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(C.Provenance(this.origin)?this.origin.node:this.origin,r):re(`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 xr(r,this.generation);return this.fields.push(i),i}addMethod(r){r.enclosingType=this.reference;let i=new mt(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 Re(this,this.generation)}asNullable(){return new Pt(this,this.generation)}asNonOptional(){return this}get defaultValue(){return this.csharp.Literal.null()}get fullyQualifiedName(){return this.reference.fullyQualifiedName}};var we=class we extends Sr{constructor({name:r,namespace:i,access:o,static_:c,abstract_:d,sealed:y,partial:g,readonly:x,parentClassReference:S,interfaceReferences:A,enclosingType:O,type:w,summary:V,doc:G,annotations:U,primaryConstructor:z,origin:ie},de){super({name:r,namespace:i,access:o,partial:g,interfaceReferences:A,enclosingType:O,origin:ie},de);m(this,"static_");m(this,"abstract_");m(this,"sealed");m(this,"readonly");m(this,"parentClassReference");m(this,"type");m(this,"summary");m(this,"doc");m(this,"annotations",[]);m(this,"primaryConstructor");m(this,"namespaceReferences",[]);m(this,"constructors",[]);m(this,"operators",[]);m(this,"nestedClasses",[]);m(this,"nestedInterfaces",[]);m(this,"rawBodyBlocks",[]);this.static_=c??!1,this.abstract_=d??!1,this.sealed=y??!1,this.readonly=x??!1,this.type=w??we.ClassType.Class,this.summary=V,this.doc=this.csharp.xmlDocBlockOf(G??{summary:V}),this.parentClassReference=S,this.annotations=(U??[]).map(X=>X instanceof ge?this.csharp.annotation({reference:X}):X),this.primaryConstructor=z}addConstructor(r){let i=new we.Constructor(r,this.generation);return this.constructors.push(i),i}addNestedClass(r){if(r instanceof we||(r.enclosingType=this.reference,r=new we(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 we?this.addNestedClass(i):this.addNestedClass(i)})}addAnnotation(r){return r instanceof Je||(r=new Je(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||(r.writeLine(`namespace ${this.namespace};`),r.newLine()),r.writeNode(this.doc),this.annotations.forEach(i=>{i.write(r)}),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(),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.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(Tr).sort(Eo).filter(this.fieldConstFilter())})}writeFieldFields(r){this.writeFields({writer:r,fields:this.getFields().sort(Tr).sort(Eo).filter(this.fieldFieldFilter())})}writeProperties(r){this.writeFields({writer:r,fields:this.getFields().sort(Tr).sort(Eo).filter(this.fieldPropertyFilter())})}writeMethods(r){this.methods.sort(Tr).sort(md).sort(fd).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(Tr).forEach((i,o)=>{i.write(r),r.writeNewLineIfLastLineNot(),o<this.fields.length-1&&r.newLine()})}writeNestedInterfaces(r){this.nestedInterfaces.sort(Tr).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===we.ClassType.Class||this.type===we.ClassType.Record}writeOperator({writer:r,operator:i}){if(r.write("public static "),i.type===we.CastOperator.Type.Explicit||i.type===we.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,d)=>{c.write(r),d<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)}};m(we,"ClassType",{Class:"class",Record:"record",Struct:"struct",RecordStruct:"record struct"}),m(we,"Access",ne);var Ve=we;(function(e){class t{constructor({doc:o,body:c,parameters:d,access:y,baseConstructorCall:g,annotations:x},S){m(this,"generation");m(this,"doc");m(this,"body");m(this,"parameters");m(this,"access");m(this,"baseConstructorCall");m(this,"annotations");this.generation=S,this.parameters=d??[],this.access=y??ne.Public,this.doc=o,this.annotations=x??[],this.body=new ct({},this.generation),c!=null&&this.body.append(c),this.baseConstructorCall=g}addParameter(o){let c=new Le(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={}))})(Ve||(Ve={}));function Xc(e){switch(e){case void 0:return 0;case ne.Private:return 1;case ne.Protected:return 2;case ne.Internal:return 3;case ne.Public:return 4}}function Tr(e,t){return Xc(e.access)-Xc(t.access)}function Eo(e,t){return e.isStatic===t.isStatic?0:e.isStatic?-1:1}function fd(e,t){return e.type===je.STATIC&&t.type!==je.STATIC?-1:e.type!==je.STATIC&&t.type===je.STATIC?1:0}function md(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();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var dd="__package__",ZC=`${dd}.yml`;var Zc="default-group",ep="spec-origin",tp="async-api",rp="openapi",ip="openapi-overrides",np="api-settings";var sp="local";var _e={};F(_e,{API_ORIGIN_LOCATION_KEY:()=>ep,API_SETTINGS_KEY:()=>np,ASYNC_API_LOCATION_KEY:()=>tp,CoerceConstsTo:()=>xp,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>Zc,DEFAULT_GROUP_NAME:()=>sp,DefaultIntegerFormat:()=>Sp,ExampleStyle:()=>Tp,FormParameterEncoding:()=>Ap,GenerationLanguage:()=>ap,GithubCommitAndReleaseMode:()=>Op,GithubLicenseType:()=>Cp,GithubSelfhostedMode:()=>Pp,Language:()=>Ip,MessageNamingSettingsSchema:()=>Ep,ModelProvider:()=>cp,OPENAPI_LOCATION_KEY:()=>rp,OPENAPI_OVERRIDES_LOCATION_KEY:()=>ip,PathParameterOrder:()=>wp,RemoveDiscriminantsFromSchemas:()=>Np,UnionSettingsSchema:()=>Rp,ai:()=>wo,fernDefinition:()=>Ro,generators:()=>Oo,getPackageName:()=>op,group:()=>Po,isApiConfigurationV2Schema:()=>ol,isAsyncApiSpecSchema:()=>ul,isConjureSchema:()=>cl,isGraphQLSpecSchema:()=>pl,isNamespacedApiConfiguration:()=>ll,isOpenApiSpecSchema:()=>fl,isOpenRpcSpecSchema:()=>ml,isProtoSpecSchema:()=>dl,isRawProtobufAPIDefinitionSchema:()=>up,license:()=>Co,replay:()=>_p,reviewers:()=>kp,serialization:()=>Xo});n();a();s();n();a();s();var ap={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function op({generatorInvocation:e}){return e.language==="go"?hd(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 hd(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 up(e){return typeof e!="string"&&"proto"in e}n();a();s();n();a();s();var wo={};F(wo,{ModelProvider:()=>cp});n();a();s();n();a();s();var cp={Openai:"openai",Anthropic:"anthropic",Bedrock:"bedrock"};var Ro={};F(Ro,{AvailabilityStatusSchema:()=>lp,auth:()=>pp,availability:()=>No,commons:()=>fp,encoding:()=>mp,environments:()=>dp,file:()=>hp,service:()=>yp,types:()=>gp,validation:()=>bp});n();a();s();n();a();s();var pp={};n();a();s();var No={};F(No,{AvailabilityStatusSchema:()=>lp});n();a();s();n();a();s();var lp={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var fp={};n();a();s();var mp={};n();a();s();var dp={};n();a();s();var hp={};n();a();s();var yp={};n();a();s();var gp={};n();a();s();var bp={};n();a();s();var Oo={};F(Oo,{CoerceConstsTo:()=>xp,DefaultIntegerFormat:()=>Sp,ExampleStyle:()=>Tp,FormParameterEncoding:()=>Ap,Language:()=>Ip,MessageNamingSettingsSchema:()=>Ep,PathParameterOrder:()=>wp,RemoveDiscriminantsFromSchemas:()=>Np,UnionSettingsSchema:()=>Rp});n();a();s();n();a();s();var xp={Literals:"literals",Enums:"enums",EnumsCoerceableToLiterals:"enums-coerceable-to-literals"};n();a();s();var Sp={Int32:"int32",Int64:"int64",Uint32:"uint32",Uint64:"uint64"};n();a();s();var Tp={Minimal:"minimal",Comprehensive:"comprehensive"};n();a();s();var Ap={Form:"form",Json:"json"};n();a();s();var Ip={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};n();a();s();var Ep={V1:"v1",V2:"v2"};n();a();s();var wp={UrlOrder:"url-order",SpecOrder:"spec-order"};n();a();s();var Np={Always:"always",Never:"never"};n();a();s();var Rp={V1:"v1"};var Po={};F(Po,{GithubCommitAndReleaseMode:()=>Op,GithubSelfhostedMode:()=>Pp});n();a();s();n();a();s();var Op={Commit:"commit",Release:"release"};n();a();s();var Pp={PullRequest:"pull-request",Push:"push"};var Co={};F(Co,{GithubLicenseType:()=>Cp});n();a();s();n();a();s();var Cp={Mit:"MIT",Apache:"Apache-2.0"};var _p={};n();a();s();var kp={};n();a();s();var Xo={};F(Xo,{AiServicesSchema:()=>Fn,ApiConfigurationSchema:()=>Bs,ApiConfigurationSchemaInternal:()=>Br,ApiConfigurationV2Schema:()=>Ds,ApiConfigurationV2SettingsSchema:()=>vr,ApiConfigurationV2SpecsSchema:()=>zr,ApiDefinitionList:()=>Ts,ApiDefinitionPathSchema:()=>gt,ApiDefinitionSchema:()=>Ss,ApiDefinitionSettingsSchema:()=>Lr,ApiDefinitionWithOverridesSchema:()=>jr,AsyncApiSettingsSchema:()=>Vr,AsyncApiSpecSchema:()=>Cs,BaseApiSettingsSchema:()=>Mr,BaseGeneratorInvocationSchema:()=>qr,CoerceConstsTo:()=>As,ConjureSchema:()=>Ps,CratesOutputLocationSchema:()=>qs,CustomGeneratorInvocationSchema:()=>pa,DefaultGeneratorInvocationSchema:()=>la,DefaultIntegerFormat:()=>Is,ExampleStyle:()=>Ms,FormParameterEncoding:()=>Es,GeneratorApiSettingsSchema:()=>zs,GeneratorGroupSchema:()=>ma,GeneratorImageObjectSchema:()=>Vs,GeneratorInvocationSchema:()=>fa,GeneratorOutputSchema:()=>Zs,GeneratorPublishMetadataSchema:()=>Ji,GeneratorSnippetsSchema:()=>ra,GeneratorsConfigurationSchema:()=>al,GeneratorsOpenApiObjectSchema:()=>ha,GeneratorsOpenApiSchema:()=>ya,GithubCommitAndReleaseMode:()=>ia,GithubCommitAndReleaseSchema:()=>na,GithubConfigurationSchema:()=>ca,GithubLicenseCustomSchema:()=>ea,GithubLicenseSchema:()=>Ce,GithubLicenseType:()=>ta,GithubPullRequestSchema:()=>sa,GithubPushSchema:()=>aa,GithubSelfhostedMode:()=>oa,GithubSelfhostedSchema:()=>ua,GraphQlSpecSchema:()=>_s,Language:()=>ga,LocalFileSystemOutputLocationSchema:()=>Gs,MavenOutputLocationSchema:()=>$s,MavenOutputSignatureSchema:()=>Ws,MessageNamingSettingsSchema:()=>_r,ModelName:()=>_n,ModelProvider:()=>kn,NamespacedApiConfigurationSchema:()=>Us,NpmOutputLocationSchema:()=>Hs,NugetOutputLocationSchema:()=>Js,OpenApiExampleGenerationSchema:()=>ws,OpenApiFilterSchema:()=>Ns,OpenApiSettingsSchema:()=>bt,OpenApiSpecSchema:()=>ks,OpenRpcSpecSchema:()=>Fs,OutputMetadataAuthor:()=>vs,OutputMetadataSchema:()=>xt,OverridesSchema:()=>Pe,PathParameterOrder:()=>kr,PostmanOutputLocationSchema:()=>Ks,ProtobufApiDefinitionSchema:()=>Ur,ProtobufDefinitionSchema:()=>Dr,ProtobufSpecSchema:()=>Ls,PypiOutputLocationSchema:()=>Ys,PypiOutputMetadataSchema:()=>Qs,ReadmeCustomSectionSchema:()=>ba,ReadmeEndpointObjectSchema:()=>xa,ReadmeEndpointSchema:()=>Ki,ReadmeSchema:()=>Sa,RemoveDiscriminantsFromSchemas:()=>Fr,ReplayConfigSchema:()=>da,RequestOrResponseExampleGenerationSchema:()=>$i,ResolveAliases:()=>Os,ResolveAliasesSchema:()=>Rs,ReviewerSchema:()=>Hi,ReviewersSchema:()=>St,RubyGemsOutputLocationSchema:()=>Xs,SpecSchema:()=>js,UnionSettingsSchema:()=>xs,WhitelabelConfigurationSchema:()=>Aa,WhitelabelGithubConfigurationSchema:()=>Ta,ai:()=>Do,fernDefinition:()=>$o,generators:()=>Ho,group:()=>Jo,license:()=>Ko,replay:()=>Qo,reviewers:()=>Yo});n();a();s();n();a();s();var Do={};F(Do,{AiServicesSchema:()=>Fn,ModelName:()=>_n,ModelProvider:()=>kn});n();a();s();n();a();s();n();a();s();var u={};F(u,{JsonError:()=>Ar,ParseError:()=>Ir,any:()=>$p,bigint:()=>Lp,boolean:()=>Hp,booleanLiteral:()=>Gp,date:()=>jp,discriminant:()=>il,enum_:()=>On,getObjectLikeUtils:()=>De,getObjectUtils:()=>_t,getSchemaUtils:()=>K,isProperty:()=>Qe,lazy:()=>Dp,lazyObject:()=>zp,list:()=>Cn,never:()=>Jp,number:()=>Kp,object:()=>Pn,objectWithoutOptionalProperties:()=>vp,optional:()=>_o,property:()=>Bp,record:()=>Zp,set:()=>el,string:()=>Qp,stringLiteral:()=>Wp,transform:()=>ko,undiscriminatedUnion:()=>rl,union:()=>sl,unknown:()=>Yp,withParsedProperties:()=>jo});n();a();s();n();a();s();n();a();s();n();a();s();var D={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 J(e,t){return`Expected ${t}. Received ${yd(e)}.`}function yd(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 ue(e){return{...e,json:Fp(e.json),parse:Fp(e.parse)}}function Fp(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(`
|
|
32
32
|
`)),{ok:!0,value:t}):i}}n();a();s();n();a();s();n();a();s();n();a();s();function Rn(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Ar=class e extends Error{constructor(r){super(r.map(Rn).join("; "));m(this,"errors");this.errors=r,Object.setPrototypeOf(this,e.prototype)}};n();a();s();var Ir=class e extends Error{constructor(r){super(r.map(Rn).join("; "));m(this,"errors");this.errors=r,Object.setPrototypeOf(this,e.prototype)}};function K(e){return{nullable:()=>gd(e),optional:()=>_o(e),optionalNullable:()=>bd(e),transform:t=>ko(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new Ir(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new Ar(i.errors)}}}function gd(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:()=>D.NULLABLE};return{...t,...K(t)}}function _o(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:()=>D.OPTIONAL};return{...t,...K(t)}}function bd(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:()=>D.OPTIONAL_NULLABLE};return{...t,...K(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,...K(r)}}function Lp(){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:J(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:J(t,"bigint")}]}:{ok:!0,value:t},getType:()=>D.BIGINT};return{...ue(e),...K(e)}}n();a();s();n();a();s();var xd=/^([+-]?\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 jp(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:J(t,"string")}]}:xd.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:J(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:J(t,"Date object")}]},getType:()=>D.DATE};return{...ue(e),...K(e)}}n();a();s();n();a();s();n();a();s();function ce(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...ue(r),...K(r)}}}function On(e){let t=new Set(e);return ce(D.ENUM,(i,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:c=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:c,message:J(i,"string")}]}:!t.has(i)&&!o?{ok:!1,errors:[{path:c,message:J(i,"enum")}]}:{ok:!0,value:i})()}n();a();s();n();a();s();function Dp(e){let t=Fo(e);return{...t,...K(t)}}function Fo(e){return{parse:(t,r)=>Er(e).parse(t,r),json:(t,r)=>Er(e).json(t,r),getType:()=>Er(e).getType()}}function Er(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 Lo(e){return Object.entries(e)}n();a();s();function Gi(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 Ke(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 Wi(e){return Object.keys(e)}n();a();s();function Up(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 Sd=Object.prototype.hasOwnProperty;function De(e){return{withParsedProperties:t=>jo(e,t)}}function jo(e,t){let r={parse:(i,o)=>{let c=e.parse(i,o);if(!c.ok)return c;let d={};for(let y in t)if(Sd.call(t,y)){let g=t[y];d[y]=typeof g=="function"?g(c.value):g}return{ok:!0,value:{...c.value,...d}}},json:(i,o)=>{if(!Ke(i))return{ok:!1,errors:[{path:o?.breadcrumbsPrefix??[],message:J(i,"object")}]};let c=new Set(Object.keys(t)),d=Gi(i,Object.keys(i).filter(y=>!c.has(y)));return e.json(d,o)},getType:()=>e.getType()};return{...r,...K(r),...De(r)}}n();a();s();function Bp(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Qe(e){return e.isProperty}var Td=Object.prototype.hasOwnProperty;function Pn(e){let t;function r(){if(t==null){t={};for(let[O,w]of Lo(e)){let V=Qe(w)?w.rawKey:O,G=Qe(w)?w.valueSchema:w;t[V]={rawKey:V,parsedKey:O,valueSchema:G}}}return t}let i,o,c,d;function y(){if(i==null){i=[],o=[];for(let[O,w]of Lo(e)){let V=Qe(w)?w.rawKey:O,G=Qe(w)?w.valueSchema:w;Ad(G)&&(i.push(V),o.push(O))}c=new Set(i),d=new Set(o)}return i}function g(){return o==null&&y(),o}function x(){return c==null&&y(),c}function S(){return d==null&&y(),d}let A={_getRawProperties:()=>Object.entries(e).map(([O,w])=>Qe(w)?w.rawKey:O),_getParsedProperties:()=>Wi(e),parse:(O,w)=>{let V=w?.breadcrumbsPrefix??[];return Mp({value:O,requiredKeys:y(),requiredKeysSet:x(),getProperty:G=>{let U=r()[G];if(U!=null)return{transformedKey:U.parsedKey,transform:z=>{let ie=[...V,G];return U.valueSchema.parse(z,{...w,breadcrumbsPrefix:ie})}}},unrecognizedObjectKeys:w?.unrecognizedObjectKeys,skipValidation:w?.skipValidation,breadcrumbsPrefix:V,omitUndefined:w?.omitUndefined})},json:(O,w)=>{let V=w?.breadcrumbsPrefix??[];return Mp({value:O,requiredKeys:g(),requiredKeysSet:S(),getProperty:G=>{let U=e[G];if(U!=null)return Qe(U)?{transformedKey:U.rawKey,transform:z=>{let ie=[...V,G];return U.valueSchema.json(z,{...w,breadcrumbsPrefix:ie})}}:{transformedKey:G,transform:z=>{let ie=[...V,G];return U.json(z,{...w,breadcrumbsPrefix:ie})}}},unrecognizedObjectKeys:w?.unrecognizedObjectKeys,skipValidation:w?.skipValidation,breadcrumbsPrefix:V,omitUndefined:w?.omitUndefined})},getType:()=>D.OBJECT};return{...ue(A),...K(A),...De(A),..._t(A)}}function Mp({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:i,unrecognizedObjectKeys:o="fail",skipValidation:c=!1,breadcrumbsPrefix:d=[]}){if(!Ke(e))return{ok:!1,errors:[{path:d,message:J(e,"object")}]};let y=t.length,g=[],x={};for(let S in e){if(!Td.call(e,S))continue;let A=e[S],O=i(S);if(O!=null){y>0&&r.has(S)&&y--;let w=O.transform(A);w.ok?x[O.transformedKey]=w.value:(x[S]=A,g.push(...w.errors))}else switch(o){case"fail":g.push({path:[...d,S],message:`Unexpected key "${S}"`});break;case"strip":break;case"passthrough":x[S]=A;break}}if(y>0)for(let S of t)S in e||g.push({path:d,message:`Missing required key "${S}"`});return g.length===0||c?{ok:!0,value:x}:{ok:!1,errors:g}}function _t(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,o)=>Vp({extensionKeys:t._getRawProperties(),value:i,transformBase:c=>e.parse(c,o),transformExtension:c=>t.parse(c,o),breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(i,o)=>Vp({extensionKeys:t._getParsedProperties(),value:i,transformBase:c=>e.json(c,o),transformExtension:c=>t.json(c,o),breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>D.OBJECT};return{...r,...K(r),...De(r),..._t(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),i={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(o,c)=>{let d=e.parse(o,{...c,unrecognizedObjectKeys:"passthrough"});if(!d.ok)return d;let y={};if(typeof o=="object"&&o!=null)for(let[g,x]of Object.entries(o))t.has(g)||(y[g]=x);return{ok:!0,value:{...y,...d.value}}},json:(o,c)=>{let d=e.json(o,{...c,unrecognizedObjectKeys:"passthrough"});if(!d.ok)return d;let y={};if(typeof o=="object"&&o!=null)for(let[g,x]of Object.entries(o))r.has(g)||(y[g]=x);return{ok:!0,value:{...y,...d.value}}},getType:()=>D.OBJECT};return{...i,...K(i),...De(i),..._t(i)}}}}function Vp({extensionKeys:e,value:t,transformBase:r,transformExtension:i,breadcrumbsPrefix:o=[]}){if(!Ke(t))return{ok:!1,errors:[{path:o,message:J(t,"object")}]};let c=new Set(e),[d,y]=Up(Wi(t),S=>c.has(S)),g=r(Gi(t,y)),x=i(Gi(t,d));return g.ok&&x.ok?{ok:!0,value:{...g.value,...x.value}}:{ok:!1,errors:[...g.ok?[]:g.errors,...x.ok?[]:x.errors]}}function Ad(e){return!Id(e)}function Id(e){switch(e.getType()){case D.ANY:case D.UNKNOWN:case D.OPTIONAL:case D.OPTIONAL_NULLABLE:return!0;default:return!1}}n();a();s();function vp(e){return Pn(e)}function zp(e){let t={...Fo(e),_getRawProperties:()=>Er(e)._getRawProperties(),_getParsedProperties:()=>Er(e)._getParsedProperties()};return{...t,...K(t),...De(t),..._t(t)}}n();a();s();n();a();s();function Cn(e){let t={parse:(r,i)=>qp(r,(o,c)=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${c}]`]})),json:(r,i)=>qp(r,(o,c)=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${c}]`]})),getType:()=>D.LIST};return{...ue(t),...K(t)}}function qp(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:J(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 Gp(e){return ce(D.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:J(r,`${e.toString()}`)}]})()}n();a();s();function Wp(e){return ce(D.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:J(r,`"${e}"`)}]})()}n();a();s();n();a();s();var $p=ce(D.ANY,e=>({ok:!0,value:e}));n();a();s();var Hp=ce(D.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:J(e,"boolean")}]});n();a();s();var Jp=ce(D.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));n();a();s();var Kp=ce(D.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:J(e,"number")}]});n();a();s();var Qp=ce(D.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:J(e,"string")}]});n();a();s();var Yp=ce(D.UNKNOWN,e=>({ok:!0,value:e}));n();a();s();n();a();s();var Ed=Object.prototype.hasOwnProperty;function Zp(e,t){let r={parse:(i,o)=>Xp({value:i,isKeyNumeric:e.getType()===D.NUMBER,transformKey:c=>e.parse(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${c} (key)`]}),transformValue:(c,d)=>t.parse(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${d}`]}),breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(i,o)=>Xp({value:i,isKeyNumeric:e.getType()===D.NUMBER,transformKey:c=>e.json(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${c} (key)`]}),transformValue:(c,d)=>t.json(c,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${d}`]}),breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>D.RECORD};return{...ue(r),...K(r)}}function Xp({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:o=[]}){if(!Ke(e))return{ok:!1,errors:[{path:o,message:J(e,"object")}]};let c={},d=[];for(let y in e){if(!Ed.call(e,y))continue;let g=e[y];if(g===void 0)continue;let x=y;if(t){let O=y.length>0?Number(y):NaN;Number.isNaN(O)||(x=O)}let S=r(x),A=i(g,x);S.ok&&A.ok?c[S.value]=A.value:(S.ok||d.push(...S.errors),A.ok||d.push(...A.errors))}return d.length===0?{ok:!0,value:c}:{ok:!1,errors:d}}n();a();s();n();a();s();function el(e){let t=Cn(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:J(i,"Set")}]},getType:()=>D.SET};return{...ue(r),...K(r)}}n();a();s();n();a();s();function rl(e){let t={parse:(r,i)=>tl((o,c)=>o.parse(r,c),e,i),json:(r,i)=>tl((o,c)=>o.json(r,c),e,i),getType:()=>D.UNDISCRIMINATED_UNION};return{...ue(t),...K(t)}}function tl(e,t,r){let i=[];for(let[o,c]of t.entries()){let d=e(c,{...r,skipValidation:!1});if(d.ok)return d;for(let y of d.errors)i.push({path:y.path,message:`[Variant ${o}] ${y.message}`})}return{ok:!1,errors:i}}n();a();s();n();a();s();function il(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}n();a();s();var wd=Object.prototype.hasOwnProperty;function sl(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,o=On(Wi(t)),c={parse:(d,y)=>nl({value:d,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:g=>o.parse(g,{allowUnrecognizedEnumValues:y?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...y?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:g=>t[g],allowUnrecognizedUnionMembers:y?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(g,x)=>x.parse(g,y),breadcrumbsPrefix:y?.breadcrumbsPrefix}),json:(d,y)=>nl({value:d,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:g=>o.json(g,{allowUnrecognizedEnumValues:y?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...y?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:g=>t[g],allowUnrecognizedUnionMembers:y?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(g,x)=>x.json(g,y),breadcrumbsPrefix:y?.breadcrumbsPrefix}),getType:()=>D.UNION};return{...ue(c),...K(c),...De(c)}}function nl({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:c=!1,transformAdditionalProperties:d,breadcrumbsPrefix:y=[]}){if(!Ke(e))return{ok:!1,errors:[{path:y,message:J(e,"object")}]};let g=e[t],x={};for(let w in e)wd.call(e,w)&&w!==t&&(x[w]=e[w]);if(g==null)return{ok:!1,errors:[{path:y,message:`Missing discriminant ("${t}")`}]};let S=i(g);if(!S.ok)return{ok:!1,errors:S.errors};let A=o(S.value);if(A==null)return c?{ok:!0,value:{[r]:S.value,...x}}:{ok:!1,errors:[{path:[...y,t],message:"Unexpected discriminant value"}]};let O=d(x,A);return O.ok?{ok:!0,value:{[r]:g,...O.value}}:O}n();a();s();var _n=u.string();n();a();s();var kn=u.enum_(["openai","anthropic","bedrock"]);var Fn=u.object({provider:kn,model:_n});var $o={};F($o,{AnyAuthItem:()=>Ln,AnyAuthSchemesSchema:()=>jn,ApiAuthSchema:()=>Nr,AuthSchemeDeclarationSchema:()=>ht,AuthSchemeReferenceSchema:()=>wr,AuthScope:()=>$n,AuthVariable:()=>kt,AvailabilitySchema:()=>es,AvailabilityStatusSchema:()=>Or,AvailabilityUnionSchema:()=>ts,BaseTypeReferenceSchema:()=>ds,BasicAuthSchemeSchema:()=>Bn,BearerAuthSchemeSchema:()=>Gn,EncodingSchema:()=>ns,EndpointSecuritySchema:()=>Un,EndpointSecuritySchemaDetails:()=>Dn,EnvironmentSchema:()=>os,HeaderAuthSchemeSchema:()=>Wn,HttpHeaderSchema:()=>Cr,InferredAuthenticatedRequestHeader:()=>Mn,InferredBearerAuthSchema:()=>zn,InferredGetTokenEndpointSchema:()=>vn,InferredGetTokenEndpointSchemaObject:()=>Vn,ListValidationSchema:()=>cs,MapValidationSchema:()=>ps,MultipleBaseUrlsEnvironmentSchema:()=>ss,NumberValidationSchema:()=>ls,OAuthAccessTokenRequestPropertiesSchema:()=>Hn,OAuthAccessTokenResponsePropertiesSchema:()=>Jn,OAuthGetTokenEndpointSchema:()=>Kn,OAuthRefreshTokenEndpointSchema:()=>Xn,OAuthRefreshTokenRequestPropertiesSchema:()=>Qn,OAuthRefreshTokenResponsePropertiesSchema:()=>Yn,OAuthSchemeSchema:()=>Zn,ProtobufTypeSchema:()=>is,ServerVariableSchema:()=>Pr,SingleBaseUrlEnvironmentSchema:()=>as,StringValidationSchema:()=>fs,TokenBearerAuthSchema:()=>qn,TypeReferenceDeclarationWithEnvOverride:()=>gs,TypeReferenceDeclarationWithEnvOverrideSchema:()=>ys,TypeReferenceDeclarationWithName:()=>hs,ValidationSchema:()=>ms,WithAudiences:()=>yt,WithAvailability:()=>rs,WithDocsSchema:()=>ee,WithEnvironmentVariable:()=>Rr,WithEnvironmentsSchema:()=>us,WithHeadersSchema:()=>bs,WithName:()=>dt,auth:()=>Uo,availability:()=>Bo,commons:()=>Mo,encoding:()=>Vo,environments:()=>vo,file:()=>zo,service:()=>qo,types:()=>Go,validation:()=>Wo});n();a();s();n();a();s();var Uo={};F(Uo,{AnyAuthItem:()=>Ln,AnyAuthSchemesSchema:()=>jn,ApiAuthSchema:()=>Nr,AuthSchemeDeclarationSchema:()=>ht,AuthSchemeReferenceSchema:()=>wr,AuthScope:()=>$n,AuthVariable:()=>kt,BasicAuthSchemeSchema:()=>Bn,BearerAuthSchemeSchema:()=>Gn,EndpointSecuritySchema:()=>Un,EndpointSecuritySchemaDetails:()=>Dn,HeaderAuthSchemeSchema:()=>Wn,InferredAuthenticatedRequestHeader:()=>Mn,InferredBearerAuthSchema:()=>zn,InferredGetTokenEndpointSchema:()=>vn,InferredGetTokenEndpointSchemaObject:()=>Vn,OAuthAccessTokenRequestPropertiesSchema:()=>Hn,OAuthAccessTokenResponsePropertiesSchema:()=>Jn,OAuthGetTokenEndpointSchema:()=>Kn,OAuthRefreshTokenEndpointSchema:()=>Xn,OAuthRefreshTokenRequestPropertiesSchema:()=>Qn,OAuthRefreshTokenResponsePropertiesSchema:()=>Yn,OAuthSchemeSchema:()=>Zn,TokenBearerAuthSchema:()=>qn,WithEnvironmentVariable:()=>Rr});n();a();s();n();a();s();n();a();s();n();a();s();var ee=u.object({docs:u.string().optional()});var wr=u.object({scheme:u.string()}).extend(ee);var Ln=u.undiscriminatedUnion([u.string(),wr]);n();a();s();var jn=u.object({any:u.list(Ln)}).extend(ee);n();a();s();n();a();s();n();a();s();var Dn=u.object({});var Un=u.object({"endpoint-security":Dn}).extend(ee);var Nr=u.undiscriminatedUnion([u.string(),wr,jn,Un]);n();a();s();n();a();s();n();a();s();n();a();s();var dt=u.object({name:u.string().optional()});n();a();s();var Rr=u.object({env:u.string().optional()});var kt=u.object({omit:u.boolean().optional()}).extend(Rr).extend(dt);var Bn=u.object({scheme:u.stringLiteral("basic"),username:kt.optional(),password:kt.optional()}).extend(ee);n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var Mn=u.object({"response-property":u.string(),"header-name":u.string(),"value-prefix":u.string().optional()});var Vn=u.object({endpoint:u.string(),"expiry-response-property":u.string().optional(),"authenticated-request-headers":u.list(Mn).optional()});var vn=u.undiscriminatedUnion([u.string(),Vn]);var zn=u.object({scheme:u.stringLiteral("bearer"),"get-token":vn}).extend(ee);n();a();s();var qn=u.object({scheme:u.stringLiteral("bearer"),token:kt.optional()}).extend(ee);var Gn=u.undiscriminatedUnion([qn,zn]);n();a();s();var Wn=u.object({header:u.string(),type:u.string().optional(),prefix:u.string().optional()}).extend(Rr).extend(dt).extend(ee);n();a();s();n();a();s();var $n=u.string();n();a();s();n();a();s();var Hn=u.object({"client-id":u.string().optional(),"client-secret":u.string().optional(),scopes:u.string().optional()});n();a();s();var Jn=u.object({"access-token":u.string().optional(),"expires-in":u.string().optional(),"refresh-token":u.string().optional()});var Kn=u.object({endpoint:u.string(),"request-properties":Hn.optional(),"response-properties":Jn.optional()});n();a();s();n();a();s();var Qn=u.object({"refresh-token":u.string()});n();a();s();var Yn=u.object({"access-token":u.string().optional(),"expires-in":u.string().optional(),"refresh-token":u.string().optional()});var Xn=u.object({endpoint:u.string(),"request-properties":Qn.optional(),"response-properties":Yn.optional()});var Zn=u.object({scheme:u.stringLiteral("oauth"),type:u.stringLiteral("client-credentials"),scopes:u.list($n).optional(),"client-id-env":u.string().optional(),"client-secret-env":u.string().optional(),"token-prefix":u.string().optional(),"token-header":u.string().optional(),"get-token":Kn,"refresh-token":Xn.optional()}).extend(ee);var ht=u.undiscriminatedUnion([Zn,Wn,Bn,Gn]);var Bo={};F(Bo,{AvailabilitySchema:()=>es,AvailabilityStatusSchema:()=>Or,AvailabilityUnionSchema:()=>ts});n();a();s();n();a();s();n();a();s();var Or=u.enum_(["in-development","pre-release","deprecated","generally-available"]);var es=u.object({status:Or,message:u.string().optional()});n();a();s();var ts=u.undiscriminatedUnion([Or,es]);var Mo={};F(Mo,{WithAudiences:()=>yt,WithAvailability:()=>rs,WithDocsSchema:()=>ee,WithName:()=>dt});n();a();s();n();a();s();var yt=u.object({audiences:u.list(u.string()).optional()});n();a();s();var rs=u.object({availability:ts.optional()});var Vo={};F(Vo,{EncodingSchema:()=>ns,ProtobufTypeSchema:()=>is});n();a();s();n();a();s();n();a();s();var is=u.object({type:u.string()});var ns=u.object({proto:is.optional()});var vo={};F(vo,{EnvironmentSchema:()=>os,MultipleBaseUrlsEnvironmentSchema:()=>ss,ServerVariableSchema:()=>Pr,SingleBaseUrlEnvironmentSchema:()=>as,WithEnvironmentsSchema:()=>us});n();a();s();n();a();s();n();a();s();n();a();s();var Pr=u.object({id:u.string(),default:u.string().optional(),values:u.list(u.string()).optional()});var ss=u.object({urls:u.record(u.string(),u.string()),"url-templates":u.record(u.string(),u.string()).optional(),"default-urls":u.record(u.string(),u.string()).optional(),variables:u.record(u.string(),u.list(Pr)).optional()}).extend(yt).extend(ee);n();a();s();var as=u.object({url:u.string(),"default-url":u.string().optional(),"url-template":u.string().optional(),variables:u.list(Pr).optional()}).extend(yt).extend(ee);var os=u.undiscriminatedUnion([u.string(),as,ss]);n();a();s();var us=u.object({"default-url":u.string().optional(),"default-environment":u.string().optional(),environments:u.record(u.string(),os).optional()});var zo={};F(zo,{WithHeadersSchema:()=>bs});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 cs=u.object({minItems:u.number().optional(),maxItems:u.number().optional()});n();a();s();var ps=u.object({minProperties:u.number().optional(),maxProperties:u.number().optional()});n();a();s();var ls=u.object({min:u.number().optional(),max:u.number().optional(),exclusiveMin:u.boolean().optional(),exclusiveMax:u.boolean().optional(),multipleOf:u.number().optional()});n();a();s();var fs=u.object({minLength:u.number().optional(),maxLength:u.number().optional(),pattern:u.string().optional(),format:u.string().optional()});var ms=u.undiscriminatedUnion([fs,ls,cs,ps]);var ds=u.object({default:u.unknown().optional(),encoding:ns.optional(),validation:ms.optional()}).extend(ee).extend(rs);var hs=u.object({type:u.string()}).extend(ds).extend(dt).extend(yt);var ys=u.object({env:u.string().optional()}).extend(hs);var gs=u.undiscriminatedUnion([u.string(),ys]);var Cr=gs;var bs=u.object({headers:u.record(u.string(),Cr).optional()});var qo={};F(qo,{HttpHeaderSchema:()=>Cr,TypeReferenceDeclarationWithEnvOverride:()=>gs,TypeReferenceDeclarationWithEnvOverrideSchema:()=>ys});n();a();s();var Go={};F(Go,{BaseTypeReferenceSchema:()=>ds,TypeReferenceDeclarationWithName:()=>hs});n();a();s();var Wo={};F(Wo,{ListValidationSchema:()=>cs,MapValidationSchema:()=>ps,NumberValidationSchema:()=>ls,StringValidationSchema:()=>fs,ValidationSchema:()=>ms});n();a();s();var Ho={};F(Ho,{ApiConfigurationSchema:()=>Bs,ApiConfigurationSchemaInternal:()=>Br,ApiConfigurationV2Schema:()=>Ds,ApiConfigurationV2SettingsSchema:()=>vr,ApiConfigurationV2SpecsSchema:()=>zr,ApiDefinitionList:()=>Ts,ApiDefinitionPathSchema:()=>gt,ApiDefinitionSchema:()=>Ss,ApiDefinitionSettingsSchema:()=>Lr,ApiDefinitionWithOverridesSchema:()=>jr,AsyncApiSettingsSchema:()=>Vr,AsyncApiSpecSchema:()=>Cs,BaseApiSettingsSchema:()=>Mr,CoerceConstsTo:()=>As,ConjureSchema:()=>Ps,DefaultIntegerFormat:()=>Is,ExampleStyle:()=>Ms,FormParameterEncoding:()=>Es,GeneratorImageObjectSchema:()=>Vs,GeneratorsConfigurationSchema:()=>al,GeneratorsOpenApiObjectSchema:()=>ha,GeneratorsOpenApiSchema:()=>ya,GraphQlSpecSchema:()=>_s,Language:()=>ga,MessageNamingSettingsSchema:()=>_r,NamespacedApiConfigurationSchema:()=>Us,OpenApiExampleGenerationSchema:()=>ws,OpenApiFilterSchema:()=>Ns,OpenApiSettingsSchema:()=>bt,OpenApiSpecSchema:()=>ks,OpenRpcSpecSchema:()=>Fs,OutputMetadataAuthor:()=>vs,OutputMetadataSchema:()=>xt,OverridesSchema:()=>Pe,PathParameterOrder:()=>kr,ProtobufApiDefinitionSchema:()=>Ur,ProtobufDefinitionSchema:()=>Dr,ProtobufSpecSchema:()=>Ls,ReadmeCustomSectionSchema:()=>ba,ReadmeEndpointObjectSchema:()=>xa,ReadmeEndpointSchema:()=>Ki,ReadmeSchema:()=>Sa,RemoveDiscriminantsFromSchemas:()=>Fr,RequestOrResponseExampleGenerationSchema:()=>$i,ResolveAliases:()=>Os,ResolveAliasesSchema:()=>Rs,SpecSchema:()=>js,UnionSettingsSchema:()=>xs,WhitelabelConfigurationSchema:()=>Aa,WhitelabelGithubConfigurationSchema:()=>Ta});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var gt=u.string();n();a();s();n();a();s();n();a();s();var _r=u.enum_(["v1","v2"]);n();a();s();var kr=u.enum_(["url-order","spec-order"]);n();a();s();var Fr=u.enum_(["always","never"]);n();a();s();var xs=u.enum_(["v1"]);var Lr=u.object({"use-title":u.boolean().optional(),unions:xs.optional(),"message-naming":_r.optional(),"respect-nullable-schemas":u.boolean().optional(),"only-include-referenced-schemas":u.boolean().optional(),"inline-path-parameters":u.boolean().optional(),"idiomatic-request-names":u.boolean().optional(),"wrap-references-to-nullable-in-optional":u.boolean().optional(),"coerce-optional-schemas-to-nullable":u.boolean().optional(),"group-environments-by-host":u.boolean().optional(),"remove-discriminants-from-schemas":Fr.optional(),"path-parameter-order":kr.optional()});n();a();s();var Pe=u.undiscriminatedUnion([u.string(),u.list(u.string())]);var jr=u.object({path:gt,origin:u.string().optional(),overrides:Pe.optional(),audiences:u.list(u.string()).optional(),settings:Lr.optional()});n();a();s();n();a();s();var Dr=u.object({target:u.string().optional(),root:u.string(),overrides:Pe.optional(),"local-generation":u.boolean().optional(),"from-openapi":u.boolean().optional(),dependencies:u.list(u.string()).optional()});var Ur=u.object({proto:Dr});var Ss=u.undiscriminatedUnion([gt,jr,Ur]);var Ts=u.list(Ss);var Br=u.undiscriminatedUnion([gt,jr,Ts,Ur]);n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var As=u.enum_(["literals","enums","enums-coerceable-to-literals"]);var Mr=u.object({"respect-nullable-schemas":u.boolean().optional(),"title-as-schema-name":u.boolean().optional(),"optional-additional-properties":u.boolean().optional(),"coerce-enums-to-literals":u.boolean().optional(),"idiomatic-request-names":u.boolean().optional(),"wrap-references-to-nullable-in-optional":u.boolean().optional(),"coerce-optional-schemas-to-nullable":u.boolean().optional(),"group-environments-by-host":u.boolean().optional(),"remove-discriminants-from-schemas":Fr.optional(),"path-parameter-order":kr.optional(),"resolve-schema-collisions":u.boolean().optional(),"infer-forward-compatible":u.boolean().optional(),"infer-default-environment":u.boolean().optional(),"coerce-consts-to":As.optional()});var Vr=u.object({"message-naming":_r.optional()}).extend(Mr);n();a();s();n();a();s();var Is=u.enum_(["int32","int64","uint32","uint64"]);n();a();s();var Es=u.enum_(["form","json"]);n();a();s();n();a();s();var $i=u.object({"max-depth":u.number().optional()});var ws=u.object({request:$i.optional(),response:$i.optional()});n();a();s();var Ns=u.object({endpoints:u.list(u.string()).optional()});n();a();s();n();a();s();var Rs=u.object({except:u.list(u.string()).optional()});var Os=u.undiscriminatedUnion([u.boolean(),Rs]);var bt=u.object({"only-include-referenced-schemas":u.boolean().optional(),"inline-path-parameters":u.boolean().optional(),"prefer-undiscriminated-unions-with-literals":u.boolean().optional(),"object-query-parameters":u.boolean().optional(),"respect-readonly-schemas":u.boolean().optional(),"respect-forward-compatible-enums":u.boolean().optional(),"use-bytes-for-binary-response":u.boolean().optional(),"default-form-parameter-encoding":Es.optional(),filter:Ns.optional(),"example-generation":ws.optional(),"additional-properties-defaults-to":u.boolean().optional(),"type-dates-as-strings":u.boolean().optional(),"preserve-single-schema-oneof":u.boolean().optional(),"inline-all-of-schemas":u.boolean().optional(),"resolve-aliases":Os.optional(),"group-multi-api-environments":u.boolean().optional(),"default-integer-format":Is.optional()}).extend(Mr);var vr=u.object({}).extend(bt).extend(Vr);n();a();s();n();a();s();var Ps=u.object({conjure:u.string()});n();a();s();n();a();s();var Cs=u.object({asyncapi:u.string(),origin:u.string().optional(),overrides:Pe.optional(),namespace:u.string().optional(),settings:Vr.optional()});n();a();s();var _s=u.object({graphql:u.string(),origin:u.string().optional(),overrides:u.string().optional(),name:u.string().optional()});n();a();s();var ks=u.object({openapi:u.string(),origin:u.string().optional(),overrides:Pe.optional(),overlays:u.string().optional(),namespace:u.string().optional(),settings:bt.optional()});n();a();s();var Fs=u.object({openrpc:u.string(),overrides:Pe.optional(),namespace:u.string().optional()});n();a();s();var Ls=u.object({proto:Dr});var js=u.undiscriminatedUnion([ks,Cs,Ls,Fs,_s]);var zr=u.undiscriminatedUnion([u.list(js),Ps]);var Ds=u.object({auth:Nr.optional(),"auth-schemes":u.record(u.string(),ht).optional(),specs:zr,settings:vr.optional()}).extend(bs).extend(us);n();a();s();var Us=u.object({namespaces:u.record(u.string(),Br)});var Bs=u.undiscriminatedUnion([Br,Us,Ds]);n();a();s();var Ms=u.enum_(["minimal","comprehensive"]);n();a();s();var Vs=u.object({name:u.string(),registry:u.string()});n();a();s();n();a();s();n();a();s();n();a();s();var vs=u.object({name:u.string(),email:u.string()});var xt=u.object({description:u.string().optional(),authors:u.list(vs).optional()});n();a();s();n();a();s();var Hi=u.object({name:u.string()});var St=u.object({teams:u.list(Hi).optional(),users:u.list(Hi).optional()});n();a();s();n();a();s();n();a();s();n();a();s();var zs=u.object({auth:Nr.optional(),"auth-schemes":u.record(u.string(),ht).optional(),headers:u.record(u.string(),Cr).optional(),settings:vr.optional(),specs:zr.optional()});n();a();s();n();a();s();var qs=u.object({url:u.string().optional(),"package-name":u.string(),token:u.string().optional()});n();a();s();var Gs=u.object({path:u.string()});n();a();s();n();a();s();var Ws=u.object({keyId:u.string(),password:u.string(),secretKey:u.string()});var $s=u.object({url:u.string().optional(),coordinate:u.string(),username:u.string().optional(),password:u.string().optional(),signature:Ws.optional()});n();a();s();var Hs=u.object({url:u.string().optional(),"package-name":u.string(),token:u.string().optional()});n();a();s();var Js=u.object({url:u.string().optional(),"package-name":u.string(),"api-key":u.string().optional()});n();a();s();var Ks=u.object({"api-key":u.string(),"workspace-id":u.string(),"collection-id":u.string().optional()});n();a();s();n();a();s();var Qs=u.object({keywords:u.list(u.string()).optional(),"documentation-link":u.string().optional(),"homepage-link":u.string().optional()}).extend(xt);var Ys=u.object({url:u.string().optional(),"package-name":u.string(),token:u.string().optional(),username:u.string().optional(),password:u.string().optional(),metadata:Qs.optional()});n();a();s();var Xs=u.object({url:u.string().optional(),"package-name":u.string(),"api-key":u.string().optional()});var Zs=u.union("location",{npm:Hs,maven:$s,pypi:Ys,postman:Ks,"local-file-system":Gs,nuget:Js,rubygems:Xs,crates:qs}).transform({transform:e=>e,untransform:e=>e});n();a();s();n();a();s();n();a();s();var ea=u.object({custom:u.string()});n();a();s();var ta=u.enum_(["MIT","Apache-2.0"]);var Ce=u.undiscriminatedUnion([ta,ea]);var Ji=u.object({"package-description":u.string().optional(),email:u.string().optional(),"reference-url":u.string().optional(),author:u.string().optional(),license:Ce.optional()});n();a();s();var ra=u.object({path:u.string()});n();a();s();n();a();s();n();a();s();var ia=u.enum_(["commit","release"]);var na=u.object({repository:u.string(),license:Ce.optional(),mode:ia.optional()});n();a();s();var sa=u.object({repository:u.string(),branch:u.string().optional(),license:Ce.optional(),mode:u.stringLiteral("pull-request"),reviewers:St.optional()});n();a();s();var aa=u.object({repository:u.string(),license:Ce.optional(),mode:u.stringLiteral("push"),branch:u.string().optional()});n();a();s();n();a();s();var oa=u.enum_(["pull-request","push"]);var ua=u.object({uri:u.string(),token:u.string(),mode:oa.optional(),branch:u.string().optional(),license:Ce.optional()});var ca=u.undiscriminatedUnion([ua,na,sa,aa]);var qr=u.object({version:u.string(),output:Zs.optional(),github:ca.optional(),config:u.unknown().optional(),metadata:Ji.optional(),keywords:u.list(u.string()).optional(),snippets:ra.optional(),"ir-version":u.string().optional(),"smart-casing":u.boolean().optional(),api:zs.optional(),"disable-examples":u.boolean().optional(),"publish-metadata":Ji.optional(),autorelease:u.boolean().optional()});var pa=u.object({image:Vs}).extend(qr);n();a();s();var la=u.object({name:u.string()}).extend(qr);var fa=u.undiscriminatedUnion([la,pa]);var ma=u.object({audiences:u.list(u.string()).optional(),generators:u.list(fa),metadata:xt.optional(),reviewers:St.optional()});n();a();s();var da=u.object({enabled:u.boolean()});n();a();s();n();a();s();var ha=u.object({path:u.string(),origin:u.string().optional(),overrides:u.string().optional(),"disable-examples":u.boolean().optional(),settings:bt});var ya=u.undiscriminatedUnion([ha,u.string()]);n();a();s();n();a();s();n();a();s();var ga=u.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var ba=u.object({title:u.string(),language:ga,content:u.string()});n();a();s();n();a();s();var xa=u.object({method:u.string(),path:u.string(),stream:u.boolean().optional()});var Ki=u.undiscriminatedUnion([u.string(),xa]);var Sa=u.object({bannerLink:u.string().optional(),introduction:u.string().optional(),apiReferenceLink:u.string().optional(),apiName:u.string().optional(),disabledSections:u.list(u.string()).optional(),defaultEndpoint:Ki.optional(),features:u.record(u.string(),u.list(Ki)).optional(),customSections:u.list(ba).optional(),exampleStyle:Ms.optional()});n();a();s();n();a();s();var Ta=u.object({username:u.string(),email:u.string(),token:u.string()});var Aa=u.object({github:Ta.optional()});var al=u.object({"auth-schemes":u.record(u.string(),ht).optional(),api:Bs.optional(),whitelabel:Aa.optional(),metadata:xt.optional(),readme:Sa.optional(),"default-group":u.string().optional(),aliases:u.record(u.string(),u.list(u.string())).optional(),groups:u.record(u.string(),ma).optional(),reviewers:St.optional(),replay:da.optional(),ai:Fn.optional(),autorelease:u.boolean().optional(),openapi:ya.optional(),"openapi-overrides":u.string().optional(),"spec-origin":u.string().optional(),"async-api":u.string().optional(),"api-settings":Lr.optional()});var Jo={};F(Jo,{BaseGeneratorInvocationSchema:()=>qr,CratesOutputLocationSchema:()=>qs,CustomGeneratorInvocationSchema:()=>pa,DefaultGeneratorInvocationSchema:()=>la,GeneratorApiSettingsSchema:()=>zs,GeneratorGroupSchema:()=>ma,GeneratorInvocationSchema:()=>fa,GeneratorOutputSchema:()=>Zs,GeneratorPublishMetadataSchema:()=>Ji,GeneratorSnippetsSchema:()=>ra,GithubCommitAndReleaseMode:()=>ia,GithubCommitAndReleaseSchema:()=>na,GithubConfigurationSchema:()=>ca,GithubPullRequestSchema:()=>sa,GithubPushSchema:()=>aa,GithubSelfhostedMode:()=>oa,GithubSelfhostedSchema:()=>ua,LocalFileSystemOutputLocationSchema:()=>Gs,MavenOutputLocationSchema:()=>$s,MavenOutputSignatureSchema:()=>Ws,NpmOutputLocationSchema:()=>Hs,NugetOutputLocationSchema:()=>Js,PostmanOutputLocationSchema:()=>Ks,PypiOutputLocationSchema:()=>Ys,PypiOutputMetadataSchema:()=>Qs,RubyGemsOutputLocationSchema:()=>Xs});n();a();s();var Ko={};F(Ko,{GithubLicenseCustomSchema:()=>ea,GithubLicenseSchema:()=>Ce,GithubLicenseType:()=>ta});n();a();s();var Qo={};F(Qo,{ReplayConfigSchema:()=>da});n();a();s();var Yo={};F(Yo,{ReviewerSchema:()=>Hi,ReviewersSchema:()=>St});n();a();s();n();a();s();n();a();s();function ol(e){return e?.specs!=null}n();a();s();function ul(e){return e?.asyncapi!=null}n();a();s();function cl(e){return e?.conjure!=null}n();a();s();function pl(e){return e?.graphql!=null}n();a();s();function ll(e){return e?.namespaces!=null}n();a();s();function fl(e){return e?.openapi!=null}n();a();s();function ml(e){return e?.openrpc!=null}n();a();s();function dl(e){return e?.proto!=null}var hl={[_e.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,xe(e)])),[_e.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"]),[_e.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"]),[_e.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"]),[_e.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"]),[_e.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"]),[_e.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"]),[_e.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"]),[_e.GenerationLanguage.SWIFT]:new Set([])};var Nd=["go","ruby"];function Ia(e,t,r){let{generationLanguage:i,keywords:o,smartCasing:c}=r,d=jd(e),y=U=>({unsafeName:U,safeName:Rd({name:U,keywords:Od({generationLanguage:i,keywords:o})})}),g=t.preserveUnderscores===!0,x=g?(U,z)=>Zo(U,z):(U,z)=>z(U),S=x(d,Lt),A=g?Zo(d,U=>xe(Lt(U))):xe(S),O=x(d,tn),{leading:w,trailing:V}=g?gl(d):{leading:"",trailing:""},G=Xr(S);if(c){!_d(G)&&(i==null||Nd.includes(i))&&(S=w+G.map((z,ie)=>{if(ie>0){let de=Ea(z);if(de!=null)return de;if(wa(z))return z.toUpperCase()}return z}).join("")+V,A=xe(w+G.map((z,ie)=>{let de=Ea(z);return de??(wa(z)?z.toUpperCase():ie===0?xe(z):z)}).join("")+V));let U=z=>z.split(" ").map(ie=>ie.split(/(\d+)/).map(tn).join("")).join("_");O=g?Zo(d,U):U(d)}return{originalName:e,camelCase:y(t.casingOverrides?.camel??S),snakeCase:y(t.casingOverrides?.snake??O),screamingSnakeCase:y(t.casingOverrides?.["screaming-snake"]??O.toUpperCase()),pascalCase:y(t.casingOverrides?.pascal??A)}}function yl({generationLanguage:e,keywords:t,smartCasing:r}){let i={generationLanguage:e,keywords:t,smartCasing:r};return{generateName:(o,c)=>{if(typeof o=="string")return Ia(o,c??{},i);if("wireValue"in o){let d=o.name;return typeof d=="string"?Ia(d,c??{},i):d}return o},generateNameAndWireValue:(o,c)=>{if(typeof o=="string")return{wireValue:o,name:Ia(o,c??{},i)};let{name:d,wireValue:y}=o,g=typeof d=="string"?Ia(d,c??{},i):d;return{wireValue:y,name:g}}}}function Rd({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":Cd(e)?"_"+e:e}function Od({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return hl[e]}var Pd=/^[0-9]/;function Cd(e){return Pd.test(e)}function _d(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let o=Ea(i)!=null||wa(i),c=Ea(t)!=null||wa(t);return o&&c})}function Ea(e){return Fd.get(e.toUpperCase())}function wa(e){return kd.has(e.toUpperCase())}var kd=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"]),Fd=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]),Ld=[[/\[\]/g,"Array"]];function jd(e){return Ld.reduce((t,[r,i])=>t.replace(r,i),e)}function gl(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 Zo(e,t){let{leading:r,trailing:i,core:o}=gl(e);return r===""&&i===""?t(e):`${r}${t(o)}${i}`}n();a();s();function Qi(e){return typeof e=="string"?e:e.wireValue}var Yi=class e{constructor(t){m(this,"casingsGenerator");this.casingsGenerator=yl(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}};var Gr=class extends Te{constructor({name:r,namespace:i,access:o,annotations:c,origin:d},y){super(d,y);m(this,"access");m(this,"reference");m(this,"annotations");m(this,"fields",[]);m(this,"generateSerializer",!1);m(this,"serializerClassReference");this.reference=this.csharp.classReference({name:r,namespace:i,origin:d}),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(Qi(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(Qi(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 Wr=class extends Sr{constructor({name:t,namespace:r,access:i,partial:o,interfaceReferences:c,enclosingType:d,origin:y},g){super({name:t,namespace:r,access:i,partial:o,interfaceReferences:c,enclosingType:d,origin:y},g)}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 $r=class extends Te{constructor({name:r,namespace:i,parentClassReference:o,origin:c},d){super(c,d);m(this,"reference");m(this,"parentClassReference");m(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 Ve({access:ne.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:ne.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 eu={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 Bd=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 Md=new Set(["from","where","select","orderby","groupby","into","let","join","on","equals"]),Vd=new Set(["async","await"]),vd=new Set(["yield"]),zd=new Set(["var","dynamic"]),qd=new Set(["using","alias"]);var Gd=new Set(["required","scoped","unmanaged","managed"]),Wd=new Set(["when","and","or","not"]),$d=new Set(["Equals","GetHashCode","ToString","GetType","MemberwiseClone","Finalize"]),Hd=new Set([...Bd,...Md,...Vd,...vd,...zd,...qd,...Gd,...Wd]),Na=class{constructor(t,r,i){m(this,"registry");m(this,"name");m(this,"jsonPath");this.registry=t,this.name=r,this.jsonPath=i}};var Ra=class{constructor(t){m(this,"scope");m(this,"byName",new Map);m(this,"byPath",new Map);m(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)&&re(`set: ${t.name} in ${this.scope.fullyQualifiedName} already exists`),t.jsonPath&&this.byPath.has(t.jsonPath)&&re(`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)&&re(`redirect: ${t} in ${this.scope.fullyQualifiedName} already has a redirect`),this.redirections.set(t,r)}},tu=class extends Na{constructor(r,i,o,c){super(r,i);m(this,"namespace");m(this,"fullyQualifiedName");m(this,"fields");m(this,"methods");this.namespace=o,this.fullyQualifiedName=c,this.fields=new Ra(this),this.methods=new Ra(this)}isKeyword(r){return Hd.has(r)}isBuiltinMemberName(r){return $d.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 g=this.fields.getByJsonPath(c);if(g)return g.name}let d=this.fields.getByName(r);if(d&&c===d.jsonPath)return r;switch(this.nameBlocked(r)){case"field":i&&C.Provenance(i)&&i.explicit||re(`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 Oa(this.registry,r,this,c,o)),this.registry.setFieldNameShortcut(c,r),r}let y=this.getAlternativeName(r);return this.fields.set(new Oa(this.registry,y,this,c,o)),this.fields.redirect(r,y),this.registry.setFieldNameShortcut(c,y),y}getFieldName(r,i){let o=this.getFieldByJsonPath(this.registry.model.jsonPath(r))?.name;if(o)return o;if(C.Provenance(r)){let y=this.getRedirectedFieldName(i);if(y)return y;let g=this.getFieldByName(i);return g?this.registry.model.provenance(g.jsonPath)?.explicit?i:`${i}_`:i}let c=this.getFieldByName(i);if(c)return this.registry.model.provenance(c.jsonPath)?.explicit?i:c.name;let d=this.getRedirectedFieldName(i);if(d)return d;this.isMethod(i)}},ru=class extends Na{constructor(r,i,o,c){super(r,i,c);m(this,"scope");this.scope=o}},Oa=class extends ru{constructor(r,i,o,c,d){super(r,i,o,c);m(this,"field");this.field=d}};var Jr=class e{constructor(t){m(this,"generation");m(this,"classReferenceByJsonPath",new Map);m(this,"typeRegistry",new Map);m(this,"namespaceRegistry",new Map);m(this,"typeNames",new Map);m(this,"namespaceNames",new Map);m(this,"implicitNamespaces",new Set);m(this,"shortcuts",new Map);m(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(eu))t.split(".").forEach(i=>this.knownBuiltInIdentifiers.add(i)),r.forEach(i=>this.knownBuiltInIdentifiers.add(i));for(let[t,r]of Object.entries(eu)){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&&re(`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)}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:d,origin:y}=t;if(y){let g=this.model.jsonPath(y)??re(`JsonPath not found for origin: ${JSON.stringify(y).substring(0,100)}`);this.classReferenceByJsonPath.set(g,t)}if(r&&r!==d&&!this.typeRegistry.has(r)&&this.typeRegistry.set(r,t),!this.typeRegistry.has(d)){this.typeRegistry.set(d,t);for(let g of this.allNamespacesOf(o))this.registerNamespace(g,g);c||this.trackTypeName(i,o);for(let g of[this.generation.namespaces.root,...this.implicitNamespaces])if(o.startsWith(g)){let x=o.split(".")[g.split(".").length];x&&this.trackTypeName(x,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:d}=t,y=this.model.jsonPath(d),g=(y?this.classReferenceByJsonPath.get(y):void 0)??this.typeRegistry.get(r),x=this.model.jsonPath(g?.origin),S=x&&y?x===y?"match":"mismatch":"no origin";if(g&&S!=="mismatch")return new ge({name:g.name,namespace:g.namespace,enclosingType:g.enclosingType,fullyQualifiedName:g.fullyQualifiedName,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,origin:g.origin??d,isCollection:g.isCollection,isReferenceType:g.isReferenceType,multipartMethodName:g.multipartMethodName,multipartMethodNameForCollection:g.multipartMethodNameForCollection},g.scope,this.generation);let A=!1,O=this.resolveNamespace(o);O!==o&&(o=O,A=!0);let w;e:for(;;){w=e.fullyQualifiedNameOf({name:i,namespace:o,enclosingType:c});let V="",G=o.split(".");for(let U=0;U<G.length;U++)if(V=V?`${V}.${G[U]}`:`${G[U]}`,this.typeRegistry.has(V)){G[U]=`${G[U]}_`,o=G.join("."),A=!0;continue e}if(A&&this.registerNamespace(t.namespace,o),S==="mismatch"&&g?.name===i){i=`${i}_`,A=!0;continue e}if(this.namespaceRegistry.has(w)){i=`${i}_`,A=!0;continue e}if(this.typeRegistry.has(w)){i=`${i}_`,A=!0;continue e}if(c){let U=w.replaceAll("+",".");if(this.typeRegistry.has(U)){i=`${i}_`,A=!0;continue e}if(this.namespaceRegistry.has(U)){i=`${i}_`,A=!0;continue e}}else{let U=w.split(".");for(let z=1;z<U.length;z++){let ie=U.slice(0,z).join(".")+"+"+U.slice(z).join("+");if(this.typeRegistry.has(ie)){i=`${i}_`,A=!0;continue e}}}break}return this.trackType(new ge({name:i,namespace:o,enclosingType:c,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,fullyQualifiedName:w,origin:d,isCollection:t.isCollection,isReferenceType:t.isReferenceType,multipartMethodName:t.multipartMethodName,multipartMethodNameForCollection:t.multipartMethodNameForCollection},new tu(this,i,o,w),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 d=this.namespaceRegistry.get(c);if(d!==void 0){let y=i.slice(o).join("."),g=`${d}.${y}`;return this.registerNamespace(t,g),g}}}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="",d=o.split(".");for(let y=0;y<d.length;y++)if(c=c?`${c}.${d[y]}`:`${d[y]}`,this.typeRegistry.has(c)){d[y]=`${d[y]}_`,o=d.join("."),i=!0;continue e}break}return i&&this.registerNamespace(t,o),o}};var Pa=class{constructor(t){m(this,"generation");m(this,"frozen",!1);m(this,"extraClassReferences",new Map);m(this,"InstantiatedPrimitive",{string:t=>new fe({type:"string",value:t},this.generation),boolean:t=>new fe({type:"boolean",value:t},this.generation),integer:t=>new fe({type:"integer",value:t},this.generation),long:t=>new fe({type:"long",value:t},this.generation),uint:t=>new fe({type:"uint",value:t},this.generation),ulong:t=>new fe({type:"ulong",value:t},this.generation),float:t=>new fe({type:"float",value:t},this.generation),double:t=>new fe({type:"double",value:t},this.generation),date:t=>new fe({type:"date",value:t},this.generation),dateTime:(t,r=!0)=>new fe({type:"dateTime",value:t,parse:r},this.generation),uuid:t=>new fe({type:"uuid",value:t},this.generation),null:()=>new fe({type:"null"},this.generation)});m(this,"Literal",{class_:({reference:t,fields:r})=>new B.Class_(t,r,this.generation),dictionary:({keyType:t,valueType:r,entries:i})=>new B.Dictionary(t,r,i,this.generation),list:({valueType:t,values:r})=>new B.List(t,r,this.generation),set:({valueType:t,values:r})=>new B.Set(t,r,this.generation),boolean:t=>new B.Boolean(t,this.generation),float:t=>new B.Float(t,this.generation),date:t=>new B.Date(t,this.generation),datetime:t=>new B.DateTime(t,this.generation),decimal:t=>new B.Decimal(t,this.generation),double:t=>new B.Double(t,this.generation),integer:t=>new B.Integer(t,this.generation),long:t=>new B.Long(t,this.generation),uint:t=>new B.Uint(t,this.generation),ulong:t=>new B.Ulong(t,this.generation),reference:t=>new B.Reference(t,this.generation),string:t=>new B.String(t,this.generation),null:()=>new B.Null(this.generation),nop:()=>new B.Nop(this.generation),unknown:t=>new B.Unknown(t,this.generation)});m(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)throw new Error("ClassReference: Both enclosingType and namespace cannot be provided");t.namespace=t.enclosingType.namespace}let r=Jr.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
|
-
${ri()}`)}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 Ve(r,this.generation)}testClass(t){return new $r(t,this.generation)}annotation(t){return new Je(t,this.generation)}annotationGroup(t){return new dr(t,this.generation)}instantiateClass(t){return new Yt(t,this.generation)}invokeMethod(t){return new tr(t,this.generation)}codeblock(t){return new ut(t,this.generation)}code(){return new ct({},this.generation)}anonymousFunction(t){return new hr(t)}parameter(t){return new Le(t,this.generation)}interface_(t){return new Wr(t,this.generation)}enum_(t){return new Gr(t,this.generation)}dictionary(t){return new Xt(t,this.generation)}list(t){return new er(t,this.generation)}readOnlyMemory(t){return new rr(t,this.generation)}set(t){return new ir(t,this.generation)}switch_(t){return new gr(t,this.generation)}ternary(t){return new br(t,this.generation)}and(t){return new mr(t,this.generation)}or(t){return new yr(t,this.generation)}enumInstantiation(t){return new Zt(t,this.generation)}string_(t){return new nr(t,this.generation)}xmlDocBlock(t){return new ft(t,this.generation)}xmlDocBlockOf(t){return t instanceof ft?t:new ft(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 Ca=class{constructor(t){m(this,"generation");m(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"})}));m(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"})})}));m(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})}));m(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"})})})}));m(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"})}));m(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 iu=new Set(["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"]);function Jd(e,t){return iu.has(t)?e??"":e?`${e}.${t}`:t}var _a=class{constructor(t,r){m(this,"generation");m(this,"indexByObject",new Map);m(this,"indexByPath",new Map);m(this,"explicitByObject",new Map);m(this,"explicitByPath",new Map);m(this,"root");m(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=Jd(i?.jsonPath,r);if(this.indexByPath.has(o)){i||re(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,i);let d=iu.has(r);for(let[y,g]of Object.entries(t))typeof g=="object"&&g!==null&&(d&&iu.has(y)?this.indexByObject.set(g,i):this.createIndex(g,y,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[d,y]of Object.entries(t))typeof y=="object"&&y!==null&&this.createIndex(y,d,c);return c}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){let i=this.provenance(t)??re(`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 C.string(t)?this.explicitByPath.get(t)??this.indexByPath.get(t):C.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=C.IR.ExampleEnumType(r)?r.value:r,o=t.values.find(c=>this.nameEquals(c.name,i));return o?this.getPropertyNameFor(o):re(`Unexpected - can't find enum value ${JSON.stringify(i)} in enum`)}getPropertyNameFor(t){let r=this.registry.getFieldNameByOrigin(t);if(r)return r;if(C.Provenance(t))return t.name;if("name"in t){if(C.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(C.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(C.Provenance(t))return t.name;if("name"in t){if(C.IR.TypeDeclaration(t))return this.generation.case.pascalSafe(t.name.name);if(C.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(C.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=C.string(t)?t:C.IR.NamedType(t)||C.IR.DeclaredTypeName(t)?t.typeId:C.IR.ExampleNamedType(t)?t.typeName.typeId:t.name.typeId,i=this.irNode(this.ir.types[r]);if(C.IR.TypeDeclaration(i))return{typeId:r,typeDeclaration:i};re(`dereferenceType: typeId ${r} not resolved.`)}};function ka(...e){return e.filter(Boolean).join("/")}var Xi=class{constructor(t,r,i,o,c={makeRelativeFilePath:d=>d,makeAbsoluteFilePath:d=>d,getNamespaceForTypeId:d=>"",getDirectoryForTypeId:d=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:d=>[]}){m(this,"intermediateRepresentation");m(this,"apiName");m(this,"customConfig");m(this,"generatorConfig");m(this,"support");m(this,"ir");m(this,"dir");m(this,"csharp",new Pa(this));m(this,"registry",new Jr(this));m(this,"model");m(this,"case");m(this,"extern",new Ca(this));m(this,"settings",j({namespace:()=>this.customConfig.namespace??bn(xn(`${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,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,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"]??"",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"?ne.Internal:ne.Public,extraDependencies:()=>this.customConfig["extra-dependencies"]??{},omitFernHeaders:()=>this.customConfig["omit-fern-headers"]??!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,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??"."}}}));m(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(ka(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(ka(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(ka(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(ka(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:j({indent:()=>" "}),defaults:j({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});m(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"])}));m(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:()=>bn(xn(`${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"})});m(this,"Types",j({Arbitrary:t=>new q.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}),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:d})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,o,c,d]}),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})}));m(this,"Primitive",j({string:()=>new q.String(this),boolean:()=>new q.Boolean(this),integer:()=>new q.Integer(this),long:()=>new q.Long(this),uint:()=>new q.Uint(this),ulong:()=>new q.ULong(this),float:()=>new q.Float(this),double:()=>new q.Double(this),object:()=>new q.Object(this)}));m(this,"Value",j({binary:()=>new Ie.Binary(this),dateOnly:()=>new Ie.DateOnly(this),dateTime:()=>new Ie.DateTime(this),uuid:()=>new Ie.Uuid(this),stringEnum:t=>new Ie.StringEnum(t,this)}));m(this,"Collection",j({array:t=>new se.Array(t,this),listType:t=>new se.ListType(t,this),list:t=>new se.List(t,this),set:t=>new se.Set(t,this),map:(t,r,i)=>new se.Map(t,r,this,i),idictionary:(t,r,i)=>new se.IDictionary(t,r,this,i),keyValuePair:(t,r)=>new se.KeyValuePair(t,r,this)}));m(this,"format",j({private:t=>`_${Sn.camelCase(t)}`}));m(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 d=C.IR.IntermediateRepresentation(t)?t.casingsConfig:void 0;this.case=new Yi({generationLanguage:"csharp",keywords:d?.keywords,smartCasing:d?.smartCasing??!0}),this.model=new _a(t,this),this.ir=C.IR.IntermediateRepresentation(t)?t:{},this.dir=C.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 Ue=class{constructor(t){m(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 Fa=class extends Ue{constructor({context:r}){super(r.generation);m(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:v.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,value:r.value});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});case"optional":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as});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:Q(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,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:v.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertLiteral({literal:r,value:i,fallbackToDefault:o}){switch(r.type){case"boolean":{let c=this.context.getValueAsBoolean({value:i});return c==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(c)}case"string":{let c=this.context.getValueAsString({value:i});return c==null?o?this.Primitive.string.getDeterminsticDefault(o):this.csharp.Literal.nop():this.csharp.Literal.string(c)}default:Q(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,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:v.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:v.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,d])=>{this.context.errors.scope(c);try{return{key:this.convert({typeReference:r.key,value:c,as:"key"}),value:this.convert({typeReference:r.value,value:d})}}finally{this.context.errors.unscope()}})})}convertNamed({named:r,value:i,as:o,fallbackToDefault:c}){switch(r.type){case"alias":return 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:Q(r)}}convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:o}){let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),d=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:i});if(d==null)return this.csharp.Literal.nop();let y=d.singleDiscriminatedUnionType,g=this.getBaseProperties({discriminatedUnionTypeInstance:d,singleDiscriminatedUnionType:y});switch(y.type){case"samePropertiesAsObject":{let x=this.context.resolveNamedType({typeId:y.typeId});return x==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:g,arguments_:[this.convertNamed({named:x,value:d.value})]})}case"singleProperty":{if(this.context.getRecord(d.value)==null)return this.csharp.Literal.nop();try{let S=["Value","Type"].includes(y.discriminantValue.name.pascalCase.safeName)?`${y.discriminantValue.name.pascalCase.safeName}Inner`:y.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(y.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:g,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:S,enclosingType:c}),arguments_:[this.convert({typeReference:y.typeReference,value:y.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:g,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:d.discriminantValue,enclosingType:c}),arguments_:[]})]});default:Q(y)}}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(d=>{d.write(c," "),d.pushScope();for(let y of o)d.write(y.name," = ",y.assignment,",");d.popScope(!1)}))}getEnumValue(r,i){if(typeof i!="string")return this.context.errors.add({severity:v.Critical,message:`Expected enum value string, got: ${typeof i}`}),this.csharp.Literal.nop();let o=r.values.find(y=>y.wireValue===i);if(o==null)return this.context.errors.add({severity:v.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)}),d=c.registerField(this.model.getPropertyNameFor(o),o);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:c,value:d}))}convertObject({object_:r,value:i,fallbackToDefault:o}){let c=this.context.getRecord(i)??{},y=this.context.associateByWireValue({parameters:r.properties,values:c}).map(x=>{this.context.errors.scope(x.name.wireValue);try{return{name:this.context.getClassName(x.name.name),value:this.convert(x)}}finally{this.context.errors.unscope()}}),g=new Set(Object.keys(c));for(let x of r.properties){let S=this.context.getClassName(x.name.name);if(g.has(x.name.wireValue)){if(this.isRequiredProperty(x.typeReference)){let A=y.find(O=>O.name===S);if(A!=null&&C.Literal.nop(A.value)){let O=this.getDefaultLiteralForType(x.typeReference);O!=null&&(A.value=O)}}continue}if(this.isRequiredProperty(x.typeReference)){let A=this.getDefaultLiteralForType(x.typeReference);A!=null&&y.push({name:S,value:A})}}return this.csharp.Literal.class_({reference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),fields:y})}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 d=[];for(let y of r.properties)if(this.isRequiredProperty(y.typeReference)){let g=this.getDefaultLiteralForType(y.typeReference,c);g!=null&&d.push({name:this.context.getClassName(y.name.name),value:g})}return c.delete(i),this.csharp.Literal.class_({reference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),fields:d})}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:Q(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 d=this.convert({typeReference:o,value:i});if(C.Literal.nop(d)||this.context.errors.size()>c){this.context.errors.truncate(c);continue}return{valueTypeReference:o,typeLiteral:d}}catch{this.context.errors.truncate(c);continue}}this.context.errors.add({severity:v.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 d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.integer.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.integer(d)}case"LONG":{let d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.long.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.long(d)}case"UINT":{let d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.uint.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.uint(d)}case"UINT_64":{let d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.ulong.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.ulong(d)}case"FLOAT":{let d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.float.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.float(d)}case"DOUBLE":{let d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.double.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.double(d)}case"BOOLEAN":{let d=this.getValueAsBoolean({value:i,as:o});return d==null?c?this.Primitive.boolean.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.boolean(d)}case"STRING":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(d)}case"DATE":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Value.dateOnly.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.date(d)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Value.dateTime.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.datetime(d)}case"UUID":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(d)}case"BASE_64":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(d)}case"BIG_INTEGER":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(d)}default:Q(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 La=class extends Ue{constructor({context:r}){super(r.generation);m(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})}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:Q(r.typeReference)}}convertToClassReference(r){return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)})}convertNamed({named:r}){switch(r.type){case"alias":return this.convert({typeReference:r.typeReference});case"enum":case"object":return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.Primitive.object;case"undiscriminatedUnion":return this.settings.shouldGenerateUndiscriminatedUnions?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.OneOf.OneOf(r.types.map(i=>this.convert({typeReference:i})));default:Q(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:Q(r)}}};n();a();s();var ja=class extends Ue{constructor({context:r}){super(r.generation);m(this,"context");this.context=r}getFilePropertyInfo({body:r,value:i}){let o={fileFields:[],bodyPropertyFields:[]},c=this.context.getRecord(i)??{};for(let d of r.properties)switch(d.type){case"file":C.Record.missingKey(c,d.wireValue)&&(c[d.wireValue]="[bytes]"),o.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getSingleFileProperty({property:d,record:c})});break;case"fileArray":C.Record.missingKey(c,d.wireValue)&&(c[d.wireValue]=["[bytes]"]),o.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getArrayFileProperty({property:d,record:c})});break;case"bodyProperty":if(C.Record.missingKey(c,d.name.wireValue))switch(d.typeReference.type){case"optional":break;case"primitive":{switch(d.typeReference.value.toLowerCase()){case"integer":{c[d.name.wireValue]=123;break}case"string":{c[d.name.wireValue]="[string]";break}case"boolean":{c[d.name.wireValue]=!0;break}case"double":{c[d.name.wireValue]=123.456;break}case"float":{c[d.name.wireValue]=123.456;break}case"long":{c[d.name.wireValue]=123456789;break}case"uint":{c[d.name.wireValue]=123;break}case"uint64":{c[d.name.wireValue]=12345;break}case"date":{c[d.name.wireValue]=new Date(2021,1,1);break}case"datetime":{c[d.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{c[d.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{c[d.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{c[d.name.wireValue]="12345678901234567890";break}}break}default:break}o.bodyPropertyFields.push({name:this.context.getPropertyName(d.name.name),value:this.getBodyProperty({property:d,record:c})});break;default:Q(d)}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 Da=class e extends pi{constructor({ir:r,config:i,options:o,generation:c}){super({ir:r,config:i,options:o});m(this,"ir");m(this,"dynamicTypeMapper");m(this,"dynamicLiteralMapper");m(this,"filePropertyMapper");m(this,"generation");this.ir=r,this.generation=c??new Xi(r,i.workspaceName,i.customConfig!=null?i.customConfig:{},i),this.dynamicTypeMapper=new La({context:this}),this.dynamicLiteralMapper=new Fa({context:this}),this.filePropertyMapper=new ja({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}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)});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 d of c)switch(d.request.type){case"inlined":this.csharp.classReference({origin:d.request.declaration.name,namespace:this.getNamespace(d.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClientForSnippets,this.csharp.freezeClassReferences()}};n();a();s();var Ua=class extends Ue{constructor({context:r}){super(r.generation);m(this,"context");this.context=r}async generateSnippet({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Usage",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:"Usage",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&&!r.examples?.find(y=>C.DynamicIR.EndpointExample(i)&&y.id===i.id))throw new Error("Endpoint does not have an example that matches the snippet");let c=this.csharp.codeblock(y=>{y.writeNodeStatement(this.constructClient({endpoint:r,snippet:i})),y.newLine(),y.writeNodeStatement(this.callMethod({endpoint:r,snippet:i}))}),d=this.getStyle(o);switch(d){case Tt.Concise:return c;case Tt.Full:return this.buildFullCodeBlock({body:c,options:o});default:Q(d)}}buildFullCodeBlock({body:r,options:i}){let o=this.getConfig(i),c=this.csharp.class_({name:o.fullStyleClassName??"Example",namespace:"Usage",access:Hr.Access.Public});return c.addNamespaceReference(this.Types.RootClientForSnippets.namespace),c.addMethod({name:"Do",access:Hr.Access.Public,isAsync:!0,parameters:[],body:r}),c}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(d=>{d.write("await foreach (var item in "),d.writeNode(c),d.writeLine(")"),d.pushScope(),d.writeLine("/* consume each item */"),d.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:v.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let c=[],d=this.getConstructorBaseUrlArgs({baseUrl:i.baseURL,environment:i.environment});d.length>0&&c.push(...d),this.context.errors.scope(Be.Headers);let y=[];if(this.context.ir.headers!=null&&i.headers!=null&&y.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:i.headers})),this.context.errors.unscope(),this.settings.unifiedClientOptions){let g=[...o.map(x=>({name:xe(x.name),assignment:x.assignment})),...y.map(x=>({name:xe(x.name),assignment:x.assignment})),...c.map(x=>({name:x.name,assignment:x.assignment}))];return g.length===0?[]:[{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:g,multiline:!0})}]}return c.length===0?[...o,...y]:[...o,...y,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:c.map(g=>({name:g.name,assignment:g.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:r,environment:i}){let o=this.getBaseUrlArg({baseUrl:r,environment:i});return C.Literal.nop(o)?[]:[{name:this.getBaseUrlOptionName(),assignment:o}]}getBaseUrlArg({baseUrl:r,environment:i}){if(r!=null&&i!=null)return this.context.errors.add({severity:v.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:v.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:v.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:xe(Lt(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:Q(r)}}addError(r){this.context.errors.add({severity:v.Critical,message:r})}addWarning(r){this.context.errors.add({severity:v.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:i}){let o=r,c=!!o.usernameOmit,d=!!o.passwordOmit,y=[];return c||y.push({name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(i.username)}),d||y.push({name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(i.password)}),y}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 d=c.name.wireValue,y=i.values?.[d];o.push({name:this.context.getParameterName(c.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:c.typeReference,value:y,fallbackToDefault:d})})}else this.context.errors.add({severity:v.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 d=i[c.name.wireValue],y=this.getConstructorHeaderArg({header:c,value:d});y!=null&&o.push({name:this.context.getParameterName(c.name.name),assignment:y})}return o}getConstructorHeaderArg({header:r,value:i}){let o=this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:i,fallbackToDefault:r.name.wireValue});if(!C.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:Q(r.request)}}getMethodArgsForInlinedRequest({request:r,snippet:i}){let o=[];this.context.errors.scope(Be.PathParameters);let c=[],d=[...this.context.ir.pathParameters??[],...r.pathParameters??[]];d.length>0&&c.push(...this.getPathParameters({namedParameters:d,snippet:i})),this.context.errors.unscope(),this.context.errors.scope(Be.RequestBody);let y=this.getFilePropertyInfo({request:r,snippet:i});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})||o.push(...c.map(g=>g.value)),o.push(this.getInlinedRequestArg({request:r,snippet:i,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})?c:[],filePropertyInfo:y})),o}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}){this.context.errors.scope(Be.QueryParameters);let y=this.context.associateQueryParametersByWireValue({parameters:r.queryParameters??[],values:i.queryParameters??{}}).map(A=>({name:this.context.getPropertyName(A.name.name),value:this.context.dynamicLiteralMapper.convert(A)}));this.context.errors.unscope(),this.context.errors.scope(Be.Headers);let x=this.context.associateByWireValue({parameters:r.headers??[],values:i.headers??{}}).map(A=>({name:this.context.getPropertyName(A.name.name),value:this.context.dynamicLiteralMapper.convert({...A,fallbackToDefault:A.name.wireValue})}));this.context.errors.unscope(),this.context.errors.scope(Be.RequestBody);let S=r.body!=null?this.getInlinedRequestBodyConstructorFields({body:r.body,value:i.requestBody,filePropertyInfo:c}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),fields:[...o,...y,...x,...S]})}getInlinedRequestBodyConstructorFields({body:r,value:i,filePropertyInfo:o}){switch(r.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:r.value,value:i});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:r,value:i})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:o});default:Q(r)}}getInlinedRequestBodyPropertyConstructorFields({parameters:r,value:i}){let o=[],c=this.context.associateByWireValue({parameters:r,values:this.context.getRecord(i)??{}});for(let d of c)o.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicLiteralMapper.convert({...d,fallbackToDefault:d.name.wireValue})});return o}getFileUploadRequestBodyConstructorFields({filePropertyInfo:r}){return[...r.fileFields,...r.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:r,value:i}){return{name:this.context.getPropertyName(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:Q(r)}}getMethodArgsForBodyRequest({request:r,snippet:i}){let o=[];this.context.errors.scope(Be.PathParameters);let c=[...this.context.ir.pathParameters??[],...r.pathParameters??[]];return c.length>0&&o.push(...this.getPathParameters({namedParameters:c,snippet:i}).map(d=>d.value)),this.context.errors.unscope(),this.context.errors.scope(Be.RequestBody),r.body!=null&&o.push(this.getBodyRequestArg({body:r.body,value:i.requestBody})),this.context.errors.unscope(),o}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:Q(r)}}getBytesBodyRequestArg({value:r}){let i=this.context.getValueAsString({value:r});return i==null&&(this.context.errors.add({severity:v.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 d of c)o.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicLiteralMapper.convert({...d,fallbackToDefault:d.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??Tt.Full}getConfig(r){return r.config??this.context.options.config??{}}};var nu=class extends oi{constructor({ir:t,config:r,options:i={}}){super(new Da({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 Ua({context:t})}};export{nu as DynamicSnippetsGenerator};
|
|
33
|
+
${ri()}`)}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 Ve(r,this.generation)}testClass(t){return new $r(t,this.generation)}annotation(t){return new Je(t,this.generation)}annotationGroup(t){return new dr(t,this.generation)}instantiateClass(t){return new Yt(t,this.generation)}invokeMethod(t){return new tr(t,this.generation)}codeblock(t){return new ut(t,this.generation)}code(){return new ct({},this.generation)}anonymousFunction(t){return new hr(t)}parameter(t){return new Le(t,this.generation)}interface_(t){return new Wr(t,this.generation)}enum_(t){return new Gr(t,this.generation)}dictionary(t){return new Xt(t,this.generation)}list(t){return new er(t,this.generation)}readOnlyMemory(t){return new rr(t,this.generation)}set(t){return new ir(t,this.generation)}switch_(t){return new gr(t,this.generation)}ternary(t){return new br(t,this.generation)}and(t){return new mr(t,this.generation)}or(t){return new yr(t,this.generation)}enumInstantiation(t){return new Zt(t,this.generation)}string_(t){return new nr(t,this.generation)}xmlDocBlock(t){return new ft(t,this.generation)}xmlDocBlockOf(t){return t instanceof ft?t:new ft(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 Ca=class{constructor(t){m(this,"generation");m(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"})}));m(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"})})}));m(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})}));m(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"})})})}));m(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"})}));m(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 iu=new Set(["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"]);function Jd(e,t){return iu.has(t)?e??"":e?`${e}.${t}`:t}var _a=class{constructor(t,r){m(this,"generation");m(this,"indexByObject",new Map);m(this,"indexByPath",new Map);m(this,"explicitByObject",new Map);m(this,"explicitByPath",new Map);m(this,"root");m(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=Jd(i?.jsonPath,r);if(this.indexByPath.has(o)){i||re(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,i);let d=iu.has(r);for(let[y,g]of Object.entries(t))typeof g=="object"&&g!==null&&(d&&iu.has(y)?this.indexByObject.set(g,i):this.createIndex(g,y,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[d,y]of Object.entries(t))typeof y=="object"&&y!==null&&this.createIndex(y,d,c);return c}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){let i=this.provenance(t)??re(`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 C.string(t)?this.explicitByPath.get(t)??this.indexByPath.get(t):C.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=C.IR.ExampleEnumType(r)?r.value:r,o=t.values.find(c=>this.nameEquals(c.name,i));return o?this.getPropertyNameFor(o):re(`Unexpected - can't find enum value ${JSON.stringify(i)} in enum`)}getPropertyNameFor(t){let r=this.registry.getFieldNameByOrigin(t);if(r)return r;if(C.Provenance(t))return t.name;if("name"in t){if(C.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(C.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(C.Provenance(t))return t.name;if("name"in t){if(C.IR.TypeDeclaration(t))return this.generation.case.pascalSafe(t.name.name);if(C.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(C.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=C.string(t)?t:C.IR.NamedType(t)||C.IR.DeclaredTypeName(t)?t.typeId:C.IR.ExampleNamedType(t)?t.typeName.typeId:t.name.typeId,i=this.irNode(this.ir.types[r]);if(C.IR.TypeDeclaration(i))return{typeId:r,typeDeclaration:i};re(`dereferenceType: typeId ${r} not resolved.`)}};function ka(...e){return e.filter(Boolean).join("/")}var Xi=class{constructor(t,r,i,o,c={makeRelativeFilePath:d=>d,makeAbsoluteFilePath:d=>d,getNamespaceForTypeId:d=>"",getDirectoryForTypeId:d=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:d=>[]}){m(this,"intermediateRepresentation");m(this,"apiName");m(this,"customConfig");m(this,"generatorConfig");m(this,"support");m(this,"ir");m(this,"dir");m(this,"csharp",new Pa(this));m(this,"registry",new Jr(this));m(this,"model");m(this,"case");m(this,"extern",new Ca(this));m(this,"settings",j({namespace:()=>this.customConfig.namespace??bn(xn(`${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,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,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"]??"",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"?ne.Internal:ne.Public,extraDependencies:()=>this.customConfig["extra-dependencies"]??{},omitFernHeaders:()=>this.customConfig["omit-fern-headers"]??!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,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??"."}}}));m(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(ka(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(ka(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(ka(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(ka(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:j({indent:()=>" "}),defaults:j({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});m(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"])}));m(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:()=>bn(xn(`${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"})});m(this,"Types",j({Arbitrary:t=>new q.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}),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:d})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,o,c,d]}),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})}));m(this,"Primitive",j({string:()=>new q.String(this),boolean:()=>new q.Boolean(this),integer:()=>new q.Integer(this),long:()=>new q.Long(this),uint:()=>new q.Uint(this),ulong:()=>new q.ULong(this),float:()=>new q.Float(this),double:()=>new q.Double(this),object:()=>new q.Object(this)}));m(this,"Value",j({binary:()=>new Ie.Binary(this),dateOnly:()=>new Ie.DateOnly(this),dateTime:()=>new Ie.DateTime(this),uuid:()=>new Ie.Uuid(this),stringEnum:t=>new Ie.StringEnum(t,this)}));m(this,"Collection",j({array:t=>new se.Array(t,this),listType:t=>new se.ListType(t,this),list:t=>new se.List(t,this),set:t=>new se.Set(t,this),map:(t,r,i)=>new se.Map(t,r,this,i),idictionary:(t,r,i)=>new se.IDictionary(t,r,this,i),keyValuePair:(t,r)=>new se.KeyValuePair(t,r,this)}));m(this,"format",j({private:t=>`_${Sn.camelCase(t)}`}));m(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 d=C.IR.IntermediateRepresentation(t)?t.casingsConfig:void 0;this.case=new Yi({generationLanguage:"csharp",keywords:d?.keywords,smartCasing:d?.smartCasing??!0}),this.model=new _a(t,this),this.ir=C.IR.IntermediateRepresentation(t)?t:{},this.dir=C.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 Ue=class{constructor(t){m(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 Fa=class extends Ue{constructor({context:r}){super(r.generation);m(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:v.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,value:r.value});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});case"optional":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as});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:Q(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,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:v.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertLiteral({literal:r,value:i,fallbackToDefault:o}){switch(r.type){case"boolean":{let c=this.context.getValueAsBoolean({value:i});return c==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(c)}case"string":{let c=this.context.getValueAsString({value:i});return c==null?o?this.Primitive.string.getDeterminsticDefault(o):this.csharp.Literal.nop():this.csharp.Literal.string(c)}default:Q(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,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:v.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:v.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,d])=>{this.context.errors.scope(c);try{return{key:this.convert({typeReference:r.key,value:c,as:"key"}),value:this.convert({typeReference:r.value,value:d})}}finally{this.context.errors.unscope()}})})}convertNamed({named:r,value:i,as:o,fallbackToDefault:c}){switch(r.type){case"alias":return 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:Q(r)}}convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:o}){let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),d=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:i});if(d==null)return this.csharp.Literal.nop();let y=d.singleDiscriminatedUnionType,g=this.getBaseProperties({discriminatedUnionTypeInstance:d,singleDiscriminatedUnionType:y});switch(y.type){case"samePropertiesAsObject":{let x=this.context.resolveNamedType({typeId:y.typeId});return x==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:g,arguments_:[this.convertNamed({named:x,value:d.value})]})}case"singleProperty":{if(this.context.getRecord(d.value)==null)return this.csharp.Literal.nop();try{let S=["Value","Type"].includes(y.discriminantValue.name.pascalCase.safeName)?`${y.discriminantValue.name.pascalCase.safeName}Inner`:y.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(y.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:g,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:S,enclosingType:c}),arguments_:[this.convert({typeReference:y.typeReference,value:y.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:g,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:d.discriminantValue,enclosingType:c}),arguments_:[]})]});default:Q(y)}}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(d=>{d.write(c," "),d.pushScope();for(let y of o)d.write(y.name," = ",y.assignment,",");d.popScope(!1)}))}getEnumValue(r,i){if(typeof i!="string")return this.context.errors.add({severity:v.Critical,message:`Expected enum value string, got: ${typeof i}`}),this.csharp.Literal.nop();let o=r.values.find(y=>y.wireValue===i);if(o==null)return this.context.errors.add({severity:v.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)}),d=c.registerField(this.model.getPropertyNameFor(o),o);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:c,value:d}))}convertObject({object_:r,value:i,fallbackToDefault:o}){let c=this.context.getRecord(i)??{},y=this.context.associateByWireValue({parameters:r.properties,values:c}).map(x=>{this.context.errors.scope(x.name.wireValue);try{return{name:this.context.getClassName(x.name.name),value:this.convert(x)}}finally{this.context.errors.unscope()}}),g=new Set(Object.keys(c));for(let x of r.properties){let S=this.context.getClassName(x.name.name);if(g.has(x.name.wireValue)){if(this.isRequiredProperty(x.typeReference)){let A=y.find(O=>O.name===S);if(A!=null&&C.Literal.nop(A.value)){let O=this.getDefaultLiteralForType(x.typeReference);O!=null&&(A.value=O)}}continue}if(this.isRequiredProperty(x.typeReference)){let A=this.getDefaultLiteralForType(x.typeReference);A!=null&&y.push({name:S,value:A})}}return this.csharp.Literal.class_({reference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),fields:y})}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 d=[];for(let y of r.properties)if(this.isRequiredProperty(y.typeReference)){let g=this.getDefaultLiteralForType(y.typeReference,c);g!=null&&d.push({name:this.context.getClassName(y.name.name),value:g})}return c.delete(i),this.csharp.Literal.class_({reference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),fields:d})}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:Q(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 d=this.convert({typeReference:o,value:i});if(C.Literal.nop(d)||this.context.errors.size()>c){this.context.errors.truncate(c);continue}return{valueTypeReference:o,typeLiteral:d}}catch{this.context.errors.truncate(c);continue}}this.context.errors.add({severity:v.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 d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.integer.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.integer(d)}case"LONG":{let d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.long.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.long(d)}case"UINT":{let d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.uint.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.uint(d)}case"UINT_64":{let d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.ulong.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.ulong(d)}case"FLOAT":{let d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.float.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.float(d)}case"DOUBLE":{let d=this.getValueAsNumber({value:i,as:o});return d==null?c?this.Primitive.double.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.double(d)}case"BOOLEAN":{let d=this.getValueAsBoolean({value:i,as:o});return d==null?c?this.Primitive.boolean.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.boolean(d)}case"STRING":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(d)}case"DATE":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Value.dateOnly.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.date(d)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Value.dateTime.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.datetime(d)}case"UUID":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(d)}case"BASE_64":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(d)}case"BIG_INTEGER":{let d=this.context.getValueAsString({value:i});return d==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(d)}default:Q(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 La=class extends Ue{constructor({context:r}){super(r.generation);m(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})}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:Q(r.typeReference)}}convertToClassReference(r){return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)})}convertNamed({named:r}){switch(r.type){case"alias":return this.convert({typeReference:r.typeReference});case"enum":case"object":return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.Primitive.object;case"undiscriminatedUnion":return this.settings.shouldGenerateUndiscriminatedUnions?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.OneOf.OneOf(r.types.map(i=>this.convert({typeReference:i})));default:Q(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:Q(r)}}};n();a();s();var ja=class extends Ue{constructor({context:r}){super(r.generation);m(this,"context");this.context=r}getFilePropertyInfo({body:r,value:i}){let o={fileFields:[],bodyPropertyFields:[]},c=this.context.getRecord(i)??{};for(let d of r.properties)switch(d.type){case"file":C.Record.missingKey(c,d.wireValue)&&(c[d.wireValue]="[bytes]"),o.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getSingleFileProperty({property:d,record:c})});break;case"fileArray":C.Record.missingKey(c,d.wireValue)&&(c[d.wireValue]=["[bytes]"]),o.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getArrayFileProperty({property:d,record:c})});break;case"bodyProperty":if(C.Record.missingKey(c,d.name.wireValue))switch(d.typeReference.type){case"optional":break;case"primitive":{switch(d.typeReference.value.toLowerCase()){case"integer":{c[d.name.wireValue]=123;break}case"string":{c[d.name.wireValue]="[string]";break}case"boolean":{c[d.name.wireValue]=!0;break}case"double":{c[d.name.wireValue]=123.456;break}case"float":{c[d.name.wireValue]=123.456;break}case"long":{c[d.name.wireValue]=123456789;break}case"uint":{c[d.name.wireValue]=123;break}case"uint64":{c[d.name.wireValue]=12345;break}case"date":{c[d.name.wireValue]=new Date(2021,1,1);break}case"datetime":{c[d.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{c[d.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{c[d.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{c[d.name.wireValue]="12345678901234567890";break}}break}default:break}o.bodyPropertyFields.push({name:this.context.getPropertyName(d.name.name),value:this.getBodyProperty({property:d,record:c})});break;default:Q(d)}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 Da=class e extends pi{constructor({ir:r,config:i,options:o,generation:c}){super({ir:r,config:i,options:o});m(this,"ir");m(this,"dynamicTypeMapper");m(this,"dynamicLiteralMapper");m(this,"filePropertyMapper");m(this,"generation");this.ir=r,this.generation=c??new Xi(r,i.workspaceName,i.customConfig!=null?i.customConfig:{},i),this.dynamicTypeMapper=new La({context:this}),this.dynamicLiteralMapper=new Fa({context:this}),this.filePropertyMapper=new ja({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}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)});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 d of c)switch(d.request.type){case"inlined":this.csharp.classReference({origin:d.request.declaration.name,namespace:this.getNamespace(d.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClientForSnippets,this.csharp.freezeClassReferences()}};n();a();s();var Ua=class extends Ue{constructor({context:r}){super(r.generation);m(this,"context");this.context=r}async generateSnippet({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Usage",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:"Usage",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&&C.DynamicIR.EndpointExample(i)&&!r.examples.find(y=>y.id===i.id))throw new Error("Endpoint does not have an example that matches the snippet");let c=this.csharp.codeblock(y=>{y.writeNodeStatement(this.constructClient({endpoint:r,snippet:i})),y.newLine(),y.writeNodeStatement(this.callMethod({endpoint:r,snippet:i}))}),d=this.getStyle(o);switch(d){case Tt.Concise:return c;case Tt.Full:return this.buildFullCodeBlock({body:c,options:o});default:Q(d)}}buildFullCodeBlock({body:r,options:i}){let o=this.getConfig(i),c=this.csharp.class_({name:o.fullStyleClassName??"Example",namespace:"Usage",access:Hr.Access.Public});return c.addNamespaceReference(this.Types.RootClientForSnippets.namespace),c.addMethod({name:"Do",access:Hr.Access.Public,isAsync:!0,parameters:[],body:r}),c}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(d=>{d.write("await foreach (var item in "),d.writeNode(c),d.writeLine(")"),d.pushScope(),d.writeLine("/* consume each item */"),d.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:v.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let c=[],d=this.getConstructorBaseUrlArgs({baseUrl:i.baseURL,environment:i.environment});d.length>0&&c.push(...d),this.context.errors.scope(Be.Headers);let y=[];if(this.context.ir.headers!=null&&i.headers!=null&&y.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:i.headers})),this.context.errors.unscope(),this.settings.unifiedClientOptions){let g=[...o.map(x=>({name:xe(x.name),assignment:x.assignment})),...y.map(x=>({name:xe(x.name),assignment:x.assignment})),...c.map(x=>({name:x.name,assignment:x.assignment}))];return g.length===0?[]:[{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:g,multiline:!0})}]}return c.length===0?[...o,...y]:[...o,...y,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:c.map(g=>({name:g.name,assignment:g.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:r,environment:i}){let o=this.getBaseUrlArg({baseUrl:r,environment:i});return C.Literal.nop(o)?[]:[{name:this.getBaseUrlOptionName(),assignment:o}]}getBaseUrlArg({baseUrl:r,environment:i}){if(r!=null&&i!=null)return this.context.errors.add({severity:v.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:v.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:v.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:xe(Lt(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:Q(r)}}addError(r){this.context.errors.add({severity:v.Critical,message:r})}addWarning(r){this.context.errors.add({severity:v.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:i}){let o=r,c=!!o.usernameOmit,d=!!o.passwordOmit,y=[];return c||y.push({name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(i.username)}),d||y.push({name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(i.password)}),y}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 d=c.name.wireValue,y=i.values?.[d];o.push({name:this.context.getParameterName(c.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:c.typeReference,value:y,fallbackToDefault:d})})}else this.context.errors.add({severity:v.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 d=i[c.name.wireValue],y=this.getConstructorHeaderArg({header:c,value:d});y!=null&&o.push({name:this.context.getParameterName(c.name.name),assignment:y})}return o}getConstructorHeaderArg({header:r,value:i}){let o=this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:i,fallbackToDefault:r.name.wireValue});if(!C.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:Q(r.request)}}getMethodArgsForInlinedRequest({request:r,snippet:i}){let o=[];this.context.errors.scope(Be.PathParameters);let c=[],d=[...this.context.ir.pathParameters??[],...r.pathParameters??[]];d.length>0&&c.push(...this.getPathParameters({namedParameters:d,snippet:i})),this.context.errors.unscope(),this.context.errors.scope(Be.RequestBody);let y=this.getFilePropertyInfo({request:r,snippet:i});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})||o.push(...c.map(g=>g.value)),o.push(this.getInlinedRequestArg({request:r,snippet:i,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})?c:[],filePropertyInfo:y})),o}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}){this.context.errors.scope(Be.QueryParameters);let y=this.context.associateQueryParametersByWireValue({parameters:r.queryParameters??[],values:i.queryParameters??{}}).map(A=>({name:this.context.getPropertyName(A.name.name),value:this.context.dynamicLiteralMapper.convert(A)}));this.context.errors.unscope(),this.context.errors.scope(Be.Headers);let x=this.context.associateByWireValue({parameters:r.headers??[],values:i.headers??{}}).map(A=>({name:this.context.getPropertyName(A.name.name),value:this.context.dynamicLiteralMapper.convert({...A,fallbackToDefault:A.name.wireValue})}));this.context.errors.unscope(),this.context.errors.scope(Be.RequestBody);let S=r.body!=null?this.getInlinedRequestBodyConstructorFields({body:r.body,value:i.requestBody,filePropertyInfo:c}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),fields:[...o,...y,...x,...S]})}getInlinedRequestBodyConstructorFields({body:r,value:i,filePropertyInfo:o}){switch(r.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:r.value,value:i});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:r,value:i})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:o});default:Q(r)}}getInlinedRequestBodyPropertyConstructorFields({parameters:r,value:i}){let o=[],c=this.context.associateByWireValue({parameters:r,values:this.context.getRecord(i)??{}});for(let d of c)o.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicLiteralMapper.convert({...d,fallbackToDefault:d.name.wireValue})});return o}getFileUploadRequestBodyConstructorFields({filePropertyInfo:r}){return[...r.fileFields,...r.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:r,value:i}){return{name:this.context.getPropertyName(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:Q(r)}}getMethodArgsForBodyRequest({request:r,snippet:i}){let o=[];this.context.errors.scope(Be.PathParameters);let c=[...this.context.ir.pathParameters??[],...r.pathParameters??[]];return c.length>0&&o.push(...this.getPathParameters({namedParameters:c,snippet:i}).map(d=>d.value)),this.context.errors.unscope(),this.context.errors.scope(Be.RequestBody),r.body!=null&&o.push(this.getBodyRequestArg({body:r.body,value:i.requestBody})),this.context.errors.unscope(),o}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:Q(r)}}getBytesBodyRequestArg({value:r}){let i=this.context.getValueAsString({value:r});return i==null&&(this.context.errors.add({severity:v.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 d of c)o.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicLiteralMapper.convert({...d,fallbackToDefault:d.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??Tt.Full}getConfig(r){return r.config??this.context.options.config??{}}};var nu=class extends oi{constructor({ir:t,config:r,options:i={}}){super(new Da({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 Ua({context:t})}};export{nu as DynamicSnippetsGenerator};
|
|
34
34
|
/*! Bundled license information:
|
|
35
35
|
|
|
36
36
|
lodash-es/lodash.js:
|