@fern-api/csharp-dynamic-snippets 2.63.3 → 2.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.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.cjs
CHANGED
|
@@ -30,7 +30,7 @@ ${Bi(this).map(r=>` ${r.fn} - ${r.path}:${r.position}`).join(`
|
|
|
30
30
|
`),this.hasSameAccess(this.init)||r.write(`${this.init} `),r.writeTextStatement("init"),r.writeNoIndent(`#else
|
|
31
31
|
`),r.writeTextStatement("set"),r.writeNoIndent(`#endif
|
|
32
32
|
`)):(this.hasSameAccess(this.init)||r.write(`${this.init} `),this.accessors?.init?(r.write("init"),r.write(" => "),this.accessors.init(r),r.writeTextStatement("")):r.write("init; "))),this.set&&(this.hasSameAccess(this.set)||r.write(`${this.set} `),this.accessors?.set?(r.write("set"),r.write(" => "),this.accessors.set(r),r.writeTextStatement("")):r.write("set; ")),r.write("}")),this.initializer!=null?(c?r.write(" => "):r.write(" = "),this.initializer.write(r),r.writeLine(";")):!this.skipDefaultInitializer&&!i&&o?v.Type(this.type)&&this.type.writeEmptyCollectionInitializer(r):!this.get&&!this.init&&r.writeLine(";")}hasSameAccess(r){return r===!0||r===this.access}};n();a();s();var Xe;(function(e){e[e.INSTANCE=0]="INSTANCE",e[e.STATIC=1]="STATIC"})(Xe||(Xe={}));var zt=class e extends Ot{constructor({name:r,isAsync:i,override:o,access:c,return_:p,body:x,noBody:w,bodyType:I,summary:A,doc:P,type:F,classReference:N,parameters:j,typeParameters:M,annotations:D,codeExample:G,interfaceReference:Q,origin:oe,enclosingType:X},K){super({enclosingType:X},oe,K);y(this,"name");y(this,"isAsync");y(this,"access");y(this,"return");y(this,"noBody");y(this,"body");y(this,"bodyType");y(this,"summary");y(this,"doc");y(this,"type");y(this,"reference");y(this,"override");y(this,"parameters");y(this,"typeParameters");y(this,"annotations");y(this,"interfaceReference");this.name=r,this.isAsync=i??!1,this.override=o??!1,this.access=c,this.return=p,this.noBody=w??!1,this.body=x,this.bodyType=I??e.BodyType.Statement,this.summary=A,this.doc=this.csharp.xmlDocBlockOf(P??{summary:A,codeExample:G}),this.type=F??Xe.INSTANCE,this.reference=N,this.parameters=j??[],this.typeParameters=M??[],this.annotations=(D??[]).map(C=>C instanceof _e?this.csharp.annotation({reference:C}):C),this.interfaceReference=Q}get isAsyncEnumerable(){return v.AsyncEnumerable(this.return)}addParameter(r){return r instanceof Ye||(r=new Ye(r,this.generation)),this.parameters.push(r),r}write(r){if(r.writeNode(this.doc),this.annotations.forEach(i=>{i.write(r)}),r.writeNewLineIfLastLineNot(),this.access&&r.write(`${this.access} `),this.type===Xe.STATIC&&r.write("static "),this.isAsync&&r.write("async "),this.override&&r.write("override "),this.return==null?this.isAsync?(r.writeNode(this.System.Threading.Tasks.Task()),r.write(" ")):r.write("void "):(this.isAsync&&!this.isAsyncEnumerable?r.writeNode(this.System.Threading.Tasks.Task(this.return)):this.return.write(r),r.write(" ")),this.interfaceReference&&r.write(`${this.interfaceReference.name}.`),r.write(this.name),this.typeParameters.length>0&&(r.write("<"),this.typeParameters.forEach((i,o)=>{i.write(r),o<this.typeParameters.length-1&&r.write(", ")}),r.write(">")),r.write("("),this.parameters.forEach((i,o)=>{i.write(r),o<this.parameters.length-1&&r.write(", ")}),r.write(")"),this.noBody)r.writeLine(";");else switch(this.bodyType){case e.BodyType.Statement:r.write(" "),r.pushScope(),this.body?.write(r),r.popScope();break;case e.BodyType.Expression:r.write(" => "),this.body?.write(r),r.writeSemicolonIfLastCharacterIsNot();break;default:ue(this.bodyType)}}getParameters(){return this.parameters}};(function(e){e.BodyType={Statement:"statement",Expression:"expression"}})(zt||(zt={}));var xi=class extends Be{constructor({name:r,namespace:i,access:o,partial:c,interfaceReferences:p,enclosingType:x,origin:w},I){super(w,I);y(this,"access");y(this,"partial");y(this,"reference");y(this,"interfaceReferences");y(this,"fields",[]);y(this,"methods",[]);r=r||(w?this.model.getClassNameFor(w):de("Class/Interface name or origin is required")),this.reference=x?this.csharp.classReference({name:r,enclosingType:x}):this.csharp.classReference({name:r,namespace:i||de("Class/Interface: Namespace or enclosingType is required ")}),this.access=o,this.partial=c??!1,this.interfaceReferences=p??[]}get name(){return this.reference.name}get namespace(){return this.reference.namespace}get enclosingType(){return this.reference.enclosingType}get isNested(){return this.enclosingType!=null}explicit(r){return this.origin?this.model.explicit(v.Provenance(this.origin)?this.origin.node:this.origin,r):de(`Cannot create explicit named member '${r}' on '${this.name}' because the class is not bound to an origin.`)}getField(r){return this.fields.find(i=>this.model.provenance(i.origin)?.jsonPath===r.jsonPath)}addField(r){r.enclosingType=this.reference;let i=new bi(r,this.generation);return this.fields.push(i),i}addMethod(r){r.enclosingType=this.reference;let i=new zt(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 We(this,this.generation)}asNullable(){return new rr(this,this.generation)}asNonOptional(){return this}get defaultValue(){return this.csharp.Literal.null()}get fullyQualifiedName(){return this.reference.fullyQualifiedName}};var ve=class ve extends xi{constructor({name:r,namespace:i,access:o,static_:c,abstract_:p,sealed:x,partial:w,readonly:I,parentClassReference:A,interfaceReferences:P,enclosingType:F,type:N,summary:j,doc:M,annotations:D,primaryConstructor:G,skipNamespaceDeclaration:Q,origin:oe},X){super({name:r,namespace:i,access:o,partial:w,interfaceReferences:P,enclosingType:F,origin:oe},X);y(this,"static_");y(this,"abstract_");y(this,"sealed");y(this,"readonly");y(this,"parentClassReference");y(this,"type");y(this,"summary");y(this,"doc");y(this,"annotations",[]);y(this,"primaryConstructor");y(this,"namespaceReferences",[]);y(this,"skipNamespaceDeclaration");y(this,"constructors",[]);y(this,"operators",[]);y(this,"nestedClasses",[]);y(this,"nestedInterfaces",[]);y(this,"rawBodyBlocks",[]);this.skipNamespaceDeclaration=Q??!1,this.static_=c??!1,this.abstract_=p??!1,this.sealed=x??!1,this.readonly=I??!1,this.type=N??ve.ClassType.Class,this.summary=j,this.doc=this.csharp.xmlDocBlockOf(M??{summary:j}),this.parentClassReference=A,this.annotations=(D??[]).map(K=>K instanceof _e?this.csharp.annotation({reference:K}):K),this.primaryConstructor=G}addConstructor(r){let i=new ve.Constructor(r,this.generation);return this.constructors.push(i),i}addNestedClass(r){if(r instanceof ve||(r.enclosingType=this.reference,r=new ve(r,this.generation)),!r.isNested)throw new Error(`Set the enclosingType of the class ${this.name} to add the nested class ${r.name}.`);return this.nestedClasses.push(r),r}addNestedClasses(r){r.forEach(i=>{i instanceof ve?this.addNestedClass(i):this.addNestedClass(i)})}addAnnotation(r){return r instanceof yt||(r=new yt(r,this.generation)),this.annotations.push(r),r}addOperator(r){this.operators.push(r)}addOperators(r){r.forEach(i=>this.addOperator(i))}addRawBodyContent(r){this.rawBodyBlocks.push(r)}write(r){if(this.namespaceReferences.forEach(i=>{r.addNamespace(i)}),!this.isNested&&!this.skipNamespaceDeclaration&&(r.writeLine(`namespace ${this.namespace};`),r.newLine()),r.writeNode(this.doc),this.annotations.forEach(i=>{i.write(r)}),this.skipNamespaceDeclaration||r.writeNewLineIfLastLineNot(),r.write(`${this.access}`),this.static_&&r.write(" static"),this.abstract_&&r.write(" abstract"),this.sealed&&r.write(" sealed"),this.readonly&&r.write(" readonly"),this.partial&&r.write(" partial"),r.write(` ${this.type}`),r.write(` ${this.name}`),this.primaryConstructor!=null&&this.primaryConstructor.parameters.length>0){let i=this.primaryConstructor;r.write("("),i.parameters.forEach((o,c)=>{c>0&&r.write(","),o.write(r)}),r.write(")")}if(this.parentClassReference!=null||this.interfaceReferences.length>0){if(r.write(" : "),this.parentClassReference!=null&&(this.parentClassReference.write(r),this.interfaceReferences.length>0&&r.write(", ")),this.primaryConstructor!=null&&this.primaryConstructor.superClassArguments.length>0){let i=this.primaryConstructor;r.write("("),this.primaryConstructor.superClassArguments.forEach((o,c)=>{o.write(r),c<i.superClassArguments.length-1&&r.write(", ")}),r.write(")")}this.interfaceReferences.forEach((i,o)=>{i.write(r),o<this.interfaceReferences.length-1&&r.write(", ")})}if(!this.hasBody()){r.write(";");return}r.writeNewLineIfLastLineNot(),r.pushScope(),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(Si).sort(Hu).filter(this.fieldConstFilter())})}writeFieldFields(r){this.writeFields({writer:r,fields:this.getFields().sort(Si).sort(Hu).filter(this.fieldFieldFilter())})}writeProperties(r){this.writeFields({writer:r,fields:this.getFields().sort(Si).sort(Hu).filter(this.fieldPropertyFilter())})}writeMethods(r){this.methods.sort(Si).sort(jy).sort(Ly).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(Si).forEach((i,o)=>{i.write(r),r.writeNewLineIfLastLineNot(),o<this.fields.length-1&&r.newLine()})}writeNestedInterfaces(r){this.nestedInterfaces.sort(Si).forEach((i,o)=>{i.write(r),r.writeNewLineIfLastLineNot(),o<this.fields.length-1&&r.newLine()})}fieldConstFilter(){return r=>r.isConst}fieldFieldFilter(){return r=>r.isField}fieldPropertyFilter(){return r=>r.isProperty}getFields(){return this.fields}get isReferenceType(){return this.type===ve.ClassType.Class||this.type===ve.ClassType.Record}writeOperator({writer:r,operator:i}){if(r.write("public static "),i.type===ve.CastOperator.Type.Explicit||i.type===ve.CastOperator.Type.Implicit){r.write(`${i.type} `),r.write("operator ");let o=i.to??this.reference;r.writeNode(o),r.write("("),i.parameter.write(r)}else{let o=i;o.return.write(r),r.write(" operator "),r.write(`${i.type}(`),o.parameters.forEach((c,p)=>{c.write(r),p<o.parameters.length-1&&r.write(", ")})}i.useExpressionBody?(r.write(") => "),r.writeNodeStatement(i.body)):(r.write(") {"),r.writeNode(i.body),r.writeLine("}"))}addNamespaceReference(r){this.namespaceReferences.push(r)}};y(ve,"ClassType",{Class:"class",Record:"record",Struct:"struct",RecordStruct:"record struct"}),y(ve,"Access",ge);var it=ve;(function(e){class t{constructor({doc:o,body:c,parameters:p,access:x,baseConstructorCall:w,annotations:I},A){y(this,"generation");y(this,"doc");y(this,"body");y(this,"parameters");y(this,"access");y(this,"baseConstructorCall");y(this,"annotations");this.generation=A,this.parameters=p??[],this.access=x??ge.Public,this.doc=o,this.annotations=I??[],this.body=new Ut({},this.generation),c!=null&&this.body.append(c),this.baseConstructorCall=w}addParameter(o){let c=new Ye(o,this.generation);return this.parameters.push(c),c}}e.Constructor=t;let r;(function(i){i.Type={Implicit:"implicit",Explicit:"explicit"}})(r=e.CastOperator||(e.CastOperator={}))})(it||(it={}));function Hm(e){switch(e){case void 0:return 0;case ge.Private:return 1;case ge.Protected:return 2;case ge.Internal:return 3;case ge.Public:return 4}}function Si(e,t){return Hm(e.access)-Hm(t.access)}function Hu(e,t){return e.isStatic===t.isStatic?0:e.isStatic?-1:1}function Ly(e,t){return e.type===Xe.STATIC&&t.type!==Xe.STATIC?-1:e.type!==Xe.STATIC&&t.type===Xe.STATIC?1:0}function jy(e,t){return e.name==="FromProto"||e.name==="ToProto"?t.name==="Equals"||t.name==="ToString"?-1:1:t.name==="FromProto"||t.name==="ToProto"?e.name==="Equals"||e.name==="ToString"?1:-1:e.name==="ToString"?1:t.name==="ToString"?-1:e.name==="Equals"?t.name==="ToString"?-1:1:t.name==="Equals"?e.name==="ToString"?1:-1:0}n();a();s();var wi=class extends Be{constructor({name:r,namespace:i,access:o,annotations:c,origin:p},x){super(p,x);y(this,"access");y(this,"reference");y(this,"annotations");y(this,"fields",[]);y(this,"generateSerializer",!1);y(this,"serializerClassReference");this.reference=this.csharp.classReference({name:r,namespace:i,origin:p}),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 Ti=class extends xi{constructor({name:t,namespace:r,access:i,partial:o,interfaceReferences:c,enclosingType:p,origin:x},w){super({name:t,namespace:r,access:i,partial:o,interfaceReferences:c,enclosingType:p,origin:x},w)}write(t){this.isNested||(t.writeLine(`namespace ${this.namespace};`),t.newLine()),t.write(`${this.access} `),this.partial&&t.write("partial "),t.write("interface "),t.writeLine(`${this.name}`),this.interfaceReferences.length>0&&(t.write(" : "),this.interfaceReferences.forEach((r,i)=>{r.write(t),i<this.interfaceReferences.length-1&&t.write(", ")})),t.pushScope();for(let r of this.fields)r.write(t),t.writeLine("");t.dedent(),t.indent();for(let r of this.methods)r.write(t),t.writeLine("");t.popScope()}};n();a();s();var Ei=class extends Be{constructor({name:r,namespace:i,parentClassReference:o,origin:c},p){super(c,p);y(this,"reference");y(this,"parentClassReference");y(this,"testMethods",[]);this.reference=this.csharp.classReference({name:r,namespace:i,origin:c}),this.parentClassReference=o}get name(){return this.reference.name}get namespace(){return this.reference.namespace}write(r){r.writeNode(this.getClass())}getClass(){let r=[this.NUnit.Framework.TestFixture,this.csharp.annotation({reference:this.NUnit.Framework.Parallelizable,argument:"ParallelScope.Self"})],i=new it({access:ge.Public,name:this.name,namespace:this.namespace,annotations:r,parentClassReference:this.parentClassReference,origin:this.origin},this.generation);for(let o of this.testMethods)i.addMethod({access:ge.Public,isAsync:o.isAsync,name:o.name,parameters:[],body:o.body,annotations:[this.NUnit.Framework.Test]});return i}addTestMethod(r){this.testMethods.push(r)}};n();a();s();n();a();s();n();a();s();n();a();s();var Ju={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 By=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 Dy=new Set(["from","where","select","orderby","groupby","into","let","join","on","equals"]),Uy=new Set(["async","await"]),My=new Set(["yield"]),vy=new Set(["var","dynamic"]),Vy=new Set(["using","alias"]);var zy=new Set(["required","scoped","unmanaged","managed"]),qy=new Set(["when","and","or","not"]),Gy=new Set(["Equals","GetHashCode","ToString","GetType","MemberwiseClone","Finalize"]),Wy=new Set([...By,...Dy,...Uy,...My,...vy,...Vy,...zy,...qy]),fo=class{constructor(t,r,i){y(this,"registry");y(this,"name");y(this,"jsonPath");this.registry=t,this.name=r,this.jsonPath=i}};var mo=class{constructor(t){y(this,"scope");y(this,"byName",new Map);y(this,"byPath",new Map);y(this,"redirections",new Map);this.scope=t}[Symbol.iterator](){return this.byName.values()}has(t){return this.byName.has(t)}getByJsonPath(t){return this.byPath.get(t)}getByName(t){return this.byName.get(t)}getRedirectedName(t){return this.redirections.get(t)}set(t){this.byName.has(t.name)&&de(`set: ${t.name} in ${this.scope.fullyQualifiedName} already exists`),t.jsonPath&&this.byPath.has(t.jsonPath)&&de(`set: ${t.name} in ${this.scope.fullyQualifiedName} already exists by jsonPath`),this.byName.set(t.name,t),t.jsonPath&&this.byPath.set(t.jsonPath,t)}redirect(t,r){this.redirections.has(t)&&de(`redirect: ${t} in ${this.scope.fullyQualifiedName} already has a redirect`),this.redirections.set(t,r)}},Ku=class extends fo{constructor(r,i,o,c){super(r,i);y(this,"namespace");y(this,"fullyQualifiedName");y(this,"fields");y(this,"methods");this.namespace=o,this.fullyQualifiedName=c,this.fields=new mo(this),this.methods=new mo(this)}isKeyword(r){return Wy.has(r)}isBuiltinMemberName(r){return Gy.has(r)}isTypeName(r){return this.name===r}isField(r){return this.fields.has(r)}isMethod(r){return this.methods.has(r)}isMember(r){return this.isField(r)||this.isMethod(r)}nameBlocked(r){if(this.isKeyword(r))return"keyword";if(this.isBuiltinMemberName(r))return"builtin";if(this.isTypeName(r))return"typeName";if(this.isField(r))return"field";if(this.isMethod(r))return"method"}getAlternativeName(r){let i=`${r}_`,o=2;for(;this.nameBlocked(i);)i=`${r}_${o}`,o++;return i}getFieldByJsonPath(r){return r!==void 0?this.fields.getByJsonPath(r):void 0}getFieldByName(r){return this.fields.getByName(r)}getRedirectedFieldName(r){return this.fields.getRedirectedName(r)}registerField(r,i,o){let c=this.registry.model.jsonPath(i);if(c){let w=this.fields.getByJsonPath(c);if(w)return w.name}let p=this.fields.getByName(r);if(p&&c===p.jsonPath)return r;switch(this.nameBlocked(r)){case"field":i&&v.Provenance(i)&&i.explicit||de(`Field ${r} already exists - attempting to add a duplicate field with the same name that is not an explicitly named property`);break;case"keyword":case"builtin":case"typeName":case"method":break;default:return this.fields.set(new ho(this.registry,r,this,c,o)),this.registry.setFieldNameShortcut(c,r),r}let x=this.getAlternativeName(r);return this.fields.set(new ho(this.registry,x,this,c,o)),this.fields.redirect(r,x),this.registry.setFieldNameShortcut(c,x),x}getFieldName(r,i){let o=this.getFieldByJsonPath(this.registry.model.jsonPath(r))?.name;if(o)return o;if(v.Provenance(r)){let x=this.getRedirectedFieldName(i);if(x)return x;let w=this.getFieldByName(i);return w?this.registry.model.provenance(w.jsonPath)?.explicit?i:`${i}_`:i}let c=this.getFieldByName(i);if(c)return this.registry.model.provenance(c.jsonPath)?.explicit?i:c.name;let p=this.getRedirectedFieldName(i);if(p)return p;this.isMethod(i)}},Qu=class extends fo{constructor(r,i,o,c){super(r,i,c);y(this,"scope");this.scope=o}},ho=class extends Qu{constructor(r,i,o,c,p){super(r,i,o,c);y(this,"field");this.field=p}};var Ai=class e{constructor(t){y(this,"generation");y(this,"classReferenceByJsonPath",new Map);y(this,"typeRegistry",new Map);y(this,"namespaceRegistry",new Map);y(this,"typeNames",new Map);y(this,"namespaceNames",new Map);y(this,"implicitNamespaces",new Set);y(this,"shortcuts",new Map);y(this,"knownBuiltInIdentifiers",new Set(["Text","Json","Xml","Security","Collections","Data","Diagnostics","Globalization","Math","Reflection","Runtime","Security","Serialization","Threading","Xml"]));this.generation=t,this.initializeBuiltIns()}get csharp(){return this.generation.csharp}get model(){return this.generation.model}initializeBuiltIns(){for(let[t,r]of Object.entries(Ju))t.split(".").forEach(i=>this.knownBuiltInIdentifiers.add(i)),r.forEach(i=>this.knownBuiltInIdentifiers.add(i));for(let[t,r]of Object.entries(Ju)){for(let o of r)this.typeNames.set(o,new Set([t]));let i=t.split(".")[0];i&&this.typeNames.set(i,new Set([t]))}this.typeNames.set("System",new Set(["System"])),this.typeNames.set("NUnit",new Set(["NUnit"])),this.typeNames.set("OneOf",new Set(["OneOf"])),this.knownBuiltInIdentifiers.add("NUnit"),this.knownBuiltInIdentifiers.add("OneOf")}setFieldNameShortcut(t,r){if(t){let i=this.shortcuts.get(t);i&&i!==r&&de(`BAD_BAD_BAD setFieldNameShortcut: ${t} already has a name: ${i} - while setting to ${r} - if this is happening, then you could be getting back the wrong name later!`),this.shortcuts.set(t,r)}}getFieldNameByOrigin(t){return this.shortcuts.get(this.model.jsonPath(t)??">ignore<")}isKnownBuiltInIdentifier(t){return!t||typeof t!="string"?!1:this.knownBuiltInIdentifiers.has(t)}isKnownNamespace(t){return!t||typeof t!="string"?!1:this.namespaceRegistry.has(t)}isRegisteredTypeName(t){return this.typeRegistry.has(t)}isAmbiguousTypeName(t){return t?(this.typeNames.get(t)?.size??0)>1:!1}isAmbiguousNamespaceName(t){return t?(this.namespaceNames.get(t)?.size??0)>1:!1}hasTypeNamespaceConflict(t){return!t||this.knownBuiltInIdentifiers.has(t)?!1:this.typeNames.has(t)&&(this.namespaceNames.get(t)?.has("")??!1)}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:p,origin:x}=t;if(x){let w=this.model.jsonPath(x)??de(`JsonPath not found for origin: ${JSON.stringify(x).substring(0,100)}`);this.classReferenceByJsonPath.set(w,t)}if(r&&r!==p&&!this.typeRegistry.has(r)&&this.typeRegistry.set(r,t),!this.typeRegistry.has(p)){this.typeRegistry.set(p,t);for(let w of this.allNamespacesOf(o))this.registerNamespace(w,w);c||this.trackTypeName(i,o);for(let w of[this.generation.namespaces.root,...this.implicitNamespaces])if(o.startsWith(w)){let I=o.split(".")[w.split(".").length];I&&this.trackTypeName(I,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:p}=t,x=this.model.jsonPath(p),w=(x?this.classReferenceByJsonPath.get(x):void 0)??this.typeRegistry.get(r),I=this.model.jsonPath(w?.origin),A=I&&x?I===x?"match":"mismatch":"no origin";if(w&&A!=="mismatch")return new _e({name:w.name,namespace:w.namespace,enclosingType:w.enclosingType,fullyQualifiedName:w.fullyQualifiedName,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,origin:w.origin??p,isCollection:w.isCollection,isReferenceType:w.isReferenceType,multipartMethodName:w.multipartMethodName,multipartMethodNameForCollection:w.multipartMethodNameForCollection},w.scope,this.generation);let P=!1,F=this.resolveNamespace(o);F!==o&&(o=F,P=!0);let N;e:for(;;){N=e.fullyQualifiedNameOf({name:i,namespace:o,enclosingType:c});let j="",M=o.split(".");for(let D=0;D<M.length;D++)if(j=j?`${j}.${M[D]}`:`${M[D]}`,this.typeRegistry.has(j)){M[D]=`${M[D]}_`,o=M.join("."),P=!0;continue e}if(P&&this.registerNamespace(t.namespace,o),A==="mismatch"&&w?.name===i){i=`${i}_`,P=!0;continue e}if(this.namespaceRegistry.has(N)){i=`${i}_`,P=!0;continue e}if(this.typeRegistry.has(N)){i=`${i}_`,P=!0;continue e}if(c){let D=N.replaceAll("+",".");if(this.typeRegistry.has(D)){i=`${i}_`,P=!0;continue e}if(this.namespaceRegistry.has(D)){i=`${i}_`,P=!0;continue e}}else{let D=N.split(".");for(let G=1;G<D.length;G++){let Q=D.slice(0,G).join(".")+"+"+D.slice(G).join("+");if(this.typeRegistry.has(Q)){i=`${i}_`,P=!0;continue e}}}break}return this.trackType(new _e({name:i,namespace:o,enclosingType:c,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,fullyQualifiedName:N,origin:p,isCollection:t.isCollection,isReferenceType:t.isReferenceType,multipartMethodName:t.multipartMethodName,multipartMethodNameForCollection:t.multipartMethodNameForCollection},new Ku(this,i,o,N),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 p=this.namespaceRegistry.get(c);if(p!==void 0){let x=i.slice(o).join("."),w=`${p}.${x}`;return this.registerNamespace(t,w),w}}}return t}canonicalizeNamespace(t){let r=this.namespaceRegistry.get(t);if(r!==void 0)return r;let i=!1,o=t;e:for(;;){let c="",p=o.split(".");for(let x=0;x<p.length;x++)if(c=c?`${c}.${p[x]}`:`${p[x]}`,this.typeRegistry.has(c)){p[x]=`${p[x]}_`,o=p.join("."),i=!0;continue e}break}return i&&this.registerNamespace(t,o),o}};var yo=class{constructor(t){y(this,"generation");y(this,"frozen",!1);y(this,"extraClassReferences",new Map);y(this,"InstantiatedPrimitive",{string:t=>new Ne({type:"string",value:t},this.generation),boolean:t=>new Ne({type:"boolean",value:t},this.generation),integer:t=>new Ne({type:"integer",value:t},this.generation),long:t=>new Ne({type:"long",value:t},this.generation),uint:t=>new Ne({type:"uint",value:t},this.generation),ulong:t=>new Ne({type:"ulong",value:t},this.generation),float:t=>new Ne({type:"float",value:t},this.generation),double:t=>new Ne({type:"double",value:t},this.generation),date:t=>new Ne({type:"date",value:t},this.generation),dateTime:(t,r=!0)=>new Ne({type:"dateTime",value:t,parse:r},this.generation),uuid:t=>new Ne({type:"uuid",value:t},this.generation),null:()=>new Ne({type:"null"},this.generation)});y(this,"Literal",{class_:({reference:t,fields:r})=>new J.Class_(t,r,this.generation),dictionary:({keyType:t,valueType:r,entries:i})=>new J.Dictionary(t,r,i,this.generation),list:({valueType:t,values:r})=>new J.List(t,r,this.generation),set:({valueType:t,values:r})=>new J.Set(t,r,this.generation),boolean:t=>new J.Boolean(t,this.generation),float:t=>new J.Float(t,this.generation),date:t=>new J.Date(t,this.generation),datetime:t=>new J.DateTime(t,this.generation),decimal:t=>new J.Decimal(t,this.generation),double:t=>new J.Double(t,this.generation),integer:t=>new J.Integer(t,this.generation),long:t=>new J.Long(t,this.generation),uint:t=>new J.Uint(t,this.generation),ulong:t=>new J.Ulong(t,this.generation),reference:t=>new J.Reference(t,this.generation),string:t=>new J.String(t,this.generation),null:()=>new J.Null(this.generation),nop:()=>new J.Nop(this.generation),unknown:t=>new J.Unknown(t,this.generation)});y(this,"VALID_READ_ONLY_MEMORY_TYPES",new Set(["int","long","uint","ulong","string","bool","float","double"]));this.generation=t}get model(){return this.generation.model}classReference(t){return this.classReferenceInternal(t)}classReferenceInternal(t){if(!t.name&&"origin"in t&&t.origin&&(t.name=this.model.getClassNameFor(t.origin)),t.enclosingType){if(t.namespace&&t.namespace!==t.enclosingType.namespace)throw new Error("ClassReference: Both enclosingType and namespace cannot be provided");t.namespace=t.enclosingType.namespace}let r=Ai.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
|
-
${ji()}`)}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 it(r,this.generation)}testClass(t){return new Ei(t,this.generation)}annotation(t){return new yt(t,this.generation)}annotationGroup(t){return new mi(t,this.generation)}instantiateClass(t){return new Qr(t,this.generation)}invokeMethod(t){return new ei(t,this.generation)}codeblock(t){return new Dt(t,this.generation)}code(){return new Ut({},this.generation)}anonymousFunction(t){return new di(t)}parameter(t){return new Ye(t,this.generation)}interface_(t){return new Ti(t,this.generation)}enum_(t){return new wi(t,this.generation)}dictionary(t){return new Yr(t,this.generation)}list(t){return new Zr(t,this.generation)}readOnlyMemory(t){return new ti(t,this.generation)}set(t){return new ri(t,this.generation)}switch_(t){return new yi(t,this.generation)}ternary(t){return new gi(t,this.generation)}and(t){return new fi(t,this.generation)}or(t){return new hi(t,this.generation)}enumInstantiation(t){return new Xr(t,this.generation)}string_(t){return new ii(t,this.generation)}xmlDocBlock(t){return new Vt(t,this.generation)}xmlDocBlockOf(t){return t instanceof Vt?t:new Vt(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 $(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 go=class{constructor(t){y(this,"generation");y(this,"System",$({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:()=>$({Serialization:()=>$({EnumMember:()=>this.csharp.classReference({name:"EnumMemberAttribute",namespace:"System.Runtime.Serialization"})})}),Collections:()=>$({Generic:()=>$({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:()=>$({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>$({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>$({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>$({Http:()=>$({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:()=>$({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>$({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>$({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:()=>$({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:()=>$({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:()=>$({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>$({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:()=>$({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>$({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:()=>$({INotifyPropertyChanged:()=>this.csharp.classReference({name:"INotifyPropertyChanged",namespace:"System.ComponentModel"}),PropertyChangedEventHandler:()=>this.csharp.classReference({name:"PropertyChangedEventHandler",namespace:"System.ComponentModel"})}),IAsyncDisposable:()=>this.csharp.classReference({name:"IAsyncDisposable",namespace:"System"}),IDisposable:()=>this.csharp.classReference({name:"IDisposable",namespace:"System"})}));y(this,"NUnit",$({Framework:()=>$({TestFixture:()=>this.csharp.classReference({name:"TestFixture",namespace:"NUnit.Framework"}),Test:()=>this.csharp.classReference({name:"Test",namespace:"NUnit.Framework"}),OneTimeTearDown:()=>this.csharp.classReference({name:"OneTimeTearDown",namespace:"NUnit.Framework"}),OneTimeSetUp:()=>this.csharp.classReference({name:"OneTimeSetUp",namespace:"NUnit.Framework"}),SetUpFixture:()=>this.csharp.classReference({name:"SetUpFixture",namespace:"NUnit.Framework"}),Parallelizable:()=>this.csharp.classReference({name:"Parallelizable",namespace:"NUnit.Framework"})})}));y(this,"OneOf",$({OneOf:t=>this.csharp.classReference({name:"OneOf",namespace:"OneOf",generics:t}),OneOfBase:t=>this.csharp.classReference({name:"OneOfBase",namespace:"OneOf",generics:t})}));y(this,"Google",$({Protobuf:()=>$({ByteString:()=>this.csharp.classReference({name:"ByteString",namespace:"Google.Protobuf"}),WellKnownTypes:()=>$({Struct:()=>this.csharp.classReference({name:"Struct",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Value:()=>this.csharp.classReference({name:"Value",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),ListValue:()=>this.csharp.classReference({name:"ListValue",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Timestamp:()=>this.csharp.classReference({name:"Timestamp",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"})})})}));y(this,"WireMock",$({Server:()=>this.csharp.classReference({name:"WireMockServer",namespace:"WireMock.Server"}),WireMockServerSettings:()=>this.csharp.classReference({name:"WireMockServerSettings",namespace:"WireMock.Settings"}),WireMockConsoleLogger:()=>this.csharp.classReference({name:"WireMockConsoleLogger",namespace:"WireMock.Logging"})}));y(this,"Grpc",$({Core:()=>$({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};n();a();s();var Yu=new Set(["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"]);function $y(e,t){return Yu.has(t)?e??"":e?`${e}.${t}`:t}var bo=class{constructor(t,r){y(this,"generation");y(this,"indexByObject",new Map);y(this,"indexByPath",new Map);y(this,"explicitByObject",new Map);y(this,"explicitByPath",new Map);y(this,"root");y(this,"ir");this.generation=r,this.root=this.createIndex(t),this.ir=t}get csharp(){return this.generation.csharp}get registry(){return this.generation.registry}createIndex(t,r="",i){let o=$y(i?.jsonPath,r);if(this.indexByPath.has(o)){i||de(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,i);let p=Yu.has(r);for(let[x,w]of Object.entries(t))typeof w=="object"&&w!==null&&(p&&Yu.has(x)?this.indexByObject.set(w,i):this.createIndex(w,x,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[p,x]of Object.entries(t))typeof x=="object"&&x!==null&&this.createIndex(x,p,c);return c}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){let i=this.provenance(t)??de(`Provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),o={...i,jsonPath:`${i.jsonPath}+${r}`,name:r,node:i.node,parent:i,explicit:!0},c=this.explicitByObject.get(i.node);return c?c.add(o):this.explicitByObject.set(i.node,new Set([o])),this.explicitByPath.set(o.jsonPath,o),o}provenance(t){if(t!==void 0)return v.string(t)?this.explicitByPath.get(t)??this.indexByPath.get(t):v.Provenance(t)?this.explicitByPath.get(t.jsonPath)??this.indexByPath.get(t.jsonPath):this.indexByObject.get(t)}origin(t){let r=this.provenance(t);return r?.explicit?r:r?.node}irNode(t){return this.provenance(t)?.node}jsonPath(t){return this.provenance(t)?.jsonPath}getEnumValueName(t,r){let i=v.IR.ExampleEnumType(r)?r.value:r,o=t.values.find(c=>this.nameEquals(c.name,i));return o?this.getPropertyNameFor(o):de(`Unexpected - can't find enum value ${JSON.stringify(i)} in enum`)}getPropertyNameFor(t){let r=this.registry.getFieldNameByOrigin(t);if(r)return r;if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${this.jsonPath(t)}`)}getClassNameFor(t){if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.TypeDeclaration(t))return this.generation.case.pascalSafe(t.name.name);if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${JSON.stringify(t)}`)}nameEquals(t,r){return this.generation.case.camelSafe(t)===this.generation.case.camelSafe(r)}dereferenceType(t){let r=v.string(t)?t:v.IR.NamedType(t)||v.IR.DeclaredTypeName(t)?t.typeId:v.IR.ExampleNamedType(t)?t.typeName.typeId:t.name.typeId,i=this.irNode(this.ir.types[r]);if(v.IR.TypeDeclaration(i))return{typeId:r,typeDeclaration:i};de(`dereferenceType: typeId ${r} not resolved.`)}};function xo(...e){return e.filter(Boolean).join("/")}var kn=class{constructor(t,r,i,o,c={makeRelativeFilePath:p=>p,makeAbsoluteFilePath:p=>p,getNamespaceForTypeId:p=>"",getDirectoryForTypeId:p=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:p=>[]}){y(this,"intermediateRepresentation");y(this,"apiName");y(this,"customConfig");y(this,"generatorConfig");y(this,"support");y(this,"ir");y(this,"dir");y(this,"csharp",new yo(this));y(this,"registry",new Ai(this));y(this,"model");y(this,"case");y(this,"extern",new go(this));y(this,"settings",$({namespace:()=>this.customConfig.namespace??io(no(`${this.generatorConfig.organization}_${this.apiName}`)),readOnlyMemoryTypes:()=>this.customConfig["read-only-memory-types"]??[],simplifyObjectDictionaries:()=>this.customConfig["simplify-object-dictionaries"]??!1,useFullyQualifiedNamespaces:()=>this.customConfig["experimental-fully-qualified-namespaces"]??!1,useDotnetFormat:()=>this.customConfig["experimental-dotnet-format"]??!1,enableWebsockets:()=>this.customConfig["experimental-enable-websockets"]??!1,enableReadonlyConstants:()=>this.customConfig["experimental-readonly-constants"]??!1,generateLiterals:()=>this.customConfig["generate-literals"]??this.customConfig["experimental-readonly-constants"]??!1,enableExplicitNullableOptional:()=>this.customConfig["experimental-explicit-nullable-optional"]??!1,useDefaultRequestParameterValues:()=>this.customConfig["use-default-request-parameter-values"]??!1,redactResponseBodyOnError:()=>this.customConfig["redact-response-body-on-error"]??!1,enableInlineTypes:()=>this.customConfig["enable-inline-types"]??!1,temporaryWebsocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},baseApiExceptionClassName:()=>this.customConfig["base-api-exception-class-name"]??"",baseExceptionClassName:()=>this.customConfig["base-exception-class-name"]??"",shouldGeneratedDiscriminatedUnions:()=>this.customConfig["use-discriminated-unions"]??!0,shouldGenerateUndiscriminatedUnions:()=>this.customConfig["use-undiscriminated-unions"]??!1,exportedClientClassName:()=>this.customConfig["exported-client-class-name"]??"",clientClassName:()=>this.customConfig["client-class-name"]??"",rootNamespaceForCoreClasses:()=>this.customConfig["root-namespace-for-core-classes"]??!0,packageId:()=>this.customConfig["package-id"]??"",isForwardCompatibleEnumsEnabled:()=>this.customConfig["enable-forward-compatible-enums"]??this.customConfig["experimental-enable-forward-compatible-enums"]??!0,websocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},customPagerName:()=>this.customConfig["custom-pager-name"]??"",usePageIndexSemantics:()=>this.customConfig["offset-semantics"]==="page-index",environmentClassName:()=>this.customConfig["environment-class-name"]??"",generateErrorTypes:()=>this.customConfig["generate-error-types"]??!0,shouldInlinePathParameters:()=>this.customConfig["inline-path-parameters"]??!0,includeExceptionHandler:()=>this.customConfig["include-exception-handler"]??!1,exceptionInterceptorClassName:()=>this.customConfig["exception-interceptor-class-name"]??"",shouldGenerateMockServerTests:()=>this.customConfig["generate-mock-server-tests"]??this.customConfig["enable-wire-tests"]??!0,rootClientAccess:()=>this.customConfig["root-client-class-access"]=="internal"?ge.Internal:ge.Public,extraDependencies:()=>this.customConfig["extra-dependencies"]??{},omitFernHeaders:()=>this.customConfig["omit-fern-headers"]??!1,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??"."}}}));y(this,"constants",{folders:$({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath(xo(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(xo(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(xo(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(xo(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:$({indent:()=>" "}),defaults:$({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});y(this,"namespaces",$({root:()=>this.settings.namespace,core:()=>`${this.namespaces.root}.Core`,qualifiedRoot:()=>this.qualifyNamespace(this.namespaces.root),qualifiedCore:()=>this.qualifyNamespace(this.namespaces.core),test:()=>this.registry.canonicalizeNamespace(`${this.namespaces.root}.Test`),testUtils:()=>`${this.namespaces.test}.Utils`,mockServerTest:()=>`${this.namespaces.test}.Unit.MockServer`,publicCore:()=>this.namespaces.root,webSocketsCore:()=>`${this.namespaces.core}.WebSockets`,publicCoreTest:()=>`${this.namespaces.root}.Test.PublicCore`,asIsTestUtils:()=>`${this.namespaces.root}.Test.Utils`,publicCoreClasses:()=>this.settings.rootNamespaceForCoreClasses?this.namespaces.root:this.namespaces.core,implicit:()=>new Set(["System","System.Collections.Generic","System.IO","System.Linq","System.Threading","System.Threading.Tasks","System.Net.Http"])}));y(this,"names",{classes:$({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:$({client:()=>io(no(`${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:$({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:$({mockOauth:()=>"MockOAuthEndpoint",mockInferredAuth:()=>"MockInferredAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync",getAuthHeadersAsync:()=>"GetAuthHeadersAsync"}),variables:$({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:$({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});y(this,"Types",$({Arbitrary:t=>new te.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:p})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,o,c,p]}),CursorPager:({requestType:t,requestOptionsType:r,responseType:i,cursorType:o,itemType:c})=>this.csharp.classReference({origin:this.model.staticExplicit("CursorPager"),namespace:this.namespaces.core,generics:[t,r,i,o,c]}),CollectionItemSerializer:(t,r)=>this.csharp.classReference({origin:this.model.staticExplicit("CollectionItemSerializer"),namespace:this.namespaces.core,generics:[t,r]}),OneOfSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("OneOfSerializer"),namespace:this.namespaces.core,generics:[t]}),AdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("AdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0}),ReadOnlyAdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("ReadOnlyAdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0})}));y(this,"Primitive",$({string:()=>new te.String(this),boolean:()=>new te.Boolean(this),integer:()=>new te.Integer(this),long:()=>new te.Long(this),uint:()=>new te.Uint(this),ulong:()=>new te.ULong(this),float:()=>new te.Float(this),double:()=>new te.Double(this),object:()=>new te.Object(this)}));y(this,"Value",$({binary:()=>new Ue.Binary(this),dateOnly:()=>new Ue.DateOnly(this),dateTime:()=>new Ue.DateTime(this),uuid:()=>new Ue.Uuid(this),stringEnum:t=>new Ue.StringEnum(t,this)}));y(this,"Collection",$({array:t=>new we.Array(t,this),listType:t=>new we.ListType(t,this),list:t=>new we.List(t,this),set:t=>new we.Set(t,this),map:(t,r,i)=>new we.Map(t,r,this,i),idictionary:(t,r,i)=>new we.IDictionary(t,r,this,i),keyValuePair:(t,r)=>new we.KeyValuePair(t,r,this)}));y(this,"format",$({private:t=>`_${so.camelCase(t)}`}));y(this,"initializers",$({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 p=v.IR.IntermediateRepresentation(t)?t.casingsConfig:void 0;this.case=new Gi({generationLanguage:"csharp",keywords:p?.keywords,smartCasing:p?.smartCasing??!0}),this.model=new bo(t,this),this.ir=v.IR.IntermediateRepresentation(t)?t:{},this.dir=v.DynamicIR.DynamicIntermediateRepresentation(t)?t:{}}initialize(){return this.initializers.implicitNamespaces}get System(){return this.extern.System}get NUnit(){return this.extern.NUnit}get OneOf(){return this.extern.OneOf}get Google(){return this.extern.Google}get Grpc(){return this.extern.Grpc}get WireMock(){return this.extern.WireMock}qualifyNamespace(t){let r=t.split(".")[0];return r&&this.registry.hasTypeNamespaceConflict(r)?`global::${t}`:t}};n();a();s();var Ze=class{constructor(t){y(this,"generation");this.generation=t}get csharp(){return this.generation.csharp}get case(){return this.generation.case}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get namespaces(){return this.generation.namespaces}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get registry(){return this.generation.registry}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get Grpc(){return this.generation.extern.Grpc}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}};n();a();s();var So=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){if(r.value===null)return this.context.isNullable(r.typeReference)?this.csharp.Literal.null():(this.context.errors.add({severity:ee.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:ue(r.typeReference)}}convertList({list:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((c,p)=>{this.context.errors.scope({index:p});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:ee.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertLiteral({literal:r,value:i,fallbackToDefault:o}){if(this.settings.generateLiterals)return this.csharp.Literal.nop();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:ue(r)}}convertSet({set:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((c,p)=>{this.context.errors.scope({index:p});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:ee.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:ee.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,p])=>{this.context.errors.scope(c);try{return{key:this.convert({typeReference:r.key,value:c,as:"key"}),value:this.convert({typeReference:r.value,value:p})}}finally{this.context.errors.unscope()}})})}convertNamed({named:r,value:i,as:o,fallbackToDefault:c}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),arguments_:[]})):this.convert({typeReference:r.typeReference,value:i,as:o,fallbackToDefault:c});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:c}):this.convertUnknown({value:i,fallbackToDefault:c});case"enum":return this.getEnumValue(r,i);case"object":return this.convertObject({object_:r,value:i,fallbackToDefault:c});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:c});default:ue(r)}}convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:o}){let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),p=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:i});if(p==null)return this.csharp.Literal.nop();let x=p.singleDiscriminatedUnionType,w=this.getBaseProperties({discriminatedUnionTypeInstance:p,singleDiscriminatedUnionType:x});switch(x.type){case"samePropertiesAsObject":{let I=this.context.resolveNamedType({typeId:x.typeId});return I==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.convertNamed({named:I,value:p.value})]})}case"singleProperty":{if(this.context.getRecord(p.value)==null)return this.csharp.Literal.nop();try{let A=["Value","Type"].includes(x.discriminantValue.name.pascalCase.safeName)?`${x.discriminantValue.name.pascalCase.safeName}Inner`:x.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(x.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:A,enclosingType:c}),arguments_:[this.convert({typeReference:x.typeReference,value:x.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:p.discriminantValue,enclosingType:c}),arguments_:[]})]});default:ue(x)}}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(p=>{p.write(c," "),p.pushScope();for(let x of o)p.write(x.name," = ",x.assignment,",");p.popScope(!1)}))}getEnumValue(r,i){if(typeof i!="string")return this.context.errors.add({severity:ee.Critical,message:`Expected enum value string, got: ${typeof i}`}),this.csharp.Literal.nop();let o=r.values.find(x=>x.wireValue===i);if(o==null)return this.context.errors.add({severity:ee.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)}),p=c.registerField(this.model.getPropertyNameFor(o),o);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:c,value:p}))}convertObject({object_:r,value:i,fallbackToDefault:o}){let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),p=new Map;for(let P of r.properties){let F=this.context.resolvePropertyName(c,P.name.name);p.set(P.name.wireValue,F)}let x=this.context.getRecord(i)??{},I=this.context.associateByWireValue({parameters:r.properties,values:x}).map(P=>{this.context.errors.scope(P.name.wireValue);try{return{name:p.get(P.name.wireValue)??this.context.getClassName(P.name.name),value:this.convert(P)}}finally{this.context.errors.unscope()}}),A=new Set(Object.keys(x));for(let P of r.properties){let F=p.get(P.name.wireValue)??this.context.getClassName(P.name.name);if(A.has(P.name.wireValue)){if(this.isRequiredProperty(P.typeReference)){let N=I.find(j=>j.name===F);if(N!=null&&v.Literal.nop(N.value)){let j=this.getDefaultLiteralForType(P.typeReference);j!=null&&(N.value=j)}}continue}if(this.isRequiredProperty(P.typeReference)){let N=this.getDefaultLiteralForType(P.typeReference);N!=null&&I.push({name:F,value:N})}}return this.csharp.Literal.class_({reference:c,fields:I})}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 p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),x=[];for(let w of r.properties)if(this.isRequiredProperty(w.typeReference)){let I=this.getDefaultLiteralForType(w.typeReference,c);I!=null&&x.push({name:this.context.resolvePropertyName(p,w.name.name),value:I})}return c.delete(i),this.csharp.Literal.class_({reference:p,fields:x})}getDefaultLiteralForUndiscriminatedUnion(r,i){for(let o of r.types){let c=this.getDefaultLiteralForType(o,i);if(c!=null)return c}}getDefaultLiteralForPrimitive(r){switch(r){case"INTEGER":return this.csharp.Literal.integer(0);case"LONG":return this.csharp.Literal.long(0);case"UINT":return this.csharp.Literal.uint(0);case"UINT_64":return this.csharp.Literal.ulong(0);case"FLOAT":return this.csharp.Literal.float(0);case"DOUBLE":return this.csharp.Literal.double(0);case"BOOLEAN":return this.csharp.Literal.boolean(!1);case"STRING":case"UUID":case"BASE_64":case"BIG_INTEGER":return this.csharp.Literal.string("");case"DATE":return this.csharp.Literal.date("0001-01-01");case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.csharp.Literal.datetime("0001-01-01T00:00:00.000Z");default:ue(r)}}convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:o}){let c=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i});return c==null?this.csharp.Literal.nop():c.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i}){for(let o of r.types){let c=this.context.errors.size();try{let p=this.convert({typeReference:o,value:i});if(v.Literal.nop(p)||this.context.errors.size()>c){this.context.errors.truncate(c);continue}return{valueTypeReference:o,typeLiteral:p}}catch{this.context.errors.truncate(c);continue}}this.context.errors.add({severity:ee.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 p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.integer.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.integer(p)}case"LONG":{let p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.long.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.long(p)}case"UINT":{let p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.uint.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.uint(p)}case"UINT_64":{let p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.ulong.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.ulong(p)}case"FLOAT":{let p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.float.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.float(p)}case"DOUBLE":{let p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.double.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.double(p)}case"BOOLEAN":{let p=this.getValueAsBoolean({value:i,as:o});return p==null?c?this.Primitive.boolean.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.boolean(p)}case"STRING":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(p)}case"DATE":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Value.dateOnly.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.date(p)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Value.dateTime.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.datetime(p)}case"UUID":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(p)}case"BASE_64":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(p)}case"BIG_INTEGER":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(p)}default:ue(r)}}getValueAsNumber({value:r,as:i}){let o=i==="key"&&typeof r=="string"?Number(r):r;return this.context.getValueAsNumber({value:o})}getValueAsBoolean({value:r,as:i}){let o=i==="key"?typeof r=="string"?r==="true":r==="false"?!1:r:r;return this.context.getValueAsBoolean({value:o})}};n();a();s();var wo=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){switch(r.typeReference.type){case"list":return this.Collection.list(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"literal":return this.convertLiteral({literal:r.typeReference.value});case"map":return this.Collection.map(this.convert({typeReference:r.typeReference.key}),this.convert({typeReference:r.typeReference.value}));case"named":{let i=this.context.resolveNamedType({typeId:r.typeReference.value});return i==null?this.convertUnknown():this.convertNamed({named:i,typeId:r.typeReference.value})}case"optional":case"nullable":{let i=this.convert({typeReference:r.typeReference.value});return r.unboxOptionals?i.asNonOptional():i.asOptional()}case"primitive":return this.convertPrimitive({primitive:r.typeReference.value});case"set":return this.Collection.set(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:ue(r.typeReference)}}convertToClassReference(r,i){return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)})}convertNamed({named:r,typeId:i}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.convert({typeReference:r.typeReference});case"enum":case"object":return this.convertToClassReference(r,i);case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertToClassReference(r,i):this.Primitive.object;case"undiscriminatedUnion":return this.settings.shouldGenerateUndiscriminatedUnions?this.convertToClassReference(r,i):this.OneOf.OneOf(r.types.map(o=>this.convert({typeReference:o})));default:ue(r)}}convertLiteral({literal:r}){switch(r.type){case"boolean":return this.Primitive.boolean;case"string":return this.Primitive.string}}convertUnknown(){return this.Primitive.object}convertPrimitive({primitive:r}){switch(r){case"INTEGER":return this.Primitive.integer;case"UINT":return this.Primitive.uint;case"LONG":return this.Primitive.long;case"UINT_64":return this.Primitive.ulong;case"FLOAT":return this.Primitive.float;case"DOUBLE":return this.Primitive.double;case"BOOLEAN":return this.Primitive.boolean;case"STRING":return this.Primitive.string;case"DATE":return this.Value.dateOnly;case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.Value.dateTime;case"UUID":return this.Primitive.string;case"BASE_64":return this.Primitive.string;case"BIG_INTEGER":return this.Primitive.string;default:ue(r)}}};n();a();s();var To=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}getFilePropertyInfo({body:r,value:i}){let o={fileFields:[],bodyPropertyFields:[]},c=this.context.getRecord(i)??{};for(let p of r.properties)switch(p.type){case"file":v.Record.missingKey(c,p.wireValue)&&(c[p.wireValue]="[bytes]"),o.fileFields.push({name:this.context.getPropertyName(p.name),value:this.getSingleFileProperty({property:p,record:c})});break;case"fileArray":v.Record.missingKey(c,p.wireValue)&&(c[p.wireValue]=["[bytes]"]),o.fileFields.push({name:this.context.getPropertyName(p.name),value:this.getArrayFileProperty({property:p,record:c})});break;case"bodyProperty":if(v.Record.missingKey(c,p.name.wireValue))switch(p.typeReference.type){case"optional":break;case"primitive":{switch(p.typeReference.value.toLowerCase()){case"integer":{c[p.name.wireValue]=123;break}case"string":{c[p.name.wireValue]="[string]";break}case"boolean":{c[p.name.wireValue]=!0;break}case"double":{c[p.name.wireValue]=123.456;break}case"float":{c[p.name.wireValue]=123.456;break}case"long":{c[p.name.wireValue]=123456789;break}case"uint":{c[p.name.wireValue]=123;break}case"uint64":{c[p.name.wireValue]=12345;break}case"date":{c[p.name.wireValue]=new Date(2021,1,1);break}case"datetime":{c[p.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{c[p.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{c[p.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{c[p.name.wireValue]="12345678901234567890";break}}break}default:break}o.bodyPropertyFields.push({name:this.context.getPropertyName(p.name.name),value:this.getBodyProperty({property:p,record:c})});break;default:ue(p)}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 Eo=class e extends Yi{constructor({ir:r,config:i,options:o,generation:c}){super({ir:r,config:i,options:o});y(this,"ir");y(this,"dynamicTypeMapper");y(this,"dynamicLiteralMapper");y(this,"filePropertyMapper");y(this,"generation");this.ir=r,this.generation=c??new kn(r,i.workspaceName,i.customConfig!=null?i.customConfig:{},i),this.dynamicTypeMapper=new wo({context:this}),this.dynamicLiteralMapper=new So({context:this}),this.filePropertyMapper=new To({context:this})}get namespaces(){return this.generation.namespaces}get registry(){return this.generation.registry}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get csharp(){return this.generation.csharp}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}clone(){return new e({ir:this.ir,config:this.config,options:this.options,generation:this.generation})}getFileParameterForString(r){return this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.FileParameter,arguments_:[],properties:[{name:"Stream",value:this.getMemoryStreamForString(r)}],multiline:!0}))}getMemoryStreamForString(r){return this.System.IO.MemoryStream.new({arguments_:[this.csharp.invokeMethod({on:this.System.Text.Encoding_UTF8,method:"GetBytes",arguments_:[this.csharp.Literal.string(r)]})]})}getClassName(r){return r.pascalCase.safeName}getParameterName(r){return r.camelCase.safeName}getPropertyName(r){return r.pascalCase.safeName}resolvePropertyName(r,i){let o=i.pascalCase.safeName,c=r.scope.getRedirectedFieldName(o);return c||(r.scope.isField(o)?o:r.registerField(o))}getMethodName(r){return`${r.pascalCase.safeName}Async`}getNamespace(r,i){let o=this.getNamespaceSegments(r);return o=i!=null?[...o,i]:o,[this.namespaces.root,...o].join(".")}getEnvironmentTypeReferenceFromID(r){let i=this.resolveEnvironmentName(r);if(i!=null)return this.getEnvironmentClassReferenceForEnumName(i)}getEnvironmentClassReferenceForEnumName(r){return this.csharp.classReference({name:`${this.generation.Types.Environments.name}.${this.getClassName(r)}`,namespace:this.namespaces.root})}getNamespaceSegments(r){return(this.settings.explicitNamespaces?r.allParts:r.packagePath).map(o=>o.pascalCase.safeName)}precalculate(r){this.generation.initialize(),this.System.Collections.Generic.KeyValuePair(),this.System.Collections.Generic.IEnumerable(),this.System.Collections.Generic.IAsyncEnumerable(),this.System.Collections.Generic.HashSet(),this.System.Collections.Generic.List(),this.System.Collections.Generic.Dictionary(),this.System.Threading.Tasks.Task(),Object.entries(this.ir.types).sort((i,o)=>i[0].length-o[0].length).forEach(([i,o])=>{this.dynamicTypeMapper.convertToClassReference(o,i)});for(let[i,o]of r.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${i}`),namespace:"Usage"}),o.endpoint){let c=this.resolveEndpointLocation(o.endpoint);for(let p of c)switch(p.request.type){case"inlined":this.csharp.classReference({origin:p.request.declaration.name,namespace:this.getNamespace(p.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClientForSnippets,this.csharp.freezeClassReferences()}};n();a();s();var Io=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}async generateSnippet({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}generateSnippetSync({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}async generateSnippetAst({endpoint:r,request:i,options:o}){throw new Error("Unsupported")}buildCodeBlock({endpoint:r,snippet:i,options:o}){if(r.examples&&v.DynamicIR.EndpointExample(i)&&!r.examples.find(x=>x.id===i.id))throw new Error("Endpoint does not have an example that matches the snippet");let c=this.csharp.codeblock(x=>{x.writeNodeStatement(this.constructClient({endpoint:r,snippet:i})),x.newLine(),x.writeNodeStatement(this.callMethod({endpoint:r,snippet:i}))}),p=this.getStyle(o);switch(p){case Jt.Concise:return c;case Jt.Full:return this.buildFullCodeBlock({body:c,options:o});default:ue(p)}}buildFullCodeBlock({body:r,options:i}){let o=this.getConfig(i),c=o.fullStyleMethodName??o.fullStyleClassName??"Example",p=this.csharp.class_({name:"Examples",namespace:"Examples",partial:!0,skipNamespaceDeclaration:!0,access:Ii.Access.Public});return p.addNamespaceReference(this.Types.RootClientForSnippets.namespace),p.addMethod({name:c,access:Ii.Access.Public,isAsync:!0,parameters:[],body:r}),p}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(p=>{p.write("await foreach (var item in "),p.writeNode(c),p.writeLine(")"),p.pushScope(),p.writeLine("/* consume each item */"),p.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:ee.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let c=[],p=this.getConstructorBaseUrlArgs({baseUrl:i.baseURL,environment:i.environment});p.length>0&&c.push(...p),this.context.errors.scope(tt.Headers);let x=[];if(this.context.ir.headers!=null&&i.headers!=null&&x.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:i.headers})),this.context.errors.unscope(),this.settings.unifiedClientOptions){let w=[...o.map(I=>({name:Le(I.name),assignment:I.assignment})),...x.map(I=>({name:Le(I.name),assignment:I.assignment})),...c.map(I=>({name:I.name,assignment:I.assignment}))];return w.length===0?[]:[{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:w,multiline:!0})}]}return c.length===0?[...o,...x]:[...o,...x,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:c.map(w=>({name:w.name,assignment:w.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:r,environment:i}){let o=this.getBaseUrlArg({baseUrl:r,environment:i});return v.Literal.nop(o)?[]:[{name:this.getBaseUrlOptionName(),assignment:o}]}getBaseUrlArg({baseUrl:r,environment:i}){if(r!=null&&i!=null)return this.context.errors.add({severity:ee.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:ee.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:ee.Warning,message:`Environment ${JSON.stringify(i)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(o)}if(this.context.isMultiEnvironmentValues(i))return this.context.validateMultiEnvironmentUrlValues(i)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(i).map(([o,c])=>({name:Le(cr(o)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:c})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:r,values:i}){if(i.type!==r.type)return this.addError(this.context.newAuthMismatchError({auth:r,values:i}).message),[];switch(r.type){case"basic":return i.type==="basic"?this.getConstructorBasicAuthArg({auth:r,values:i}):[];case"bearer":return i.type==="bearer"?this.getConstructorBearerAuthArgs({auth:r,values:i}):[];case"header":return i.type==="header"?this.getConstructorHeaderAuthArgs({auth:r,values:i}):[];case"oauth":return i.type==="oauth"?this.getConstructorOAuthArgs({auth:r,values:i}):[];case"inferred":return i.type==="inferred"?this.getConstructorInferredAuthArgs({auth:r,values:i}):[];default:ue(r)}}addError(r){this.context.errors.add({severity:ee.Critical,message:r})}addWarning(r){this.context.errors.add({severity:ee.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:i}){let o=r,c=!!o.usernameOmit,p=!!o.passwordOmit,x=[];return c||x.push({name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(i.username)}),p||x.push({name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(i.password)}),x}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 p=c.name.wireValue,x=i.values?.[p];o.push({name:this.context.getParameterName(c.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:c.typeReference,value:x,fallbackToDefault:p})})}else this.context.errors.add({severity:ee.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 p=i[c.name.wireValue],x=this.getConstructorHeaderArg({header:c,value:p});x!=null&&o.push({name:this.context.getParameterName(c.name.name),assignment:x})}return o}getConstructorHeaderArg({header:r,value:i}){let o=this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:i,fallbackToDefault:r.name.wireValue});if(!v.Literal.nop(o))return o}getMethodArgs({endpoint:r,snippet:i}){switch(r.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:r.request,snippet:i});case"body":return this.getMethodArgsForBodyRequest({request:r.request,snippet:i});default:ue(r.request)}}getMethodArgsForInlinedRequest({request:r,snippet:i}){let o=[];this.context.errors.scope(tt.PathParameters);let c=[],p=[...this.context.ir.pathParameters??[],...r.pathParameters??[]];p.length>0&&c.push(...this.getPathParameters({namedParameters:p,snippet:i})),this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let x=this.getFilePropertyInfo({request:r,snippet:i});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})||o.push(...c.map(w=>w.value)),o.push(this.getInlinedRequestArg({request:r,snippet:i,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})?c:[],filePropertyInfo:x})),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}){let p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)});this.context.errors.scope(tt.QueryParameters);let w=this.context.associateQueryParametersByWireValue({parameters:r.queryParameters??[],values:i.queryParameters??{}}).map(F=>({name:this.context.resolvePropertyName(p,F.name.name),value:this.context.dynamicLiteralMapper.convert(F)}));this.context.errors.unscope(),this.context.errors.scope(tt.Headers);let A=this.context.associateByWireValue({parameters:r.headers??[],values:i.headers??{}}).map(F=>({name:this.context.resolvePropertyName(p,F.name.name),value:this.context.dynamicLiteralMapper.convert({...F,fallbackToDefault:F.name.wireValue})}));this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let P=r.body!=null?this.getInlinedRequestBodyConstructorFields({body:r.body,value:i.requestBody,filePropertyInfo:c,classReference:p}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:p,fields:[...o,...w,...A,...P]})}getInlinedRequestBodyConstructorFields({body:r,value:i,filePropertyInfo:o,classReference:c}){switch(r.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:r.value,value:i,classReference:c});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:c})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:o});default:ue(r)}}getInlinedRequestBodyPropertyConstructorFields({parameters:r,value:i,classReference:o}){let c=[],p=this.context.associateByWireValue({parameters:r,values:this.context.getRecord(i)??{}});for(let x of p)c.push({name:this.context.resolvePropertyName(o,x.name.name),value:this.context.dynamicLiteralMapper.convert({...x,fallbackToDefault:x.name.wireValue})});return c}getFileUploadRequestBodyConstructorFields({filePropertyInfo:r}){return[...r.fileFields,...r.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:o}){return{name:this.context.resolvePropertyName(o,r.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:r.bodyType,value:i})}}getReferencedRequestBodyPropertyLiteral({body:r,value:i}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:i});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:i,fallbackToDefault:JSON.stringify(r.value)});default:ue(r)}}getMethodArgsForBodyRequest({request:r,snippet:i}){let o=[];this.context.errors.scope(tt.PathParameters);let c=[...this.context.ir.pathParameters??[],...r.pathParameters??[]];return c.length>0&&o.push(...this.getPathParameters({namedParameters:c,snippet:i}).map(p=>p.value)),this.context.errors.unscope(),this.context.errors.scope(tt.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:ue(r)}}getBytesBodyRequestArg({value:r}){let i=this.context.getValueAsString({value:r});return i==null&&(this.context.errors.add({severity:ee.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 p of c)o.push({name:this.context.getPropertyName(p.name.name),value:this.context.dynamicLiteralMapper.convert({...p,fallbackToDefault:p.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??Jt.Full}getConfig(r){return r.config??this.context.options.config??{}}};var Ao=class extends Ji{constructor({ir:t,config:r,options:i={}}){super(new Eo({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 Io({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
33
|
+
${ji()}`)}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 it(r,this.generation)}testClass(t){return new Ei(t,this.generation)}annotation(t){return new yt(t,this.generation)}annotationGroup(t){return new mi(t,this.generation)}instantiateClass(t){return new Qr(t,this.generation)}invokeMethod(t){return new ei(t,this.generation)}codeblock(t){return new Dt(t,this.generation)}code(){return new Ut({},this.generation)}anonymousFunction(t){return new di(t)}parameter(t){return new Ye(t,this.generation)}interface_(t){return new Ti(t,this.generation)}enum_(t){return new wi(t,this.generation)}dictionary(t){return new Yr(t,this.generation)}list(t){return new Zr(t,this.generation)}readOnlyMemory(t){return new ti(t,this.generation)}set(t){return new ri(t,this.generation)}switch_(t){return new yi(t,this.generation)}ternary(t){return new gi(t,this.generation)}and(t){return new fi(t,this.generation)}or(t){return new hi(t,this.generation)}enumInstantiation(t){return new Xr(t,this.generation)}string_(t){return new ii(t,this.generation)}xmlDocBlock(t){return new Vt(t,this.generation)}xmlDocBlockOf(t){return t instanceof Vt?t:new Vt(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 $(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 go=class{constructor(t){y(this,"generation");y(this,"System",$({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:()=>$({Serialization:()=>$({EnumMember:()=>this.csharp.classReference({name:"EnumMemberAttribute",namespace:"System.Runtime.Serialization"})})}),Collections:()=>$({Generic:()=>$({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:()=>$({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>$({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>$({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>$({Http:()=>$({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:()=>$({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>$({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>$({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:()=>$({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:()=>$({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:()=>$({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>$({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:()=>$({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>$({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:()=>$({INotifyPropertyChanged:()=>this.csharp.classReference({name:"INotifyPropertyChanged",namespace:"System.ComponentModel"}),PropertyChangedEventHandler:()=>this.csharp.classReference({name:"PropertyChangedEventHandler",namespace:"System.ComponentModel"})}),IAsyncDisposable:()=>this.csharp.classReference({name:"IAsyncDisposable",namespace:"System"}),IDisposable:()=>this.csharp.classReference({name:"IDisposable",namespace:"System"})}));y(this,"NUnit",$({Framework:()=>$({TestFixture:()=>this.csharp.classReference({name:"TestFixture",namespace:"NUnit.Framework"}),Test:()=>this.csharp.classReference({name:"Test",namespace:"NUnit.Framework"}),OneTimeTearDown:()=>this.csharp.classReference({name:"OneTimeTearDown",namespace:"NUnit.Framework"}),OneTimeSetUp:()=>this.csharp.classReference({name:"OneTimeSetUp",namespace:"NUnit.Framework"}),SetUpFixture:()=>this.csharp.classReference({name:"SetUpFixture",namespace:"NUnit.Framework"}),Parallelizable:()=>this.csharp.classReference({name:"Parallelizable",namespace:"NUnit.Framework"})})}));y(this,"OneOf",$({OneOf:t=>this.csharp.classReference({name:"OneOf",namespace:"OneOf",generics:t}),OneOfBase:t=>this.csharp.classReference({name:"OneOfBase",namespace:"OneOf",generics:t})}));y(this,"Google",$({Protobuf:()=>$({ByteString:()=>this.csharp.classReference({name:"ByteString",namespace:"Google.Protobuf"}),WellKnownTypes:()=>$({Struct:()=>this.csharp.classReference({name:"Struct",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Value:()=>this.csharp.classReference({name:"Value",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),ListValue:()=>this.csharp.classReference({name:"ListValue",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Timestamp:()=>this.csharp.classReference({name:"Timestamp",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"})})})}));y(this,"WireMock",$({Server:()=>this.csharp.classReference({name:"WireMockServer",namespace:"WireMock.Server"}),WireMockServerSettings:()=>this.csharp.classReference({name:"WireMockServerSettings",namespace:"WireMock.Settings"}),WireMockConsoleLogger:()=>this.csharp.classReference({name:"WireMockConsoleLogger",namespace:"WireMock.Logging"})}));y(this,"Grpc",$({Core:()=>$({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};n();a();s();var Yu=new Set(["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"]);function $y(e,t){return Yu.has(t)?e??"":e?`${e}.${t}`:t}var bo=class{constructor(t,r){y(this,"generation");y(this,"indexByObject",new Map);y(this,"indexByPath",new Map);y(this,"explicitByObject",new Map);y(this,"explicitByPath",new Map);y(this,"root");y(this,"ir");this.generation=r,this.root=this.createIndex(t),this.ir=t}get csharp(){return this.generation.csharp}get registry(){return this.generation.registry}createIndex(t,r="",i){let o=$y(i?.jsonPath,r);if(this.indexByPath.has(o)){i||de(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,i);let p=Yu.has(r);for(let[x,w]of Object.entries(t))typeof w=="object"&&w!==null&&(p&&Yu.has(x)?this.indexByObject.set(w,i):this.createIndex(w,x,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[p,x]of Object.entries(t))typeof x=="object"&&x!==null&&this.createIndex(x,p,c);return c}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){let i=this.provenance(t)??de(`Provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),o={...i,jsonPath:`${i.jsonPath}+${r}`,name:r,node:i.node,parent:i,explicit:!0},c=this.explicitByObject.get(i.node);return c?c.add(o):this.explicitByObject.set(i.node,new Set([o])),this.explicitByPath.set(o.jsonPath,o),o}provenance(t){if(t!==void 0)return v.string(t)?this.explicitByPath.get(t)??this.indexByPath.get(t):v.Provenance(t)?this.explicitByPath.get(t.jsonPath)??this.indexByPath.get(t.jsonPath):this.indexByObject.get(t)}origin(t){let r=this.provenance(t);return r?.explicit?r:r?.node}irNode(t){return this.provenance(t)?.node}jsonPath(t){return this.provenance(t)?.jsonPath}getEnumValueName(t,r){let i=v.IR.ExampleEnumType(r)?r.value:r,o=t.values.find(c=>this.nameEquals(c.name,i));return o?this.getPropertyNameFor(o):de(`Unexpected - can't find enum value ${JSON.stringify(i)} in enum`)}getPropertyNameFor(t){let r=this.registry.getFieldNameByOrigin(t);if(r)return r;if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${this.jsonPath(t)}`)}getClassNameFor(t){if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.TypeDeclaration(t))return this.generation.case.pascalSafe(t.name.name);if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${JSON.stringify(t)}`)}nameEquals(t,r){return this.generation.case.camelSafe(t)===this.generation.case.camelSafe(r)}dereferenceType(t){let r=v.string(t)?t:v.IR.NamedType(t)||v.IR.DeclaredTypeName(t)?t.typeId:v.IR.ExampleNamedType(t)?t.typeName.typeId:t.name.typeId,i=this.irNode(this.ir.types[r]);if(v.IR.TypeDeclaration(i))return{typeId:r,typeDeclaration:i};de(`dereferenceType: typeId ${r} not resolved.`)}};function xo(...e){return e.filter(Boolean).join("/")}var kn=class{constructor(t,r,i,o,c={makeRelativeFilePath:p=>p,makeAbsoluteFilePath:p=>p,getNamespaceForTypeId:p=>"",getDirectoryForTypeId:p=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:p=>[]}){y(this,"intermediateRepresentation");y(this,"apiName");y(this,"customConfig");y(this,"generatorConfig");y(this,"support");y(this,"ir");y(this,"dir");y(this,"csharp",new yo(this));y(this,"registry",new Ai(this));y(this,"model");y(this,"case");y(this,"extern",new go(this));y(this,"settings",$({namespace:()=>this.customConfig.namespace??io(no(`${this.generatorConfig.organization}_${this.apiName}`)),readOnlyMemoryTypes:()=>this.customConfig["read-only-memory-types"]??[],simplifyObjectDictionaries:()=>this.customConfig["simplify-object-dictionaries"]??!1,useFullyQualifiedNamespaces:()=>this.customConfig["experimental-fully-qualified-namespaces"]??!1,useDotnetFormat:()=>this.customConfig["experimental-dotnet-format"]??!1,enableWebsockets:()=>this.customConfig["experimental-enable-websockets"]??!1,enableReadonlyConstants:()=>this.customConfig["experimental-readonly-constants"]??!1,generateLiterals:()=>this.customConfig["generate-literals"]??this.customConfig["experimental-readonly-constants"]??!1,enableExplicitNullableOptional:()=>this.customConfig["experimental-explicit-nullable-optional"]??!1,useDefaultRequestParameterValues:()=>this.customConfig["use-default-request-parameter-values"]??!1,redactResponseBodyOnError:()=>this.customConfig["redact-response-body-on-error"]??!1,enableInlineTypes:()=>this.customConfig["enable-inline-types"]??!1,temporaryWebsocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},baseApiExceptionClassName:()=>this.customConfig["base-api-exception-class-name"]??"",baseExceptionClassName:()=>this.customConfig["base-exception-class-name"]??"",shouldGeneratedDiscriminatedUnions:()=>this.customConfig["use-discriminated-unions"]??!0,shouldGenerateUndiscriminatedUnions:()=>this.customConfig["use-undiscriminated-unions"]??!1,exportedClientClassName:()=>this.customConfig["exported-client-class-name"]??"",clientClassName:()=>this.customConfig["client-class-name"]??"",rootNamespaceForCoreClasses:()=>this.customConfig["root-namespace-for-core-classes"]??!0,packageId:()=>this.customConfig["package-id"]??"",isForwardCompatibleEnumsEnabled:()=>this.customConfig["enable-forward-compatible-enums"]??this.customConfig["experimental-enable-forward-compatible-enums"]??!0,websocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},customPagerName:()=>this.customConfig["custom-pager-name"]??"",usePageIndexSemantics:()=>this.customConfig["offset-semantics"]==="page-index",environmentClassName:()=>this.customConfig["environment-class-name"]??"",generateErrorTypes:()=>this.customConfig["generate-error-types"]??!0,shouldInlinePathParameters:()=>this.customConfig["inline-path-parameters"]??!0,includeExceptionHandler:()=>this.customConfig["include-exception-handler"]??!1,exceptionInterceptorClassName:()=>this.customConfig["exception-interceptor-class-name"]??"",shouldGenerateMockServerTests:()=>this.customConfig["generate-mock-server-tests"]??this.customConfig["enable-wire-tests"]??!0,rootClientAccess:()=>this.customConfig["root-client-class-access"]=="internal"?ge.Internal:ge.Public,extraDependencies:()=>this.customConfig["extra-dependencies"]??{},omitFernHeaders:()=>this.customConfig["omit-fern-headers"]??!1,unifiedClientOptions:()=>this.customConfig["unified-client-options"]??!1,pascalCaseEnvironments:()=>this.customConfig["pascal-case-environments"]??!0,slnFormat:()=>this.customConfig["sln-format"]??"slnx",explicitNamespaces:()=>this.customConfig["explicit-namespaces"]===!0,maxRetries:()=>this.customConfig.maxRetries,retryStatusCodes:()=>this.customConfig.retryStatusCodes??"legacy",outputPath:()=>{let t=this.customConfig["output-path"];return t==null?{library:"src",test:"src",solution:".",other:"."}:typeof t=="string"?{library:t,test:t,solution:".",other:"."}:{library:t.library??"src",test:t.test??"src",solution:t.solution??".",other:t.other??"."}}}));y(this,"constants",{folders:$({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath(xo(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(xo(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(xo(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(xo(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:$({indent:()=>" "}),defaults:$({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});y(this,"namespaces",$({root:()=>this.settings.namespace,core:()=>`${this.namespaces.root}.Core`,qualifiedRoot:()=>this.qualifyNamespace(this.namespaces.root),qualifiedCore:()=>this.qualifyNamespace(this.namespaces.core),test:()=>this.registry.canonicalizeNamespace(`${this.namespaces.root}.Test`),testUtils:()=>`${this.namespaces.test}.Utils`,mockServerTest:()=>`${this.namespaces.test}.Unit.MockServer`,publicCore:()=>this.namespaces.root,webSocketsCore:()=>`${this.namespaces.core}.WebSockets`,publicCoreTest:()=>`${this.namespaces.root}.Test.PublicCore`,asIsTestUtils:()=>`${this.namespaces.root}.Test.Utils`,publicCoreClasses:()=>this.settings.rootNamespaceForCoreClasses?this.namespaces.root:this.namespaces.core,implicit:()=>new Set(["System","System.Collections.Generic","System.IO","System.Linq","System.Threading","System.Threading.Tasks","System.Net.Http"])}));y(this,"names",{classes:$({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:$({client:()=>io(no(`${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:$({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:$({mockOauth:()=>"MockOAuthEndpoint",mockInferredAuth:()=>"MockInferredAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync",getAuthHeadersAsync:()=>"GetAuthHeadersAsync"}),variables:$({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:$({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});y(this,"Types",$({Arbitrary:t=>new te.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:p})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,o,c,p]}),CursorPager:({requestType:t,requestOptionsType:r,responseType:i,cursorType:o,itemType:c})=>this.csharp.classReference({origin:this.model.staticExplicit("CursorPager"),namespace:this.namespaces.core,generics:[t,r,i,o,c]}),CollectionItemSerializer:(t,r)=>this.csharp.classReference({origin:this.model.staticExplicit("CollectionItemSerializer"),namespace:this.namespaces.core,generics:[t,r]}),OneOfSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("OneOfSerializer"),namespace:this.namespaces.core,generics:[t]}),AdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("AdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0}),ReadOnlyAdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("ReadOnlyAdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0})}));y(this,"Primitive",$({string:()=>new te.String(this),boolean:()=>new te.Boolean(this),integer:()=>new te.Integer(this),long:()=>new te.Long(this),uint:()=>new te.Uint(this),ulong:()=>new te.ULong(this),float:()=>new te.Float(this),double:()=>new te.Double(this),object:()=>new te.Object(this)}));y(this,"Value",$({binary:()=>new Ue.Binary(this),dateOnly:()=>new Ue.DateOnly(this),dateTime:()=>new Ue.DateTime(this),uuid:()=>new Ue.Uuid(this),stringEnum:t=>new Ue.StringEnum(t,this)}));y(this,"Collection",$({array:t=>new we.Array(t,this),listType:t=>new we.ListType(t,this),list:t=>new we.List(t,this),set:t=>new we.Set(t,this),map:(t,r,i)=>new we.Map(t,r,this,i),idictionary:(t,r,i)=>new we.IDictionary(t,r,this,i),keyValuePair:(t,r)=>new we.KeyValuePair(t,r,this)}));y(this,"format",$({private:t=>`_${so.camelCase(t)}`}));y(this,"initializers",$({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 p=v.IR.IntermediateRepresentation(t)?t.casingsConfig:void 0;this.case=new Gi({generationLanguage:"csharp",keywords:p?.keywords,smartCasing:p?.smartCasing??!0}),this.model=new bo(t,this),this.ir=v.IR.IntermediateRepresentation(t)?t:{},this.dir=v.DynamicIR.DynamicIntermediateRepresentation(t)?t:{}}initialize(){return this.initializers.implicitNamespaces}get System(){return this.extern.System}get NUnit(){return this.extern.NUnit}get OneOf(){return this.extern.OneOf}get Google(){return this.extern.Google}get Grpc(){return this.extern.Grpc}get WireMock(){return this.extern.WireMock}qualifyNamespace(t){let r=t.split(".")[0];return r&&this.registry.hasTypeNamespaceConflict(r)?`global::${t}`:t}};n();a();s();var Ze=class{constructor(t){y(this,"generation");this.generation=t}get csharp(){return this.generation.csharp}get case(){return this.generation.case}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get namespaces(){return this.generation.namespaces}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get registry(){return this.generation.registry}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get Grpc(){return this.generation.extern.Grpc}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}};n();a();s();var So=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){if(r.value===null)return this.context.isNullable(r.typeReference)?this.csharp.Literal.null():(this.context.errors.add({severity:ee.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:ue(r.typeReference)}}convertList({list:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((c,p)=>{this.context.errors.scope({index:p});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:ee.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertLiteral({literal:r,value:i,fallbackToDefault:o}){if(this.settings.generateLiterals)return this.csharp.Literal.nop();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:ue(r)}}convertSet({set:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((c,p)=>{this.context.errors.scope({index:p});try{return this.convert({typeReference:r,value:c})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:ee.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:ee.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,p])=>{this.context.errors.scope(c);try{return{key:this.convert({typeReference:r.key,value:c,as:"key"}),value:this.convert({typeReference:r.value,value:p})}}finally{this.context.errors.unscope()}})})}convertNamed({named:r,value:i,as:o,fallbackToDefault:c}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),arguments_:[]})):this.convert({typeReference:r.typeReference,value:i,as:o,fallbackToDefault:c});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:c}):this.convertUnknown({value:i,fallbackToDefault:c});case"enum":return this.getEnumValue(r,i);case"object":return this.convertObject({object_:r,value:i,fallbackToDefault:c});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:c});default:ue(r)}}convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:o}){let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),p=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:i});if(p==null)return this.csharp.Literal.nop();let x=p.singleDiscriminatedUnionType,w=this.getBaseProperties({discriminatedUnionTypeInstance:p,singleDiscriminatedUnionType:x});switch(x.type){case"samePropertiesAsObject":{let I=this.context.resolveNamedType({typeId:x.typeId});return I==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.convertNamed({named:I,value:p.value})]})}case"singleProperty":{if(this.context.getRecord(p.value)==null)return this.csharp.Literal.nop();try{let A=["Value","Type"].includes(x.discriminantValue.name.pascalCase.safeName)?`${x.discriminantValue.name.pascalCase.safeName}Inner`:x.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(x.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:A,enclosingType:c}),arguments_:[this.convert({typeReference:x.typeReference,value:x.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:c,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:p.discriminantValue,enclosingType:c}),arguments_:[]})]});default:ue(x)}}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(p=>{p.write(c," "),p.pushScope();for(let x of o)p.write(x.name," = ",x.assignment,",");p.popScope(!1)}))}getEnumValue(r,i){if(typeof i!="string")return this.context.errors.add({severity:ee.Critical,message:`Expected enum value string, got: ${typeof i}`}),this.csharp.Literal.nop();let o=r.values.find(x=>x.wireValue===i);if(o==null)return this.context.errors.add({severity:ee.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)}),p=c.registerField(this.model.getPropertyNameFor(o),o);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:c,value:p}))}convertObject({object_:r,value:i,fallbackToDefault:o}){let c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),p=new Map;for(let P of r.properties){let F=this.context.resolvePropertyName(c,P.name.name);p.set(P.name.wireValue,F)}let x=this.context.getRecord(i)??{},I=this.context.associateByWireValue({parameters:r.properties,values:x}).map(P=>{this.context.errors.scope(P.name.wireValue);try{return{name:p.get(P.name.wireValue)??this.context.getClassName(P.name.name),value:this.convert(P)}}finally{this.context.errors.unscope()}}),A=new Set(Object.keys(x));for(let P of r.properties){let F=p.get(P.name.wireValue)??this.context.getClassName(P.name.name);if(A.has(P.name.wireValue)){if(this.isRequiredProperty(P.typeReference)){let N=I.find(j=>j.name===F);if(N!=null&&v.Literal.nop(N.value)){let j=this.getDefaultLiteralForType(P.typeReference);j!=null&&(N.value=j)}}continue}if(this.isRequiredProperty(P.typeReference)){let N=this.getDefaultLiteralForType(P.typeReference);N!=null&&I.push({name:F,value:N})}}return this.csharp.Literal.class_({reference:c,fields:I})}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 p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),x=[];for(let w of r.properties)if(this.isRequiredProperty(w.typeReference)){let I=this.getDefaultLiteralForType(w.typeReference,c);I!=null&&x.push({name:this.context.resolvePropertyName(p,w.name.name),value:I})}return c.delete(i),this.csharp.Literal.class_({reference:p,fields:x})}getDefaultLiteralForUndiscriminatedUnion(r,i){for(let o of r.types){let c=this.getDefaultLiteralForType(o,i);if(c!=null)return c}}getDefaultLiteralForPrimitive(r){switch(r){case"INTEGER":return this.csharp.Literal.integer(0);case"LONG":return this.csharp.Literal.long(0);case"UINT":return this.csharp.Literal.uint(0);case"UINT_64":return this.csharp.Literal.ulong(0);case"FLOAT":return this.csharp.Literal.float(0);case"DOUBLE":return this.csharp.Literal.double(0);case"BOOLEAN":return this.csharp.Literal.boolean(!1);case"STRING":case"UUID":case"BASE_64":case"BIG_INTEGER":return this.csharp.Literal.string("");case"DATE":return this.csharp.Literal.date("0001-01-01");case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.csharp.Literal.datetime("0001-01-01T00:00:00.000Z");default:ue(r)}}convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:o}){let c=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i});return c==null?this.csharp.Literal.nop():c.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i}){for(let o of r.types){let c=this.context.errors.size();try{let p=this.convert({typeReference:o,value:i});if(v.Literal.nop(p)||this.context.errors.size()>c){this.context.errors.truncate(c);continue}return{valueTypeReference:o,typeLiteral:p}}catch{this.context.errors.truncate(c);continue}}this.context.errors.add({severity:ee.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 p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.integer.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.integer(p)}case"LONG":{let p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.long.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.long(p)}case"UINT":{let p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.uint.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.uint(p)}case"UINT_64":{let p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.ulong.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.ulong(p)}case"FLOAT":{let p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.float.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.float(p)}case"DOUBLE":{let p=this.getValueAsNumber({value:i,as:o});return p==null?c?this.Primitive.double.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.double(p)}case"BOOLEAN":{let p=this.getValueAsBoolean({value:i,as:o});return p==null?c?this.Primitive.boolean.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.boolean(p)}case"STRING":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(p)}case"DATE":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Value.dateOnly.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.date(p)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Value.dateTime.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.datetime(p)}case"UUID":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(p)}case"BASE_64":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(p)}case"BIG_INTEGER":{let p=this.context.getValueAsString({value:i});return p==null?c?this.Primitive.string.getDeterminsticDefault(c):this.csharp.Literal.nop():this.csharp.Literal.string(p)}default:ue(r)}}getValueAsNumber({value:r,as:i}){let o=i==="key"&&typeof r=="string"?Number(r):r;return this.context.getValueAsNumber({value:o})}getValueAsBoolean({value:r,as:i}){let o=i==="key"?typeof r=="string"?r==="true":r==="false"?!1:r:r;return this.context.getValueAsBoolean({value:o})}};n();a();s();var wo=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){switch(r.typeReference.type){case"list":return this.Collection.list(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"literal":return this.convertLiteral({literal:r.typeReference.value});case"map":return this.Collection.map(this.convert({typeReference:r.typeReference.key}),this.convert({typeReference:r.typeReference.value}));case"named":{let i=this.context.resolveNamedType({typeId:r.typeReference.value});return i==null?this.convertUnknown():this.convertNamed({named:i,typeId:r.typeReference.value})}case"optional":case"nullable":{let i=this.convert({typeReference:r.typeReference.value});return r.unboxOptionals?i.asNonOptional():i.asOptional()}case"primitive":return this.convertPrimitive({primitive:r.typeReference.value});case"set":return this.Collection.set(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:ue(r.typeReference)}}convertToClassReference(r,i){return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)})}convertNamed({named:r,typeId:i}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.convert({typeReference:r.typeReference});case"enum":case"object":return this.convertToClassReference(r,i);case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertToClassReference(r,i):this.Primitive.object;case"undiscriminatedUnion":return this.settings.shouldGenerateUndiscriminatedUnions?this.convertToClassReference(r,i):this.OneOf.OneOf(r.types.map(o=>this.convert({typeReference:o})));default:ue(r)}}convertLiteral({literal:r}){switch(r.type){case"boolean":return this.Primitive.boolean;case"string":return this.Primitive.string}}convertUnknown(){return this.Primitive.object}convertPrimitive({primitive:r}){switch(r){case"INTEGER":return this.Primitive.integer;case"UINT":return this.Primitive.uint;case"LONG":return this.Primitive.long;case"UINT_64":return this.Primitive.ulong;case"FLOAT":return this.Primitive.float;case"DOUBLE":return this.Primitive.double;case"BOOLEAN":return this.Primitive.boolean;case"STRING":return this.Primitive.string;case"DATE":return this.Value.dateOnly;case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.Value.dateTime;case"UUID":return this.Primitive.string;case"BASE_64":return this.Primitive.string;case"BIG_INTEGER":return this.Primitive.string;default:ue(r)}}};n();a();s();var To=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}getFilePropertyInfo({body:r,value:i}){let o={fileFields:[],bodyPropertyFields:[]},c=this.context.getRecord(i)??{};for(let p of r.properties)switch(p.type){case"file":v.Record.missingKey(c,p.wireValue)&&(c[p.wireValue]="[bytes]"),o.fileFields.push({name:this.context.getPropertyName(p.name),value:this.getSingleFileProperty({property:p,record:c})});break;case"fileArray":v.Record.missingKey(c,p.wireValue)&&(c[p.wireValue]=["[bytes]"]),o.fileFields.push({name:this.context.getPropertyName(p.name),value:this.getArrayFileProperty({property:p,record:c})});break;case"bodyProperty":if(v.Record.missingKey(c,p.name.wireValue))switch(p.typeReference.type){case"optional":break;case"primitive":{switch(p.typeReference.value.toLowerCase()){case"integer":{c[p.name.wireValue]=123;break}case"string":{c[p.name.wireValue]="[string]";break}case"boolean":{c[p.name.wireValue]=!0;break}case"double":{c[p.name.wireValue]=123.456;break}case"float":{c[p.name.wireValue]=123.456;break}case"long":{c[p.name.wireValue]=123456789;break}case"uint":{c[p.name.wireValue]=123;break}case"uint64":{c[p.name.wireValue]=12345;break}case"date":{c[p.name.wireValue]=new Date(2021,1,1);break}case"datetime":{c[p.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{c[p.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{c[p.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{c[p.name.wireValue]="12345678901234567890";break}}break}default:break}o.bodyPropertyFields.push({name:this.context.getPropertyName(p.name.name),value:this.getBodyProperty({property:p,record:c})});break;default:ue(p)}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 Eo=class e extends Yi{constructor({ir:r,config:i,options:o,generation:c}){super({ir:r,config:i,options:o});y(this,"ir");y(this,"dynamicTypeMapper");y(this,"dynamicLiteralMapper");y(this,"filePropertyMapper");y(this,"generation");this.ir=r,this.generation=c??new kn(r,i.workspaceName,i.customConfig!=null?i.customConfig:{},i),this.dynamicTypeMapper=new wo({context:this}),this.dynamicLiteralMapper=new So({context:this}),this.filePropertyMapper=new To({context:this})}get namespaces(){return this.generation.namespaces}get registry(){return this.generation.registry}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get csharp(){return this.generation.csharp}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}clone(){return new e({ir:this.ir,config:this.config,options:this.options,generation:this.generation})}getFileParameterForString(r){return this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.FileParameter,arguments_:[],properties:[{name:"Stream",value:this.getMemoryStreamForString(r)}],multiline:!0}))}getMemoryStreamForString(r){return this.System.IO.MemoryStream.new({arguments_:[this.csharp.invokeMethod({on:this.System.Text.Encoding_UTF8,method:"GetBytes",arguments_:[this.csharp.Literal.string(r)]})]})}getClassName(r){return r.pascalCase.safeName}getParameterName(r){return r.camelCase.safeName}getPropertyName(r){return r.pascalCase.safeName}resolvePropertyName(r,i){let o=i.pascalCase.safeName,c=r.scope.getRedirectedFieldName(o);return c||(r.scope.isField(o)?o:r.registerField(o))}getMethodName(r){return`${r.pascalCase.safeName}Async`}getNamespace(r,i){let o=this.getNamespaceSegments(r);return o=i!=null?[...o,i]:o,[this.namespaces.root,...o].join(".")}getEnvironmentTypeReferenceFromID(r){let i=this.resolveEnvironmentName(r);if(i!=null)return this.getEnvironmentClassReferenceForEnumName(i)}getEnvironmentClassReferenceForEnumName(r){return this.csharp.classReference({name:`${this.generation.Types.Environments.name}.${this.getClassName(r)}`,namespace:this.namespaces.root})}getNamespaceSegments(r){return(this.settings.explicitNamespaces?r.allParts:r.packagePath).map(o=>o.pascalCase.safeName)}precalculate(r){this.generation.initialize(),this.System.Collections.Generic.KeyValuePair(),this.System.Collections.Generic.IEnumerable(),this.System.Collections.Generic.IAsyncEnumerable(),this.System.Collections.Generic.HashSet(),this.System.Collections.Generic.List(),this.System.Collections.Generic.Dictionary(),this.System.Threading.Tasks.Task(),Object.entries(this.ir.types).sort((i,o)=>i[0].length-o[0].length).forEach(([i,o])=>{this.dynamicTypeMapper.convertToClassReference(o,i)});for(let[i,o]of r.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${i}`),namespace:"Usage"}),o.endpoint){let c=this.resolveEndpointLocation(o.endpoint);for(let p of c)switch(p.request.type){case"inlined":this.csharp.classReference({origin:p.request.declaration.name,namespace:this.getNamespace(p.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClientForSnippets,this.csharp.freezeClassReferences()}};n();a();s();var Io=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}async generateSnippet({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}generateSnippetSync({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}async generateSnippetAst({endpoint:r,request:i,options:o}){throw new Error("Unsupported")}buildCodeBlock({endpoint:r,snippet:i,options:o}){if(r.examples&&v.DynamicIR.EndpointExample(i)&&!r.examples.find(x=>x.id===i.id))throw new Error("Endpoint does not have an example that matches the snippet");let c=this.csharp.codeblock(x=>{x.writeNodeStatement(this.constructClient({endpoint:r,snippet:i})),x.newLine(),x.writeNodeStatement(this.callMethod({endpoint:r,snippet:i}))}),p=this.getStyle(o);switch(p){case Jt.Concise:return c;case Jt.Full:return this.buildFullCodeBlock({body:c,options:o});default:ue(p)}}buildFullCodeBlock({body:r,options:i}){let o=this.getConfig(i),c=o.fullStyleMethodName??o.fullStyleClassName??"Example",p=this.csharp.class_({name:"Examples",namespace:"Examples",partial:!0,skipNamespaceDeclaration:!0,access:Ii.Access.Public});return p.addNamespaceReference(this.Types.RootClientForSnippets.namespace),p.addMethod({name:c,access:Ii.Access.Public,isAsync:!0,parameters:[],body:r}),p}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(p=>{p.write("await foreach (var item in "),p.writeNode(c),p.writeLine(")"),p.pushScope(),p.writeLine("/* consume each item */"),p.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:ee.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let c=[],p=this.getConstructorBaseUrlArgs({baseUrl:i.baseURL,environment:i.environment});p.length>0&&c.push(...p),this.context.errors.scope(tt.Headers);let x=[];if(this.context.ir.headers!=null&&i.headers!=null&&x.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:i.headers})),this.context.errors.unscope(),this.settings.unifiedClientOptions){let w=[...o.map(I=>({name:Le(I.name),assignment:I.assignment})),...x.map(I=>({name:Le(I.name),assignment:I.assignment})),...c.map(I=>({name:I.name,assignment:I.assignment}))];return w.length===0?[]:[{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:w,multiline:!0})}]}return c.length===0?[...o,...x]:[...o,...x,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:c.map(w=>({name:w.name,assignment:w.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:r,environment:i}){let o=this.getBaseUrlArg({baseUrl:r,environment:i});return v.Literal.nop(o)?[]:[{name:this.getBaseUrlOptionName(),assignment:o}]}getBaseUrlArg({baseUrl:r,environment:i}){if(r!=null&&i!=null)return this.context.errors.add({severity:ee.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:ee.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:ee.Warning,message:`Environment ${JSON.stringify(i)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(o)}if(this.context.isMultiEnvironmentValues(i))return this.context.validateMultiEnvironmentUrlValues(i)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(i).map(([o,c])=>({name:Le(cr(o)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:c})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:r,values:i}){if(i.type!==r.type)return this.addError(this.context.newAuthMismatchError({auth:r,values:i}).message),[];switch(r.type){case"basic":return i.type==="basic"?this.getConstructorBasicAuthArg({auth:r,values:i}):[];case"bearer":return i.type==="bearer"?this.getConstructorBearerAuthArgs({auth:r,values:i}):[];case"header":return i.type==="header"?this.getConstructorHeaderAuthArgs({auth:r,values:i}):[];case"oauth":return i.type==="oauth"?this.getConstructorOAuthArgs({auth:r,values:i}):[];case"inferred":return i.type==="inferred"?this.getConstructorInferredAuthArgs({auth:r,values:i}):[];default:ue(r)}}addError(r){this.context.errors.add({severity:ee.Critical,message:r})}addWarning(r){this.context.errors.add({severity:ee.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:i}){let o=r,c=!!o.usernameOmit,p=!!o.passwordOmit,x=[];return c||x.push({name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(i.username)}),p||x.push({name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(i.password)}),x}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 p=c.name.wireValue,x=i.values?.[p];o.push({name:this.context.getParameterName(c.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:c.typeReference,value:x,fallbackToDefault:p})})}else this.context.errors.add({severity:ee.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 p=i[c.name.wireValue],x=this.getConstructorHeaderArg({header:c,value:p});x!=null&&o.push({name:this.context.getParameterName(c.name.name),assignment:x})}return o}getConstructorHeaderArg({header:r,value:i}){let o=this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:i,fallbackToDefault:r.name.wireValue});if(!v.Literal.nop(o))return o}getMethodArgs({endpoint:r,snippet:i}){switch(r.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:r.request,snippet:i});case"body":return this.getMethodArgsForBodyRequest({request:r.request,snippet:i});default:ue(r.request)}}getMethodArgsForInlinedRequest({request:r,snippet:i}){let o=[];this.context.errors.scope(tt.PathParameters);let c=[],p=[...this.context.ir.pathParameters??[],...r.pathParameters??[]];p.length>0&&c.push(...this.getPathParameters({namedParameters:p,snippet:i})),this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let x=this.getFilePropertyInfo({request:r,snippet:i});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})||o.push(...c.map(w=>w.value)),o.push(this.getInlinedRequestArg({request:r,snippet:i,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})?c:[],filePropertyInfo:x})),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}){let p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)});this.context.errors.scope(tt.QueryParameters);let w=this.context.associateQueryParametersByWireValue({parameters:r.queryParameters??[],values:i.queryParameters??{}}).map(F=>({name:this.context.resolvePropertyName(p,F.name.name),value:this.context.dynamicLiteralMapper.convert(F)}));this.context.errors.unscope(),this.context.errors.scope(tt.Headers);let A=this.context.associateByWireValue({parameters:r.headers??[],values:i.headers??{}}).map(F=>({name:this.context.resolvePropertyName(p,F.name.name),value:this.context.dynamicLiteralMapper.convert({...F,fallbackToDefault:F.name.wireValue})}));this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let P=r.body!=null?this.getInlinedRequestBodyConstructorFields({body:r.body,value:i.requestBody,filePropertyInfo:c,classReference:p}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:p,fields:[...o,...w,...A,...P]})}getInlinedRequestBodyConstructorFields({body:r,value:i,filePropertyInfo:o,classReference:c}){switch(r.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:r.value,value:i,classReference:c});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:c})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:o});default:ue(r)}}getInlinedRequestBodyPropertyConstructorFields({parameters:r,value:i,classReference:o}){let c=[],p=this.context.associateByWireValue({parameters:r,values:this.context.getRecord(i)??{}});for(let x of p)c.push({name:this.context.resolvePropertyName(o,x.name.name),value:this.context.dynamicLiteralMapper.convert({...x,fallbackToDefault:x.name.wireValue})});return c}getFileUploadRequestBodyConstructorFields({filePropertyInfo:r}){return[...r.fileFields,...r.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:o}){return{name:this.context.resolvePropertyName(o,r.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:r.bodyType,value:i})}}getReferencedRequestBodyPropertyLiteral({body:r,value:i}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:i});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:i,fallbackToDefault:JSON.stringify(r.value)});default:ue(r)}}getMethodArgsForBodyRequest({request:r,snippet:i}){let o=[];this.context.errors.scope(tt.PathParameters);let c=[...this.context.ir.pathParameters??[],...r.pathParameters??[]];return c.length>0&&o.push(...this.getPathParameters({namedParameters:c,snippet:i}).map(p=>p.value)),this.context.errors.unscope(),this.context.errors.scope(tt.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:ue(r)}}getBytesBodyRequestArg({value:r}){let i=this.context.getValueAsString({value:r});return i==null&&(this.context.errors.add({severity:ee.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 p of c)o.push({name:this.context.getPropertyName(p.name.name),value:this.context.dynamicLiteralMapper.convert({...p,fallbackToDefault:p.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??Jt.Full}getConfig(r){return r.config??this.context.options.config??{}}};var Ao=class extends Ji{constructor({ir:t,config:r,options:i={}}){super(new Eo({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 Io({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
34
34
|
/*! Bundled license information:
|
|
35
35
|
|
|
36
36
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|