Decompiled source of SOTFEdit v0.12.7

de/MahApps.Metro.resources.dll

Decompiled 5 months ago
using System.Reflection;

[assembly: AssemblyTitle("MahApps.Metro")]
[assembly: AssemblyDescription("MahApps.Metro, a toolkit for creating Metro / Modern UI styled WPF applications.")]
[assembly: AssemblyCompany("MahApps")]
[assembly: AssemblyProduct("MahApps.Metro")]
[assembly: AssemblyInformationalVersion("2.4.9-rc.2+Branch.main.Sha.dd0798b60f6ecdeb776d453be3c8a7f41e3283a7.dd0798b60f6ecdeb776d453be3c8a7f41e3283a7")]
[assembly: AssemblyCopyright("Copyright © 2021 .NET Foundation and Contributors. All rights reserved.")]
[assembly: AssemblyFileVersion("2.4.9.2")]
[assembly: AssemblyVersion("2.0.0.0")]

runtimes/browser/lib/net6.0/System.Text.Encodings.Web.dll

Decompiled 5 months ago
using System;
using System.Buffers;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Numerics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
using System.Runtime.Intrinsics.X86;
using System.Runtime.Versioning;
using System.Text.Unicode;
using System.Threading;
using FxResources.System.Text.Encodings.Web;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Text.Encodings.Web")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides types for encoding and escaping strings for use in JavaScript, HyperText Markup Language (HTML), and uniform resource locators (URL).\r\n\r\nCommonly Used Types:\r\nSystem.Text.Encodings.Web.HtmlEncoder\r\nSystem.Text.Encodings.Web.UrlEncoder\r\nSystem.Text.Encodings.Web.JavaScriptEncoder")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Text.Encodings.Web")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SupportedOSPlatform("Browser")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
[module: SkipLocalsInit]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NativeIntegerAttribute : Attribute
	{
		public readonly bool[] TransformFlags;

		public NativeIntegerAttribute()
		{
			TransformFlags = new bool[1] { true };
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FxResources.System.Text.Encodings.Web
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class HexConverter
	{
		public enum Casing : uint
		{
			Upper = 0u,
			Lower = 8224u
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
		{
			uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
			uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
			buffer[startingIndex + 1] = (byte)num2;
			buffer[startingIndex] = (byte)(num2 >> 8);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
		{
			uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
			uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
			buffer[startingIndex + 1] = (char)(num2 & 0xFFu);
			buffer[startingIndex] = (char)(num2 >> 8);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static char ToCharUpper(int value)
		{
			value &= 0xF;
			value += 48;
			if (value > 57)
			{
				value += 7;
			}
			return (char)value;
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

		internal static string TextEncoderDoesNotImplementMaxOutputCharsPerInputChar => GetResourceString("TextEncoderDoesNotImplementMaxOutputCharsPerInputChar");

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

		internal static string GetResourceString(string resourceKey)
		{
			if (UsingResourceKeys())
			{
				return resourceKey;
			}
			string result = null;
			try
			{
				result = ResourceManager.GetString(resourceKey);
			}
			catch (MissingManifestResourceException)
			{
			}
			return result;
		}
	}
}
namespace System.Text
{
	internal static class UnicodeUtility
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsAsciiCodePoint(uint value)
		{
			return value <= 127;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsBmpCodePoint(uint value)
		{
			return value <= 65535;
		}
	}
	[DefaultMember("Item")]
	internal ref struct ValueStringBuilder
	{
		private char[] _arrayToReturnToPool;

		private Span<char> _chars;

		private int _pos;

		public int Length
		{
			get
			{
				return _pos;
			}
			set
			{
				_pos = value;
			}
		}

		public ValueStringBuilder(Span<char> initialBuffer)
		{
			_arrayToReturnToPool = null;
			_chars = initialBuffer;
			_pos = 0;
		}

		public override string ToString()
		{
			string result = _chars.Slice(0, _pos).ToString();
			Dispose();
			return result;
		}

		public ReadOnlySpan<char> AsSpan()
		{
			return _chars.Slice(0, _pos);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Span<char> AppendSpan(int length)
		{
			int pos = _pos;
			if (pos > _chars.Length - length)
			{
				Grow(length);
			}
			_pos = pos + length;
			return _chars.Slice(pos, length);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void Grow(int additionalCapacityBeyondPos)
		{
			int minimumLength = (int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), Math.Min((uint)(_chars.Length * 2), 2147483591u));
			char[] array = ArrayPool<char>.Shared.Rent(minimumLength);
			_chars.Slice(0, _pos).CopyTo(array);
			char[] arrayToReturnToPool = _arrayToReturnToPool;
			_chars = (_arrayToReturnToPool = array);
			if (arrayToReturnToPool != null)
			{
				ArrayPool<char>.Shared.Return(arrayToReturnToPool);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Dispose()
		{
			char[] arrayToReturnToPool = _arrayToReturnToPool;
			this = default(System.Text.ValueStringBuilder);
			if (arrayToReturnToPool != null)
			{
				ArrayPool<char>.Shared.Return(arrayToReturnToPool);
			}
		}
	}
}
namespace System.Text.Unicode
{
	internal static class UnicodeHelpers
	{
		private static ReadOnlySpan<byte> DefinedCharsBitmapSpan => new byte[8192]
		{
			0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 127, 0, 0, 0, 0,
			254, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 252, 240, 215, 255, 255, 251, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 254, 255, 255, 255,
			127, 254, 255, 255, 255, 255, 255, 231, 254, 255,
			255, 255, 255, 255, 255, 0, 255, 255, 255, 135,
			31, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 191, 255, 255, 255, 255,
			255, 255, 255, 231, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 3, 0, 255, 255,
			255, 255, 255, 255, 255, 231, 255, 255, 255, 255,
			255, 63, 255, 127, 255, 255, 255, 79, 255, 7,
			255, 255, 255, 127, 3, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 239, 159, 249, 255, 255, 253,
			197, 243, 159, 121, 128, 176, 207, 255, 255, 127,
			238, 135, 249, 255, 255, 253, 109, 211, 135, 57,
			2, 94, 192, 255, 127, 0, 238, 191, 251, 255,
			255, 253, 237, 243, 191, 59, 1, 0, 207, 255,
			3, 254, 238, 159, 249, 255, 255, 253, 237, 243,
			159, 57, 224, 176, 207, 255, 255, 0, 236, 199,
			61, 214, 24, 199, 255, 195, 199, 61, 129, 0,
			192, 255, 255, 7, 255, 223, 253, 255, 255, 253,
			255, 243, 223, 61, 96, 39, 207, 255, 128, 255,
			255, 223, 253, 255, 255, 253, 239, 243, 223, 61,
			96, 96, 207, 255, 6, 0, 255, 223, 253, 255,
			255, 255, 255, 255, 223, 253, 240, 255, 207, 255,
			255, 255, 238, 255, 127, 252, 255, 255, 251, 47,
			127, 132, 95, 255, 192, 255, 28, 0, 254, 255,
			255, 255, 255, 255, 255, 135, 255, 255, 255, 15,
			0, 0, 0, 0, 214, 247, 255, 255, 175, 255,
			255, 63, 95, 63, 255, 243, 0, 0, 0, 0,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 254,
			255, 255, 255, 31, 254, 255, 255, 255, 255, 254,
			255, 255, 255, 223, 255, 223, 255, 7, 0, 0,
			0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 191, 32, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 61, 127, 61, 255, 255,
			255, 255, 255, 61, 255, 255, 255, 255, 61, 127,
			61, 255, 127, 255, 255, 255, 255, 255, 255, 255,
			61, 255, 255, 255, 255, 255, 255, 255, 255, 231,
			255, 255, 255, 31, 255, 255, 255, 3, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 63, 63,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			254, 255, 255, 31, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 1, 255, 255, 63, 128,
			255, 255, 127, 0, 255, 255, 15, 0, 255, 223,
			13, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 63, 255, 3, 255, 3, 255, 255,
			255, 3, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 1, 255, 255, 255, 255, 255, 7,
			255, 255, 255, 255, 255, 255, 255, 255, 63, 0,
			255, 255, 255, 127, 255, 15, 255, 15, 241, 255,
			255, 255, 255, 63, 31, 0, 255, 255, 255, 255,
			255, 15, 255, 255, 255, 3, 255, 199, 255, 255,
			255, 255, 255, 255, 255, 207, 255, 255, 255, 255,
			255, 255, 255, 127, 255, 255, 255, 159, 255, 3,
			255, 3, 255, 63, 255, 255, 255, 127, 0, 0,
			0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 31, 255, 255, 255, 255, 255, 127,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 15, 240, 255, 255, 255, 255,
			255, 255, 255, 248, 255, 227, 255, 255, 255, 255,
			255, 255, 255, 1, 255, 255, 255, 255, 255, 231,
			255, 0, 255, 255, 255, 255, 255, 7, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 63, 63, 255, 255, 255, 255,
			63, 63, 255, 170, 255, 255, 255, 63, 255, 255,
			255, 255, 255, 255, 223, 255, 223, 255, 207, 239,
			255, 255, 220, 127, 0, 248, 255, 255, 255, 124,
			255, 255, 255, 255, 255, 127, 223, 255, 243, 255,
			255, 127, 255, 31, 255, 255, 255, 255, 1, 0,
			255, 255, 255, 255, 1, 0, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 15, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 127, 0, 0, 0,
			255, 7, 0, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			207, 255, 255, 255, 191, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 15, 254,
			255, 255, 255, 255, 191, 32, 255, 255, 255, 255,
			255, 255, 255, 128, 1, 128, 255, 255, 127, 0,
			127, 127, 127, 127, 127, 127, 127, 127, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 63, 0, 0, 0, 0, 255, 255,
			255, 251, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 15, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			63, 0, 0, 0, 255, 15, 254, 255, 255, 255,
			255, 255, 255, 255, 254, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 127, 254, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 224, 255,
			255, 255, 255, 255, 254, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 127, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 15, 0, 255, 255,
			255, 255, 255, 127, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 31, 255, 255, 255, 255,
			255, 255, 127, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 15, 0, 0,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 7,
			235, 3, 0, 0, 252, 255, 255, 255, 255, 255,
			255, 31, 255, 3, 255, 255, 255, 255, 255, 255,
			255, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			63, 192, 255, 3, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 15, 128,
			255, 255, 255, 31, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 191, 255, 195, 255, 255, 255, 127,
			255, 255, 255, 255, 255, 255, 127, 0, 255, 63,
			255, 243, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 7, 0, 0, 248, 255, 255,
			127, 0, 126, 126, 126, 0, 127, 127, 255, 255,
			255, 255, 255, 255, 255, 15, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 63, 255, 3, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			15, 0, 255, 255, 127, 248, 255, 255, 255, 255,
			255, 15, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 63, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 3, 0, 0,
			0, 0, 127, 0, 248, 224, 255, 255, 127, 95,
			219, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 7, 0, 248, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 252, 255, 255, 255, 255, 255,
			255, 128, 0, 0, 0, 0, 255, 255, 255, 255,
			255, 3, 255, 255, 255, 255, 255, 255, 247, 255,
			127, 15, 223, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 31,
			254, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 127, 252, 252, 252, 28, 127, 127,
			0, 62
		};

		internal static ReadOnlySpan<byte> GetDefinedBmpCodePointsBitmapLittleEndian()
		{
			return DefinedCharsBitmapSpan;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void GetUtf16SurrogatePairFromAstralScalarValue(uint scalar, out char highSurrogate, out char lowSurrogate)
		{
			highSurrogate = (char)(scalar + 56557568 >> 10);
			lowSurrogate = (char)((scalar & 0x3FF) + 56320);
		}

		internal static int GetUtf8RepresentationForScalarValue(uint scalar)
		{
			if (scalar <= 127)
			{
				return (byte)scalar;
			}
			if (scalar <= 2047)
			{
				byte b = (byte)(0xC0u | (scalar >> 6));
				byte b2 = (byte)(0x80u | (scalar & 0x3Fu));
				return (b2 << 8) | b;
			}
			if (scalar <= 65535)
			{
				byte b3 = (byte)(0xE0u | (scalar >> 12));
				byte b4 = (byte)(0x80u | ((scalar >> 6) & 0x3Fu));
				byte b5 = (byte)(0x80u | (scalar & 0x3Fu));
				return (((b5 << 8) | b4) << 8) | b3;
			}
			byte b6 = (byte)(0xF0u | (scalar >> 18));
			byte b7 = (byte)(0x80u | ((scalar >> 12) & 0x3Fu));
			byte b8 = (byte)(0x80u | ((scalar >> 6) & 0x3Fu));
			byte b9 = (byte)(0x80u | (scalar & 0x3Fu));
			return (((((b9 << 8) | b8) << 8) | b7) << 8) | b6;
		}
	}
	public sealed class UnicodeRange
	{
		public int FirstCodePoint { get; private set; }

		public int Length { get; private set; }

		public UnicodeRange(int firstCodePoint, int length)
		{
			if (firstCodePoint < 0 || firstCodePoint > 65535)
			{
				throw new ArgumentOutOfRangeException("firstCodePoint");
			}
			if (length < 0 || (long)firstCodePoint + (long)length > 65536)
			{
				throw new ArgumentOutOfRangeException("length");
			}
			FirstCodePoint = firstCodePoint;
			Length = length;
		}

		public static UnicodeRange Create(char firstCharacter, char lastCharacter)
		{
			if (lastCharacter < firstCharacter)
			{
				throw new ArgumentOutOfRangeException("lastCharacter");
			}
			return new UnicodeRange(firstCharacter, 1 + (lastCharacter - firstCharacter));
		}
	}
	public static class UnicodeRanges
	{
		private static UnicodeRange _none;

		private static UnicodeRange _all;

		private static UnicodeRange _u0000;

		private static UnicodeRange _u0080;

		private static UnicodeRange _u0100;

		private static UnicodeRange _u0180;

		private static UnicodeRange _u0250;

		private static UnicodeRange _u02B0;

		private static UnicodeRange _u0300;

		private static UnicodeRange _u0370;

		private static UnicodeRange _u0400;

		private static UnicodeRange _u0500;

		private static UnicodeRange _u0530;

		private static UnicodeRange _u0590;

		private static UnicodeRange _u0600;

		private static UnicodeRange _u0700;

		private static UnicodeRange _u0750;

		private static UnicodeRange _u0780;

		private static UnicodeRange _u07C0;

		private static UnicodeRange _u0800;

		private static UnicodeRange _u0840;

		private static UnicodeRange _u0860;

		private static UnicodeRange _u0870;

		private static UnicodeRange _u08A0;

		private static UnicodeRange _u0900;

		private static UnicodeRange _u0980;

		private static UnicodeRange _u0A00;

		private static UnicodeRange _u0A80;

		private static UnicodeRange _u0B00;

		private static UnicodeRange _u0B80;

		private static UnicodeRange _u0C00;

		private static UnicodeRange _u0C80;

		private static UnicodeRange _u0D00;

		private static UnicodeRange _u0D80;

		private static UnicodeRange _u0E00;

		private static UnicodeRange _u0E80;

		private static UnicodeRange _u0F00;

		private static UnicodeRange _u1000;

		private static UnicodeRange _u10A0;

		private static UnicodeRange _u1100;

		private static UnicodeRange _u1200;

		private static UnicodeRange _u1380;

		private static UnicodeRange _u13A0;

		private static UnicodeRange _u1400;

		private static UnicodeRange _u1680;

		private static UnicodeRange _u16A0;

		private static UnicodeRange _u1700;

		private static UnicodeRange _u1720;

		private static UnicodeRange _u1740;

		private static UnicodeRange _u1760;

		private static UnicodeRange _u1780;

		private static UnicodeRange _u1800;

		private static UnicodeRange _u18B0;

		private static UnicodeRange _u1900;

		private static UnicodeRange _u1950;

		private static UnicodeRange _u1980;

		private static UnicodeRange _u19E0;

		private static UnicodeRange _u1A00;

		private static UnicodeRange _u1A20;

		private static UnicodeRange _u1AB0;

		private static UnicodeRange _u1B00;

		private static UnicodeRange _u1B80;

		private static UnicodeRange _u1BC0;

		private static UnicodeRange _u1C00;

		private static UnicodeRange _u1C50;

		private static UnicodeRange _u1C80;

		private static UnicodeRange _u1C90;

		private static UnicodeRange _u1CC0;

		private static UnicodeRange _u1CD0;

		private static UnicodeRange _u1D00;

		private static UnicodeRange _u1D80;

		private static UnicodeRange _u1DC0;

		private static UnicodeRange _u1E00;

		private static UnicodeRange _u1F00;

		private static UnicodeRange _u2000;

		private static UnicodeRange _u2070;

		private static UnicodeRange _u20A0;

		private static UnicodeRange _u20D0;

		private static UnicodeRange _u2100;

		private static UnicodeRange _u2150;

		private static UnicodeRange _u2190;

		private static UnicodeRange _u2200;

		private static UnicodeRange _u2300;

		private static UnicodeRange _u2400;

		private static UnicodeRange _u2440;

		private static UnicodeRange _u2460;

		private static UnicodeRange _u2500;

		private static UnicodeRange _u2580;

		private static UnicodeRange _u25A0;

		private static UnicodeRange _u2600;

		private static UnicodeRange _u2700;

		private static UnicodeRange _u27C0;

		private static UnicodeRange _u27F0;

		private static UnicodeRange _u2800;

		private static UnicodeRange _u2900;

		private static UnicodeRange _u2980;

		private static UnicodeRange _u2A00;

		private static UnicodeRange _u2B00;

		private static UnicodeRange _u2C00;

		private static UnicodeRange _u2C60;

		private static UnicodeRange _u2C80;

		private static UnicodeRange _u2D00;

		private static UnicodeRange _u2D30;

		private static UnicodeRange _u2D80;

		private static UnicodeRange _u2DE0;

		private static UnicodeRange _u2E00;

		private static UnicodeRange _u2E80;

		private static UnicodeRange _u2F00;

		private static UnicodeRange _u2FF0;

		private static UnicodeRange _u3000;

		private static UnicodeRange _u3040;

		private static UnicodeRange _u30A0;

		private static UnicodeRange _u3100;

		private static UnicodeRange _u3130;

		private static UnicodeRange _u3190;

		private static UnicodeRange _u31A0;

		private static UnicodeRange _u31C0;

		private static UnicodeRange _u31F0;

		private static UnicodeRange _u3200;

		private static UnicodeRange _u3300;

		private static UnicodeRange _u3400;

		private static UnicodeRange _u4DC0;

		private static UnicodeRange _u4E00;

		private static UnicodeRange _uA000;

		private static UnicodeRange _uA490;

		private static UnicodeRange _uA4D0;

		private static UnicodeRange _uA500;

		private static UnicodeRange _uA640;

		private static UnicodeRange _uA6A0;

		private static UnicodeRange _uA700;

		private static UnicodeRange _uA720;

		private static UnicodeRange _uA800;

		private static UnicodeRange _uA830;

		private static UnicodeRange _uA840;

		private static UnicodeRange _uA880;

		private static UnicodeRange _uA8E0;

		private static UnicodeRange _uA900;

		private static UnicodeRange _uA930;

		private static UnicodeRange _uA960;

		private static UnicodeRange _uA980;

		private static UnicodeRange _uA9E0;

		private static UnicodeRange _uAA00;

		private static UnicodeRange _uAA60;

		private static UnicodeRange _uAA80;

		private static UnicodeRange _uAAE0;

		private static UnicodeRange _uAB00;

		private static UnicodeRange _uAB30;

		private static UnicodeRange _uAB70;

		private static UnicodeRange _uABC0;

		private static UnicodeRange _uAC00;

		private static UnicodeRange _uD7B0;

		private static UnicodeRange _uF900;

		private static UnicodeRange _uFB00;

		private static UnicodeRange _uFB50;

		private static UnicodeRange _uFE00;

		private static UnicodeRange _uFE10;

		private static UnicodeRange _uFE20;

		private static UnicodeRange _uFE30;

		private static UnicodeRange _uFE50;

		private static UnicodeRange _uFE70;

		private static UnicodeRange _uFF00;

		private static UnicodeRange _uFFF0;

		public static UnicodeRange None => _none ?? CreateEmptyRange(ref _none);

		public static UnicodeRange All => _all ?? CreateRange(ref _all, '\0', '\uffff');

		public static UnicodeRange BasicLatin => _u0000 ?? CreateRange(ref _u0000, '\0', '\u007f');

		public static UnicodeRange Latin1Supplement => _u0080 ?? CreateRange(ref _u0080, '\u0080', 'ÿ');

		public static UnicodeRange LatinExtendedA => _u0100 ?? CreateRange(ref _u0100, 'Ā', 'ſ');

		public static UnicodeRange LatinExtendedB => _u0180 ?? CreateRange(ref _u0180, 'ƀ', 'ɏ');

		public static UnicodeRange IpaExtensions => _u0250 ?? CreateRange(ref _u0250, 'ɐ', 'ʯ');

		public static UnicodeRange SpacingModifierLetters => _u02B0 ?? CreateRange(ref _u02B0, 'ʰ', '\u02ff');

		public static UnicodeRange CombiningDiacriticalMarks => _u0300 ?? CreateRange(ref _u0300, '\u0300', '\u036f');

		public static UnicodeRange GreekandCoptic => _u0370 ?? CreateRange(ref _u0370, 'Ͱ', 'Ͽ');

		public static UnicodeRange Cyrillic => _u0400 ?? CreateRange(ref _u0400, 'Ѐ', 'ӿ');

		public static UnicodeRange CyrillicSupplement => _u0500 ?? CreateRange(ref _u0500, 'Ԁ', 'ԯ');

		public static UnicodeRange Armenian => _u0530 ?? CreateRange(ref _u0530, '\u0530', '֏');

		public static UnicodeRange Hebrew => _u0590 ?? CreateRange(ref _u0590, '\u0590', '\u05ff');

		public static UnicodeRange Arabic => _u0600 ?? CreateRange(ref _u0600, '\u0600', 'ۿ');

		public static UnicodeRange Syriac => _u0700 ?? CreateRange(ref _u0700, '܀', 'ݏ');

		public static UnicodeRange ArabicSupplement => _u0750 ?? CreateRange(ref _u0750, 'ݐ', 'ݿ');

		public static UnicodeRange Thaana => _u0780 ?? CreateRange(ref _u0780, 'ހ', '\u07bf');

		public static UnicodeRange NKo => _u07C0 ?? CreateRange(ref _u07C0, '߀', '߿');

		public static UnicodeRange Samaritan => _u0800 ?? CreateRange(ref _u0800, 'ࠀ', '\u083f');

		public static UnicodeRange Mandaic => _u0840 ?? CreateRange(ref _u0840, 'ࡀ', '\u085f');

		public static UnicodeRange SyriacSupplement => _u0860 ?? CreateRange(ref _u0860, 'ࡠ', '\u086f');

		public static UnicodeRange ArabicExtendedB => _u0870 ?? CreateRange(ref _u0870, '\u0870', '\u089f');

		public static UnicodeRange ArabicExtendedA => _u08A0 ?? CreateRange(ref _u08A0, 'ࢠ', '\u08ff');

		public static UnicodeRange Devanagari => _u0900 ?? CreateRange(ref _u0900, '\u0900', 'ॿ');

		public static UnicodeRange Bengali => _u0980 ?? CreateRange(ref _u0980, 'ঀ', '\u09ff');

		public static UnicodeRange Gurmukhi => _u0A00 ?? CreateRange(ref _u0A00, '\u0a00', '\u0a7f');

		public static UnicodeRange Gujarati => _u0A80 ?? CreateRange(ref _u0A80, '\u0a80', '\u0aff');

		public static UnicodeRange Oriya => _u0B00 ?? CreateRange(ref _u0B00, '\u0b00', '\u0b7f');

		public static UnicodeRange Tamil => _u0B80 ?? CreateRange(ref _u0B80, '\u0b80', '\u0bff');

		public static UnicodeRange Telugu => _u0C00 ?? CreateRange(ref _u0C00, '\u0c00', '౿');

		public static UnicodeRange Kannada => _u0C80 ?? CreateRange(ref _u0C80, 'ಀ', '\u0cff');

		public static UnicodeRange Malayalam => _u0D00 ?? CreateRange(ref _u0D00, '\u0d00', 'ൿ');

		public static UnicodeRange Sinhala => _u0D80 ?? CreateRange(ref _u0D80, '\u0d80', '\u0dff');

		public static UnicodeRange Thai => _u0E00 ?? CreateRange(ref _u0E00, '\u0e00', '\u0e7f');

		public static UnicodeRange Lao => _u0E80 ?? CreateRange(ref _u0E80, '\u0e80', '\u0eff');

		public static UnicodeRange Tibetan => _u0F00 ?? CreateRange(ref _u0F00, 'ༀ', '\u0fff');

		public static UnicodeRange Myanmar => _u1000 ?? CreateRange(ref _u1000, 'က', '႟');

		public static UnicodeRange Georgian => _u10A0 ?? CreateRange(ref _u10A0, 'Ⴀ', 'ჿ');

		public static UnicodeRange HangulJamo => _u1100 ?? CreateRange(ref _u1100, 'ᄀ', 'ᇿ');

		public static UnicodeRange Ethiopic => _u1200 ?? CreateRange(ref _u1200, 'ሀ', '\u137f');

		public static UnicodeRange EthiopicSupplement => _u1380 ?? CreateRange(ref _u1380, 'ᎀ', '\u139f');

		public static UnicodeRange Cherokee => _u13A0 ?? CreateRange(ref _u13A0, 'Ꭰ', '\u13ff');

		public static UnicodeRange UnifiedCanadianAboriginalSyllabics => _u1400 ?? CreateRange(ref _u1400, '᐀', 'ᙿ');

		public static UnicodeRange Ogham => _u1680 ?? CreateRange(ref _u1680, '\u1680', '\u169f');

		public static UnicodeRange Runic => _u16A0 ?? CreateRange(ref _u16A0, 'ᚠ', '\u16ff');

		public static UnicodeRange Tagalog => _u1700 ?? CreateRange(ref _u1700, 'ᜀ', '\u171f');

		public static UnicodeRange Hanunoo => _u1720 ?? CreateRange(ref _u1720, 'ᜠ', '\u173f');

		public static UnicodeRange Buhid => _u1740 ?? CreateRange(ref _u1740, 'ᝀ', '\u175f');

		public static UnicodeRange Tagbanwa => _u1760 ?? CreateRange(ref _u1760, 'ᝠ', '\u177f');

		public static UnicodeRange Khmer => _u1780 ?? CreateRange(ref _u1780, 'ក', '\u17ff');

		public static UnicodeRange Mongolian => _u1800 ?? CreateRange(ref _u1800, '᠀', '\u18af');

		public static UnicodeRange UnifiedCanadianAboriginalSyllabicsExtended => _u18B0 ?? CreateRange(ref _u18B0, 'ᢰ', '\u18ff');

		public static UnicodeRange Limbu => _u1900 ?? CreateRange(ref _u1900, 'ᤀ', '᥏');

		public static UnicodeRange TaiLe => _u1950 ?? CreateRange(ref _u1950, 'ᥐ', '\u197f');

		public static UnicodeRange NewTaiLue => _u1980 ?? CreateRange(ref _u1980, 'ᦀ', '᧟');

		public static UnicodeRange KhmerSymbols => _u19E0 ?? CreateRange(ref _u19E0, '᧠', '᧿');

		public static UnicodeRange Buginese => _u1A00 ?? CreateRange(ref _u1A00, 'ᨀ', '᨟');

		public static UnicodeRange TaiTham => _u1A20 ?? CreateRange(ref _u1A20, 'ᨠ', '\u1aaf');

		public static UnicodeRange CombiningDiacriticalMarksExtended => _u1AB0 ?? CreateRange(ref _u1AB0, '\u1ab0', '\u1aff');

		public static UnicodeRange Balinese => _u1B00 ?? CreateRange(ref _u1B00, '\u1b00', '\u1b7f');

		public static UnicodeRange Sundanese => _u1B80 ?? CreateRange(ref _u1B80, '\u1b80', 'ᮿ');

		public static UnicodeRange Batak => _u1BC0 ?? CreateRange(ref _u1BC0, 'ᯀ', '᯿');

		public static UnicodeRange Lepcha => _u1C00 ?? CreateRange(ref _u1C00, 'ᰀ', 'ᱏ');

		public static UnicodeRange OlChiki => _u1C50 ?? CreateRange(ref _u1C50, '᱐', '᱿');

		public static UnicodeRange CyrillicExtendedC => _u1C80 ?? CreateRange(ref _u1C80, 'ᲀ', '\u1c8f');

		public static UnicodeRange GeorgianExtended => _u1C90 ?? CreateRange(ref _u1C90, 'Ა', 'Ჿ');

		public static UnicodeRange SundaneseSupplement => _u1CC0 ?? CreateRange(ref _u1CC0, '᳀', '\u1ccf');

		public static UnicodeRange VedicExtensions => _u1CD0 ?? CreateRange(ref _u1CD0, '\u1cd0', '\u1cff');

		public static UnicodeRange PhoneticExtensions => _u1D00 ?? CreateRange(ref _u1D00, 'ᴀ', 'ᵿ');

		public static UnicodeRange PhoneticExtensionsSupplement => _u1D80 ?? CreateRange(ref _u1D80, 'ᶀ', 'ᶿ');

		public static UnicodeRange CombiningDiacriticalMarksSupplement => _u1DC0 ?? CreateRange(ref _u1DC0, '\u1dc0', '\u1dff');

		public static UnicodeRange LatinExtendedAdditional => _u1E00 ?? CreateRange(ref _u1E00, 'Ḁ', 'ỿ');

		public static UnicodeRange GreekExtended => _u1F00 ?? CreateRange(ref _u1F00, 'ἀ', '\u1fff');

		public static UnicodeRange GeneralPunctuation => _u2000 ?? CreateRange(ref _u2000, '\u2000', '\u206f');

		public static UnicodeRange SuperscriptsandSubscripts => _u2070 ?? CreateRange(ref _u2070, '⁰', '\u209f');

		public static UnicodeRange CurrencySymbols => _u20A0 ?? CreateRange(ref _u20A0, '₠', '\u20cf');

		public static UnicodeRange CombiningDiacriticalMarksforSymbols => _u20D0 ?? CreateRange(ref _u20D0, '\u20d0', '\u20ff');

		public static UnicodeRange LetterlikeSymbols => _u2100 ?? CreateRange(ref _u2100, '℀', '⅏');

		public static UnicodeRange NumberForms => _u2150 ?? CreateRange(ref _u2150, '⅐', '\u218f');

		public static UnicodeRange Arrows => _u2190 ?? CreateRange(ref _u2190, '←', '⇿');

		public static UnicodeRange MathematicalOperators => _u2200 ?? CreateRange(ref _u2200, '∀', '⋿');

		public static UnicodeRange MiscellaneousTechnical => _u2300 ?? CreateRange(ref _u2300, '⌀', '⏿');

		public static UnicodeRange ControlPictures => _u2400 ?? CreateRange(ref _u2400, '␀', '\u243f');

		public static UnicodeRange OpticalCharacterRecognition => _u2440 ?? CreateRange(ref _u2440, '⑀', '\u245f');

		public static UnicodeRange EnclosedAlphanumerics => _u2460 ?? CreateRange(ref _u2460, '①', '⓿');

		public static UnicodeRange BoxDrawing => _u2500 ?? CreateRange(ref _u2500, '─', '╿');

		public static UnicodeRange BlockElements => _u2580 ?? CreateRange(ref _u2580, '▀', '▟');

		public static UnicodeRange GeometricShapes => _u25A0 ?? CreateRange(ref _u25A0, '■', '◿');

		public static UnicodeRange MiscellaneousSymbols => _u2600 ?? CreateRange(ref _u2600, '☀', '⛿');

		public static UnicodeRange Dingbats => _u2700 ?? CreateRange(ref _u2700, '✀', '➿');

		public static UnicodeRange MiscellaneousMathematicalSymbolsA => _u27C0 ?? CreateRange(ref _u27C0, '⟀', '⟯');

		public static UnicodeRange SupplementalArrowsA => _u27F0 ?? CreateRange(ref _u27F0, '⟰', '⟿');

		public static UnicodeRange BraillePatterns => _u2800 ?? CreateRange(ref _u2800, '⠀', '⣿');

		public static UnicodeRange SupplementalArrowsB => _u2900 ?? CreateRange(ref _u2900, '⤀', '⥿');

		public static UnicodeRange MiscellaneousMathematicalSymbolsB => _u2980 ?? CreateRange(ref _u2980, '⦀', '⧿');

		public static UnicodeRange SupplementalMathematicalOperators => _u2A00 ?? CreateRange(ref _u2A00, '⨀', '⫿');

		public static UnicodeRange MiscellaneousSymbolsandArrows => _u2B00 ?? CreateRange(ref _u2B00, '⬀', '⯿');

		public static UnicodeRange Glagolitic => _u2C00 ?? CreateRange(ref _u2C00, 'Ⰰ', '\u2c5f');

		public static UnicodeRange LatinExtendedC => _u2C60 ?? CreateRange(ref _u2C60, 'Ⱡ', 'Ɀ');

		public static UnicodeRange Coptic => _u2C80 ?? CreateRange(ref _u2C80, 'Ⲁ', '⳿');

		public static UnicodeRange GeorgianSupplement => _u2D00 ?? CreateRange(ref _u2D00, 'ⴀ', '\u2d2f');

		public static UnicodeRange Tifinagh => _u2D30 ?? CreateRange(ref _u2D30, 'ⴰ', '\u2d7f');

		public static UnicodeRange EthiopicExtended => _u2D80 ?? CreateRange(ref _u2D80, 'ⶀ', '\u2ddf');

		public static UnicodeRange CyrillicExtendedA => _u2DE0 ?? CreateRange(ref _u2DE0, '\u2de0', '\u2dff');

		public static UnicodeRange SupplementalPunctuation => _u2E00 ?? CreateRange(ref _u2E00, '⸀', '\u2e7f');

		public static UnicodeRange CjkRadicalsSupplement => _u2E80 ?? CreateRange(ref _u2E80, '⺀', '\u2eff');

		public static UnicodeRange KangxiRadicals => _u2F00 ?? CreateRange(ref _u2F00, '⼀', '\u2fdf');

		public static UnicodeRange IdeographicDescriptionCharacters => _u2FF0 ?? CreateRange(ref _u2FF0, '⿰', '\u2fff');

		public static UnicodeRange CjkSymbolsandPunctuation => _u3000 ?? CreateRange(ref _u3000, '\u3000', '〿');

		public static UnicodeRange Hiragana => _u3040 ?? CreateRange(ref _u3040, '\u3040', 'ゟ');

		public static UnicodeRange Katakana => _u30A0 ?? CreateRange(ref _u30A0, '゠', 'ヿ');

		public static UnicodeRange Bopomofo => _u3100 ?? CreateRange(ref _u3100, '\u3100', 'ㄯ');

		public static UnicodeRange HangulCompatibilityJamo => _u3130 ?? CreateRange(ref _u3130, '\u3130', '\u318f');

		public static UnicodeRange Kanbun => _u3190 ?? CreateRange(ref _u3190, '㆐', '㆟');

		public static UnicodeRange BopomofoExtended => _u31A0 ?? CreateRange(ref _u31A0, 'ㆠ', 'ㆿ');

		public static UnicodeRange CjkStrokes => _u31C0 ?? CreateRange(ref _u31C0, '㇀', '\u31ef');

		public static UnicodeRange KatakanaPhoneticExtensions => _u31F0 ?? CreateRange(ref _u31F0, 'ㇰ', 'ㇿ');

		public static UnicodeRange EnclosedCjkLettersandMonths => _u3200 ?? CreateRange(ref _u3200, '㈀', '㋿');

		public static UnicodeRange CjkCompatibility => _u3300 ?? CreateRange(ref _u3300, '㌀', '㏿');

		public static UnicodeRange CjkUnifiedIdeographsExtensionA => _u3400 ?? CreateRange(ref _u3400, '㐀', '䶿');

		public static UnicodeRange YijingHexagramSymbols => _u4DC0 ?? CreateRange(ref _u4DC0, '䷀', '䷿');

		public static UnicodeRange CjkUnifiedIdeographs => _u4E00 ?? CreateRange(ref _u4E00, '一', '\u9fff');

		public static UnicodeRange YiSyllables => _uA000 ?? CreateRange(ref _uA000, 'ꀀ', '\ua48f');

		public static UnicodeRange YiRadicals => _uA490 ?? CreateRange(ref _uA490, '꒐', '\ua4cf');

		public static UnicodeRange Lisu => _uA4D0 ?? CreateRange(ref _uA4D0, 'ꓐ', '꓿');

		public static UnicodeRange Vai => _uA500 ?? CreateRange(ref _uA500, 'ꔀ', '\ua63f');

		public static UnicodeRange CyrillicExtendedB => _uA640 ?? CreateRange(ref _uA640, 'Ꙁ', '\ua69f');

		public static UnicodeRange Bamum => _uA6A0 ?? CreateRange(ref _uA6A0, 'ꚠ', '\ua6ff');

		public static UnicodeRange ModifierToneLetters => _uA700 ?? CreateRange(ref _uA700, '\ua700', 'ꜟ');

		public static UnicodeRange LatinExtendedD => _uA720 ?? CreateRange(ref _uA720, '\ua720', 'ꟿ');

		public static UnicodeRange SylotiNagri => _uA800 ?? CreateRange(ref _uA800, 'ꠀ', '\ua82f');

		public static UnicodeRange CommonIndicNumberForms => _uA830 ?? CreateRange(ref _uA830, '꠰', '\ua83f');

		public static UnicodeRange Phagspa => _uA840 ?? CreateRange(ref _uA840, 'ꡀ', '\ua87f');

		public static UnicodeRange Saurashtra => _uA880 ?? CreateRange(ref _uA880, '\ua880', '\ua8df');

		public static UnicodeRange DevanagariExtended => _uA8E0 ?? CreateRange(ref _uA8E0, '\ua8e0', '\ua8ff');

		public static UnicodeRange KayahLi => _uA900 ?? CreateRange(ref _uA900, '꤀', '꤯');

		public static UnicodeRange Rejang => _uA930 ?? CreateRange(ref _uA930, 'ꤰ', '꥟');

		public static UnicodeRange HangulJamoExtendedA => _uA960 ?? CreateRange(ref _uA960, 'ꥠ', '\ua97f');

		public static UnicodeRange Javanese => _uA980 ?? CreateRange(ref _uA980, '\ua980', '꧟');

		public static UnicodeRange MyanmarExtendedB => _uA9E0 ?? CreateRange(ref _uA9E0, 'ꧠ', '\ua9ff');

		public static UnicodeRange Cham => _uAA00 ?? CreateRange(ref _uAA00, 'ꨀ', '꩟');

		public static UnicodeRange MyanmarExtendedA => _uAA60 ?? CreateRange(ref _uAA60, 'ꩠ', 'ꩿ');

		public static UnicodeRange TaiViet => _uAA80 ?? CreateRange(ref _uAA80, 'ꪀ', '꫟');

		public static UnicodeRange MeeteiMayekExtensions => _uAAE0 ?? CreateRange(ref _uAAE0, 'ꫠ', '\uaaff');

		public static UnicodeRange EthiopicExtendedA => _uAB00 ?? CreateRange(ref _uAB00, '\uab00', '\uab2f');

		public static UnicodeRange LatinExtendedE => _uAB30 ?? CreateRange(ref _uAB30, 'ꬰ', '\uab6f');

		public static UnicodeRange CherokeeSupplement => _uAB70 ?? CreateRange(ref _uAB70, 'ꭰ', 'ꮿ');

		public static UnicodeRange MeeteiMayek => _uABC0 ?? CreateRange(ref _uABC0, 'ꯀ', '\uabff');

		public static UnicodeRange HangulSyllables => _uAC00 ?? CreateRange(ref _uAC00, '가', '\ud7af');

		public static UnicodeRange HangulJamoExtendedB => _uD7B0 ?? CreateRange(ref _uD7B0, 'ힰ', '\ud7ff');

		public static UnicodeRange CjkCompatibilityIdeographs => _uF900 ?? CreateRange(ref _uF900, '豈', '\ufaff');

		public static UnicodeRange AlphabeticPresentationForms => _uFB00 ?? CreateRange(ref _uFB00, 'ff', 'ﭏ');

		public static UnicodeRange ArabicPresentationFormsA => _uFB50 ?? CreateRange(ref _uFB50, 'ﭐ', '\ufdff');

		public static UnicodeRange VariationSelectors => _uFE00 ?? CreateRange(ref _uFE00, '\ufe00', '\ufe0f');

		public static UnicodeRange VerticalForms => _uFE10 ?? CreateRange(ref _uFE10, '︐', '\ufe1f');

		public static UnicodeRange CombiningHalfMarks => _uFE20 ?? CreateRange(ref _uFE20, '\ufe20', '\ufe2f');

		public static UnicodeRange CjkCompatibilityForms => _uFE30 ?? CreateRange(ref _uFE30, '︰', '\ufe4f');

		public static UnicodeRange SmallFormVariants => _uFE50 ?? CreateRange(ref _uFE50, '﹐', '\ufe6f');

		public static UnicodeRange ArabicPresentationFormsB => _uFE70 ?? CreateRange(ref _uFE70, 'ﹰ', '\ufeff');

		public static UnicodeRange HalfwidthandFullwidthForms => _uFF00 ?? CreateRange(ref _uFF00, '\uff00', '\uffef');

		public static UnicodeRange Specials => _uFFF0 ?? CreateRange(ref _uFFF0, '\ufff0', '\uffff');

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static UnicodeRange CreateEmptyRange([NotNull] ref UnicodeRange range)
		{
			Volatile.Write(ref range, new UnicodeRange(0, 0));
			return range;
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static UnicodeRange CreateRange([NotNull] ref UnicodeRange range, char first, char last)
		{
			Volatile.Write(ref range, UnicodeRange.Create(first, last));
			return range;
		}
	}
}
namespace System.Text.Encodings.Web
{
	internal struct AsciiByteMap
	{
		private unsafe fixed byte Buffer[128];

		internal unsafe void InsertAsciiChar(char key, byte value)
		{
			if (key < '\u0080')
			{
				Buffer[(uint)key] = value;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal unsafe readonly bool TryLookup(Rune key, out byte value)
		{
			if (key.IsAscii)
			{
				byte b = Buffer[(uint)key.Value];
				if (b != 0)
				{
					value = b;
					return true;
				}
			}
			value = 0;
			return false;
		}
	}
	internal struct AllowedBmpCodePointsBitmap
	{
		private unsafe fixed uint Bitmap[2048];

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe void AllowChar(char value)
		{
			_GetIndexAndOffset(value, out UIntPtr index, out int offset);
			ref uint reference = ref Bitmap[(ulong)index];
			reference |= (uint)(1 << offset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe void ForbidChar(char value)
		{
			_GetIndexAndOffset(value, out UIntPtr index, out int offset);
			ref uint reference = ref Bitmap[(ulong)index];
			reference &= (uint)(~(1 << offset));
		}

		public void ForbidHtmlCharacters()
		{
			ForbidChar('<');
			ForbidChar('>');
			ForbidChar('&');
			ForbidChar('\'');
			ForbidChar('"');
			ForbidChar('+');
		}

		public unsafe void ForbidUndefinedCharacters()
		{
			fixed (uint* pointer = Bitmap)
			{
				ReadOnlySpan<byte> values = UnicodeHelpers.GetDefinedBmpCodePointsBitmapLittleEndian();
				Span<uint> span = new Span<uint>(pointer, 2048);
				if (Vector.IsHardwareAccelerated && BitConverter.IsLittleEndian)
				{
					while (!values.IsEmpty)
					{
						(new Vector<uint>(values) & new Vector<uint>(span)).CopyTo(span);
						values = values.Slice(Vector<byte>.Count);
						span = span.Slice(Vector<uint>.Count);
					}
					return;
				}
				for (int i = 0; i < span.Length; i++)
				{
					span[i] &= BinaryPrimitives.ReadUInt32LittleEndian(values.Slice(i * 4));
				}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe readonly bool IsCharAllowed(char value)
		{
			_GetIndexAndOffset(value, out UIntPtr index, out int offset);
			if ((Bitmap[(ulong)index] & (uint)(1 << offset)) != 0)
			{
				return true;
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe readonly bool IsCodePointAllowed(uint value)
		{
			if (!System.Text.UnicodeUtility.IsBmpCodePoint(value))
			{
				return false;
			}
			_GetIndexAndOffset(value, out UIntPtr index, out int offset);
			if ((Bitmap[(ulong)index] & (uint)(1 << offset)) != 0)
			{
				return true;
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static void _GetIndexAndOffset(uint value, out nuint index, out int offset)
		{
			index = value >> 5;
			offset = (int)(value & 0x1F);
		}
	}
	internal sealed class OptimizedInboxTextEncoder
	{
		[StructLayout(LayoutKind.Explicit)]
		private struct AllowedAsciiCodePoints
		{
			[FieldOffset(0)]
			private unsafe fixed byte AsBytes[16];

			internal Vector128<byte> AsVector
			{
				get
				{
					throw new PlatformNotSupportedException();
				}
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			internal unsafe readonly bool IsAllowedAsciiCodePoint(uint codePoint)
			{
				if (codePoint > 127)
				{
					return false;
				}
				uint num = AsBytes[codePoint & 0xF];
				if ((num & (uint)(1 << (int)(codePoint >> 4))) == 0)
				{
					return false;
				}
				return true;
			}

			internal unsafe void PopulateAllowedCodePoints(in AllowedBmpCodePointsBitmap allowedBmpCodePoints)
			{
				this = default(AllowedAsciiCodePoints);
				for (int i = 32; i < 127; i++)
				{
					if (allowedBmpCodePoints.IsCharAllowed((char)i))
					{
						ref byte reference = ref AsBytes[i & 0xF];
						reference |= (byte)(1 << (i >> 4));
					}
				}
			}
		}

		private struct AsciiPreescapedData
		{
			private unsafe fixed ulong Data[128];

			internal unsafe void PopulatePreescapedData(in AllowedBmpCodePointsBitmap allowedCodePointsBmp, ScalarEscaperBase innerEncoder)
			{
				this = default(AsciiPreescapedData);
				byte* intPtr = stackalloc byte[16];
				// IL initblk instruction
				Unsafe.InitBlock(intPtr, 0, 16);
				Span<char> span = new Span<char>(intPtr, 8);
				Span<char> span2 = span;
				for (int i = 0; i < 128; i++)
				{
					Rune value = new Rune(i);
					ulong num;
					int num2;
					if (!Rune.IsControl(value) && allowedCodePointsBmp.IsCharAllowed((char)i))
					{
						num = (uint)i;
						num2 = 1;
					}
					else
					{
						num2 = innerEncoder.EncodeUtf16(value, span2.Slice(0, 6));
						num = 0uL;
						span2.Slice(num2).Clear();
						for (int num3 = num2 - 1; num3 >= 0; num3--)
						{
							uint num4 = span2[num3];
							num = (num << 8) | num4;
						}
					}
					Data[i] = num | ((ulong)(uint)num2 << 56);
				}
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			internal unsafe readonly bool TryGetPreescapedData(uint codePoint, out ulong preescapedData)
			{
				if (codePoint <= 127)
				{
					preescapedData = Data[codePoint];
					return true;
				}
				preescapedData = 0uL;
				return false;
			}
		}

		private readonly AllowedAsciiCodePoints _allowedAsciiCodePoints;

		private readonly AsciiPreescapedData _asciiPreescapedData;

		private readonly AllowedBmpCodePointsBitmap _allowedBmpCodePoints;

		private readonly ScalarEscaperBase _scalarEscaper;

		internal OptimizedInboxTextEncoder(ScalarEscaperBase scalarEscaper, in AllowedBmpCodePointsBitmap allowedCodePointsBmp, bool forbidHtmlSensitiveCharacters = true, ReadOnlySpan<char> extraCharactersToEscape = default(ReadOnlySpan<char>))
		{
			_scalarEscaper = scalarEscaper;
			_allowedBmpCodePoints = allowedCodePointsBmp;
			_allowedBmpCodePoints.ForbidUndefinedCharacters();
			if (forbidHtmlSensitiveCharacters)
			{
				_allowedBmpCodePoints.ForbidHtmlCharacters();
			}
			ReadOnlySpan<char> readOnlySpan = extraCharactersToEscape;
			for (int i = 0; i < readOnlySpan.Length; i++)
			{
				char value = readOnlySpan[i];
				_allowedBmpCodePoints.ForbidChar(value);
			}
			_asciiPreescapedData.PopulatePreescapedData(in _allowedBmpCodePoints, scalarEscaper);
			_allowedAsciiCodePoints.PopulateAllowedCodePoints(in _allowedBmpCodePoints);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[Obsolete("FindFirstCharacterToEncode has been deprecated. It should only be used by the TextEncoder adapter.")]
		public unsafe int FindFirstCharacterToEncode(char* text, int textLength)
		{
			return GetIndexOfFirstCharToEncode(new ReadOnlySpan<char>(text, textLength));
		}

		[Obsolete("TryEncodeUnicodeScalar has been deprecated. It should only be used by the TextEncoder adapter.")]
		public unsafe bool TryEncodeUnicodeScalar(int unicodeScalar, char* buffer, int bufferLength, out int numberOfCharactersWritten)
		{
			Span<char> destination = new Span<char>(buffer, bufferLength);
			if (_allowedBmpCodePoints.IsCodePointAllowed((uint)unicodeScalar))
			{
				if (!destination.IsEmpty)
				{
					destination[0] = (char)unicodeScalar;
					numberOfCharactersWritten = 1;
					return true;
				}
			}
			else
			{
				int num = _scalarEscaper.EncodeUtf16(new Rune(unicodeScalar), destination);
				if (num >= 0)
				{
					numberOfCharactersWritten = num;
					return true;
				}
			}
			numberOfCharactersWritten = 0;
			return false;
		}

		public OperationStatus Encode(ReadOnlySpan<char> source, Span<char> destination, out int charsConsumed, out int charsWritten, bool isFinalBlock)
		{
			_AssertThisNotNull();
			int num = 0;
			int num2 = 0;
			OperationStatus result2;
			while (true)
			{
				int num3;
				Rune result;
				if (SpanUtility.IsValidIndex(source, num))
				{
					char c = source[num];
					if (_asciiPreescapedData.TryGetPreescapedData(c, out var preescapedData))
					{
						if (SpanUtility.IsValidIndex(destination, num2))
						{
							destination[num2] = (char)(byte)preescapedData;
							if (((int)preescapedData & 0xFF00) == 0)
							{
								num2++;
								num++;
								continue;
							}
							preescapedData >>= 8;
							num3 = num2 + 1;
							while (SpanUtility.IsValidIndex(destination, num3))
							{
								destination[num3++] = (char)(byte)preescapedData;
								if ((byte)(preescapedData >>= 8) != 0)
								{
									continue;
								}
								goto IL_0091;
							}
						}
						goto IL_0148;
					}
					if (Rune.TryCreate(c, out result))
					{
						goto IL_00e1;
					}
					int index = num + 1;
					if (SpanUtility.IsValidIndex(source, index))
					{
						if (Rune.TryCreate(c, source[index], out result))
						{
							goto IL_00e1;
						}
					}
					else if (!isFinalBlock && char.IsHighSurrogate(c))
					{
						result2 = OperationStatus.NeedMoreData;
						break;
					}
					result = Rune.ReplacementChar;
					goto IL_010d;
				}
				result2 = OperationStatus.Done;
				break;
				IL_0148:
				result2 = OperationStatus.DestinationTooSmall;
				break;
				IL_0091:
				num2 = num3;
				num++;
				continue;
				IL_010d:
				int num4 = _scalarEscaper.EncodeUtf16(result, destination.Slice(num2));
				if (num4 >= 0)
				{
					num2 += num4;
					num += result.Utf16SequenceLength;
					continue;
				}
				goto IL_0148;
				IL_00e1:
				if (!IsScalarValueAllowed(result))
				{
					goto IL_010d;
				}
				if (result.TryEncodeToUtf16(destination.Slice(num2), out var charsWritten2))
				{
					num2 += charsWritten2;
					num += charsWritten2;
					continue;
				}
				goto IL_0148;
			}
			charsConsumed = num;
			charsWritten = num2;
			return result2;
		}

		public OperationStatus EncodeUtf8(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock)
		{
			_AssertThisNotNull();
			int num = 0;
			int num2 = 0;
			OperationStatus result2;
			while (true)
			{
				int num3;
				if (SpanUtility.IsValidIndex(source, num))
				{
					uint codePoint = source[num];
					if (_asciiPreescapedData.TryGetPreescapedData(codePoint, out var preescapedData))
					{
						if (SpanUtility.TryWriteUInt64LittleEndian(destination, num2, preescapedData))
						{
							num2 += (int)(preescapedData >> 56);
							num++;
							continue;
						}
						num3 = num2;
						while (SpanUtility.IsValidIndex(destination, num3))
						{
							destination[num3++] = (byte)preescapedData;
							if ((byte)(preescapedData >>= 8) != 0)
							{
								continue;
							}
							goto IL_0076;
						}
					}
					else
					{
						Rune result;
						int bytesConsumed2;
						OperationStatus operationStatus = Rune.DecodeFromUtf8(source.Slice(num), out result, out bytesConsumed2);
						if (operationStatus != 0)
						{
							if (!isFinalBlock && operationStatus == OperationStatus.NeedMoreData)
							{
								result2 = OperationStatus.NeedMoreData;
								break;
							}
						}
						else if (IsScalarValueAllowed(result))
						{
							if (result.TryEncodeToUtf8(destination.Slice(num2), out var bytesWritten2))
							{
								num2 += bytesWritten2;
								num += bytesWritten2;
								continue;
							}
							goto IL_0103;
						}
						int num4 = _scalarEscaper.EncodeUtf8(result, destination.Slice(num2));
						if (num4 >= 0)
						{
							num2 += num4;
							num += bytesConsumed2;
							continue;
						}
					}
					goto IL_0103;
				}
				result2 = OperationStatus.Done;
				break;
				IL_0076:
				num2 = num3;
				num++;
				continue;
				IL_0103:
				result2 = OperationStatus.DestinationTooSmall;
				break;
			}
			bytesConsumed = num;
			bytesWritten = num2;
			return result2;
		}

		public unsafe int GetIndexOfFirstByteToEncode(ReadOnlySpan<byte> data)
		{
			int length = data.Length;
			if (Ssse3.IsSupported || (AdvSimd.Arm64.IsSupported && BitConverter.IsLittleEndian))
			{
				int num;
				fixed (byte* pData = data)
				{
					UIntPtr uIntPtr = ((!AdvSimd.Arm64.IsSupported || !BitConverter.IsLittleEndian) ? GetIndexOfFirstByteToEncodeSsse3(pData, (uint)length) : GetIndexOfFirstByteToEncodeAdvSimd64(pData, (uint)length));
					num = (int)(nuint)uIntPtr;
				}
				if (!SpanUtility.IsValidIndex(data, num))
				{
					return -1;
				}
				if (System.Text.UnicodeUtility.IsAsciiCodePoint(data[num]))
				{
					return num;
				}
				data = data.Slice(num);
			}
			Rune result;
			int bytesConsumed;
			while (!data.IsEmpty && Rune.DecodeFromUtf8(data, out result, out bytesConsumed) == OperationStatus.Done && bytesConsumed < 4 && _allowedBmpCodePoints.IsCharAllowed((char)result.Value))
			{
				data = data.Slice(bytesConsumed);
			}
			if (!data.IsEmpty)
			{
				return length - data.Length;
			}
			return -1;
		}

		public unsafe int GetIndexOfFirstCharToEncode(ReadOnlySpan<char> data)
		{
			fixed (char* ptr = data)
			{
				nuint num = (uint)data.Length;
				nuint num2 = 0u;
				if (Ssse3.IsSupported)
				{
					num2 = GetIndexOfFirstCharToEncodeSsse3(ptr, num);
				}
				else if (AdvSimd.Arm64.IsSupported && BitConverter.IsLittleEndian)
				{
					num2 = GetIndexOfFirstCharToEncodeAdvSimd64(ptr, num);
				}
				if (num2 < num)
				{
					_AssertThisNotNull();
					nint num3 = 0;
					while (true)
					{
						if (num - num2 >= 8)
						{
							num3 = -1;
							if (_allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]))
							{
								num2 += 8;
								continue;
							}
							num2 += (nuint)num3;
							break;
						}
						for (; num2 < num && _allowedBmpCodePoints.IsCharAllowed(ptr[num2]); num2++)
						{
						}
						break;
					}
				}
				int num4 = (int)num2;
				if (num4 == (int)num)
				{
					num4 = -1;
				}
				return num4;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool IsScalarValueAllowed(Rune value)
		{
			return _allowedBmpCodePoints.IsCodePointAllowed((uint)value.Value);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void _AssertThisNotNull()
		{
			_ = GetType() == typeof(OptimizedInboxTextEncoder);
		}

		private unsafe nuint GetIndexOfFirstByteToEncodeSsse3(byte* pData, nuint lengthInBytes)
		{
			Vector128<byte> zero = Vector128<byte>.Zero;
			Vector128<byte> right = Vector128.Create((byte)7);
			Vector128<byte> value = Vector128.Create(1, 2, 4, 8, 16, 32, 64, 128, 0, 0, 0, 0, 0, 0, 0, 0);
			Vector128<byte> asVector = _allowedAsciiCodePoints.AsVector;
			nuint num = 0u;
			if (lengthInBytes < 16)
			{
				goto IL_00b6;
			}
			nuint num2 = lengthInBytes & unchecked((nuint)(0xFFFFFFF0));
			int num3;
			while (true)
			{
				Vector128<byte> vector = Sse2.LoadVector128(pData + num);
				Vector128<byte> left = Ssse3.Shuffle(asVector, vector);
				Vector128<byte> right2 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left2 = Sse2.And(left, right2);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left2, zero));
				if (((uint)num3 & 0xFFFFu) != 0)
				{
					break;
				}
				if ((num += 16) < num2)
				{
					continue;
				}
				goto IL_00b6;
			}
			goto IL_01b2;
			IL_00b6:
			if ((lengthInBytes & 8) != 0)
			{
				Vector128<byte> vector2 = Sse2.LoadScalarVector128((ulong*)(pData + num)).AsByte();
				Vector128<byte> left3 = Ssse3.Shuffle(asVector, vector2);
				Vector128<byte> right3 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector2.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left4 = Sse2.And(left3, right3);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left4, zero));
				if ((byte)num3 != 0)
				{
					goto IL_01b2;
				}
				num += 8;
			}
			if ((lengthInBytes & 4) != 0)
			{
				Vector128<byte> vector3 = Sse2.LoadScalarVector128((uint*)(pData + num)).AsByte();
				Vector128<byte> left5 = Ssse3.Shuffle(asVector, vector3);
				Vector128<byte> right4 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector3.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left6 = Sse2.And(left5, right4);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left6, zero));
				if (((uint)num3 & 0xFu) != 0)
				{
					goto IL_01b2;
				}
				num += 4;
			}
			if ((lengthInBytes & 3) != 0)
			{
				while (_allowedAsciiCodePoints.IsAllowedAsciiCodePoint(pData[num]) && ++num != lengthInBytes)
				{
				}
			}
			goto IL_01af;
			IL_01b2:
			num += (uint)BitOperations.TrailingZeroCount(num3);
			goto IL_01af;
			IL_01af:
			return num;
		}

		private unsafe nuint GetIndexOfFirstCharToEncodeSsse3(char* pData, nuint lengthInChars)
		{
			Vector128<byte> zero = Vector128<byte>.Zero;
			Vector128<byte> right = Vector128.Create((byte)7);
			Vector128<byte> value = Vector128.Create(1, 2, 4, 8, 16, 32, 64, 128, 0, 0, 0, 0, 0, 0, 0, 0);
			Vector128<byte> asVector = _allowedAsciiCodePoints.AsVector;
			nuint num = 0u;
			if (lengthInChars < 16)
			{
				goto IL_00d7;
			}
			nuint num2 = lengthInChars & unchecked((nuint)(0xFFFFFFF0));
			int num3;
			while (true)
			{
				Vector128<byte> vector = Sse2.PackUnsignedSaturate(Sse2.LoadVector128((short*)(pData + num)), Sse2.LoadVector128((short*)(pData + 8 + num)));
				Vector128<byte> left = Ssse3.Shuffle(asVector, vector);
				Vector128<byte> right2 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left2 = Sse2.And(left, right2);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left2, zero));
				if (((uint)num3 & 0xFFFFu) != 0)
				{
					break;
				}
				if ((num += 16) < num2)
				{
					continue;
				}
				goto IL_00d7;
			}
			goto IL_01ed;
			IL_00d7:
			if ((lengthInChars & 8) != 0)
			{
				Vector128<byte> vector2 = Sse2.PackUnsignedSaturate(Sse2.LoadVector128((short*)(pData + num)), zero.AsInt16());
				Vector128<byte> left3 = Ssse3.Shuffle(asVector, vector2);
				Vector128<byte> right3 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector2.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left4 = Sse2.And(left3, right3);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left4, zero));
				if ((byte)num3 != 0)
				{
					goto IL_01ed;
				}
				num += 8;
			}
			if ((lengthInChars & 4) != 0)
			{
				Vector128<byte> vector3 = Sse2.PackUnsignedSaturate(Sse2.LoadScalarVector128((ulong*)(pData + num)).AsInt16(), zero.AsInt16());
				Vector128<byte> left5 = Ssse3.Shuffle(asVector, vector3);
				Vector128<byte> right4 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector3.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left6 = Sse2.And(left5, right4);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left6, zero));
				if (((uint)num3 & 0xFu) != 0)
				{
					goto IL_01ed;
				}
				num += 4;
			}
			if ((lengthInChars & 3) != 0)
			{
				while (_allowedAsciiCodePoints.IsAllowedAsciiCodePoint(pData[num]) && ++num != lengthInChars)
				{
				}
			}
			goto IL_01ea;
			IL_01ed:
			num += (uint)BitOperations.TrailingZeroCount(num3);
			goto IL_01ea;
			IL_01ea:
			return num;
		}

		private unsafe nuint GetIndexOfFirstByteToEncodeAdvSimd64(byte* pData, nuint lengthInBytes)
		{
			Vector128<byte> right = Vector128.Create((byte)15);
			Vector128<byte> table = Vector128.Create(1, 2, 4, 8, 16, 32, 64, 128, 0, 0, 0, 0, 0, 0, 0, 0);
			Vector128<byte> right2 = Vector128.Create((ushort)61455).AsByte();
			Vector128<byte> asVector = _allowedAsciiCodePoints.AsVector;
			nuint num = 0u;
			if (lengthInBytes < 16)
			{
				goto IL_00cd;
			}
			nuint num2 = lengthInBytes & unchecked((nuint)(0xFFFFFFF0));
			ulong num3;
			while (true)
			{
				Vector128<byte> vector = AdvSimd.LoadVector128(pData + num);
				Vector128<byte> left = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector, right));
				Vector128<byte> right3 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector.AsSByte(), 4).AsByte());
				Vector128<byte> left2 = AdvSimd.CompareTest(left, right3);
				Vector128<byte> vector2 = AdvSimd.And(left2, right2);
				num3 = AdvSimd.Arm64.AddPairwise(vector2, vector2).AsUInt64().ToScalar();
				if (num3 != ulong.MaxValue)
				{
					break;
				}
				if ((num += 16) < num2)
				{
					continue;
				}
				goto IL_00cd;
			}
			num += (uint)(BitOperations.TrailingZeroCount(~num3) >>> 2);
			goto IL_01ca;
			IL_01df:
			num += (uint)(BitOperations.TrailingZeroCount(~num3) >>> 3);
			goto IL_01ca;
			IL_00cd:
			if ((lengthInBytes & 8) != 0)
			{
				Vector128<byte> vector3 = AdvSimd.LoadVector64(pData + num).ToVector128Unsafe();
				Vector128<byte> left3 = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector3, right));
				Vector128<byte> right4 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector3.AsSByte(), 4).AsByte());
				Vector128<byte> vector4 = AdvSimd.CompareTest(left3, right4);
				num3 = vector4.AsUInt64().ToScalar();
				if (num3 != ulong.MaxValue)
				{
					goto IL_01df;
				}
				num += 8;
			}
			if ((lengthInBytes & 4) != 0)
			{
				Vector128<byte> vector5 = Vector128.CreateScalarUnsafe(Unsafe.ReadUnaligned<uint>(pData + num)).AsByte();
				Vector128<byte> left4 = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector5, right));
				Vector128<byte> right5 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector5.AsSByte(), 4).AsByte());
				Vector128<byte> vector6 = AdvSimd.CompareTest(left4, right5);
				num3 = vector6.AsUInt32().ToScalar();
				if (num3 != uint.MaxValue)
				{
					goto IL_01df;
				}
				num += 4;
			}
			if ((lengthInBytes & 3) != 0)
			{
				while (_allowedAsciiCodePoints.IsAllowedAsciiCodePoint(pData[num]) && ++num != lengthInBytes)
				{
				}
			}
			goto IL_01ca;
			IL_01ca:
			return num;
		}

		private unsafe nuint GetIndexOfFirstCharToEncodeAdvSimd64(char* pData, nuint lengthInChars)
		{
			Vector128<byte> right = Vector128.Create((byte)15);
			Vector128<byte> table = Vector128.Create(1, 2, 4, 8, 16, 32, 64, 128, 0, 0, 0, 0, 0, 0, 0, 0);
			Vector128<byte> right2 = Vector128.Create((ushort)61455).AsByte();
			Vector128<byte> asVector = _allowedAsciiCodePoints.AsVector;
			nuint num = 0u;
			if (lengthInChars < 16)
			{
				goto IL_00f3;
			}
			nuint num2 = lengthInChars & unchecked((nuint)(0xFFFFFFF0));
			ulong num3;
			while (true)
			{
				Vector128<byte> vector = AdvSimd.ExtractNarrowingSaturateUnsignedUpper(AdvSimd.ExtractNarrowingSaturateUnsignedLower(AdvSimd.LoadVector128((short*)(pData + num))), AdvSimd.LoadVector128((short*)(pData + 8 + num)));
				Vector128<byte> left = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector, right));
				Vector128<byte> right3 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector.AsSByte(), 4).AsByte());
				Vector128<byte> left2 = AdvSimd.CompareTest(left, right3);
				Vector128<byte> vector2 = AdvSimd.And(left2, right2);
				num3 = AdvSimd.Arm64.AddPairwise(vector2, vector2).AsUInt64().ToScalar();
				if (num3 != ulong.MaxValue)
				{
					break;
				}
				if ((num += 16) < num2)
				{
					continue;
				}
				goto IL_00f3;
			}
			num += (uint)(BitOperations.TrailingZeroCount(~num3) >>> 2);
			goto IL_0208;
			IL_021d:
			num += (uint)(BitOperations.TrailingZeroCount(~num3) >>> 3);
			goto IL_0208;
			IL_00f3:
			if ((lengthInChars & 8) != 0)
			{
				Vector128<byte> vector3 = AdvSimd.ExtractNarrowingSaturateUnsignedLower(AdvSimd.LoadVector128((short*)(pData + num))).AsByte().ToVector128Unsafe();
				Vector128<byte> left3 = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector3, right));
				Vector128<byte> right4 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector3.AsSByte(), 4).AsByte());
				Vector128<byte> vector4 = AdvSimd.CompareTest(left3, right4);
				num3 = vector4.AsUInt64().ToScalar();
				if (num3 != ulong.MaxValue)
				{
					goto IL_021d;
				}
				num += 8;
			}
			if ((lengthInChars & 4) != 0)
			{
				Vector128<byte> vector5 = AdvSimd.ExtractNarrowingSaturateUnsignedLower(AdvSimd.LoadVector64((short*)(pData + num)).ToVector128Unsafe()).ToVector128Unsafe();
				Vector128<byte> left4 = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector5, right));
				Vector128<byte> right5 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector5.AsSByte(), 4).AsByte());
				Vector128<byte> vector6 = AdvSimd.CompareTest(left4, right5);
				num3 = vector6.AsUInt32().ToScalar();
				if (num3 != uint.MaxValue)
				{
					goto IL_021d;
				}
				num += 4;
			}
			if ((lengthInChars & 3) != 0)
			{
				while (_allowedAsciiCodePoints.IsAllowedAsciiCodePoint(pData[num]) && ++num != lengthInChars)
				{
				}
			}
			goto IL_0208;
			IL_0208:
			return num;
		}
	}
	internal sealed class DefaultUrlEncoder : UrlEncoder
	{
		private sealed class EscaperImplementation : ScalarEscaperBase
		{
			internal static readonly EscaperImplementation Singleton = new EscaperImplementation();

			private EscaperImplementation()
			{
			}

			internal override int EncodeUtf8(Rune value, Span<byte> destination)
			{
				uint utf8RepresentationForScalarValue = (uint)UnicodeHelpers.GetUtf8RepresentationForScalarValue((uint)value.Value);
				if (SpanUtility.IsValidIndex(destination, 2))
				{
					destination[0] = 37;
					System.HexConverter.ToBytesBuffer((byte)utf8RepresentationForScalarValue, destination, 1);
					if ((utf8RepresentationForScalarValue >>= 8) == 0)
					{
						return 3;
					}
					if (SpanUtility.IsValidIndex(destination, 5))
					{
						destination[3] = 37;
						System.HexConverter.ToBytesBuffer((byte)utf8RepresentationForScalarValue, destination, 4);
						if ((utf8RepresentationForScalarValue >>= 8) == 0)
						{
							return 6;
						}
						if (SpanUtility.IsValidIndex(destination, 8))
						{
							destination[6] = 37;
							System.HexConverter.ToBytesBuffer((byte)utf8RepresentationForScalarValue, destination, 7);
							if ((utf8RepresentationForScalarValue >>= 8) == 0)
							{
								return 9;
							}
							if (SpanUtility.IsValidIndex(destination, 11))
							{
								destination[9] = 37;
								System.HexConverter.ToBytesBuffer((byte)utf8RepresentationForScalarValue, destination, 10);
								return 12;
							}
						}
					}
				}
				return -1;
			}

			internal override int EncodeUtf16(Rune value, Span<char> destination)
			{
				uint utf8RepresentationForScalarValue = (uint)UnicodeHelpers.GetUtf8RepresentationForScalarValue((uint)value.Value);
				if (SpanUtility.IsValidIndex(destination, 2))
				{
					destination[0] = '%';
					System.HexConverter.ToCharsBuffer((byte)utf8RepresentationForScalarValue, destination, 1);
					if ((utf8RepresentationForScalarValue >>= 8) == 0)
					{
						return 3;
					}
					if (SpanUtility.IsValidIndex(destination, 5))
					{
						destination[3] = '%';
						System.HexConverter.ToCharsBuffer((byte)utf8RepresentationForScalarValue, destination, 4);
						if ((utf8RepresentationForScalarValue >>= 8) == 0)
						{
							return 6;
						}
						if (SpanUtility.IsValidIndex(destination, 8))
						{
							destination[6] = '%';
							System.HexConverter.ToCharsBuffer((byte)utf8RepresentationForScalarValue, destination, 7);
							if ((utf8RepresentationForScalarValue >>= 8) == 0)
							{
								return 9;
							}
							if (SpanUtility.IsValidIndex(des

CommunityToolkit.Mvvm.dll

Decompiled 5 months ago
using System;
using System.Buffers;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Collections.Internals;
using CommunityToolkit.Mvvm.ComponentModel.__Internals;
using CommunityToolkit.Mvvm.Input.Internals;
using CommunityToolkit.Mvvm.Messaging;
using CommunityToolkit.Mvvm.Messaging.Internals;
using CommunityToolkit.Mvvm.Messaging.Messages;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("8.0.0.1")]
[assembly: AssemblyInformationalVersion("8.0.0+e551bcfcf6")]
[assembly: InternalsVisibleTo("CommunityToolkit.Mvvm.Internals.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010041753AF735AE6140C9508567666C51C6AB929806ADB0D210694B30AB142A060237BC741F9682E7D8D4310364B4BBA4EE89CC9D3D5CE7E5583587E8EA44DCA09977996582875E71FB54FA7B170798D853D5D8010B07219633BDB761D01AC924DA44576D6180CDCEAE537973982BB461C541541D58417A3794E34F45E6F2D129E2")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: AssemblyMetadata("CommitHash", "e551bcfcf6afd9cd6802104691863b5e9ab41b90")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("(c) .NET Foundation and Contributors. All rights reserved.")]
[assembly: AssemblyDescription("\r\n      This package includes a .NET MVVM library with helpers such as:\r\n      - ObservableObject: a base class for objects implementing the INotifyPropertyChanged interface.\r\n      - ObservableRecipient: a base class for observable objects with support for the IMessenger service.\r\n      - ObservableValidator: a base class for objects implementing the INotifyDataErrorInfo interface.\r\n      - RelayCommand: a simple delegate command implementing the ICommand interface.\r\n      - AsyncRelayCommand: a delegate command supporting asynchronous operations and cancellation.\r\n      - WeakReferenceMessenger: a messaging system to exchange messages through different loosely-coupled objects.\r\n      - StrongReferenceMessenger: a high-performance messaging system that trades weak references for speed.\r\n      - Ioc: a helper class to configure dependency injection service containers.\r\n    ")]
[assembly: AssemblyProduct(".NET Community Toolkit")]
[assembly: AssemblyTitle("CommunityToolkit.Mvvm")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/CommunityToolkit/dotnet")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("8.0.0.0")]
[module: UnverifiableCode]
[module: SkipLocalsInit]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
[GeneratedCode("Nerdbank.GitVersioning.Tasks", "3.4.255.64262")]
[ExcludeFromCodeCoverage]
internal static class ThisAssembly
{
	internal const string AssemblyConfiguration = "Release";

	internal const string AssemblyFileVersion = "8.0.0.1";

	internal const string AssemblyInformationalVersion = "8.0.0+e551bcfcf6";

	internal const string AssemblyName = "CommunityToolkit.Mvvm";

	internal const string AssemblyTitle = "CommunityToolkit.Mvvm";

	internal const string AssemblyVersion = "8.0.0.0";

	internal static readonly DateTime GitCommitDate = new DateTime(637951641480000000L, DateTimeKind.Utc);

	internal const string GitCommitId = "e551bcfcf6afd9cd6802104691863b5e9ab41b90";

	internal const bool IsPrerelease = false;

	internal const bool IsPublicRelease = true;

	internal const string PublicKey = "002400000480000094000000060200000024000052534131000400000100010041753af735ae6140c9508567666c51c6ab929806adb0d210694b30ab142a060237bc741f9682e7d8d4310364b4bba4ee89cc9d3d5ce7e5583587e8ea44dca09977996582875e71fb54fa7b170798d853d5d8010b07219633bdb761d01ac924da44576d6180cdceae537973982bb461c541541d58417a3794e34f45e6f2d129e2";

	internal const string PublicKeyToken = "4aff67a105548ee2";

	internal const string RootNamespace = "CommunityToolkit.Mvvm";
}
internal static class Configuration
{
	private const string DisableINotifyPropertyChangingSupport = "MVVMTOOLKIT_DISABLE_INOTIFYPROPERTYCHANGING";

	public static readonly bool IsINotifyPropertyChangingDisabled = GetConfigurationValue("MVVMTOOLKIT_DISABLE_INOTIFYPROPERTYCHANGING");

	private static bool GetConfigurationValue(string propertyName)
	{
		if (AppContext.TryGetSwitch(propertyName, out var isEnabled))
		{
			return isEnabled;
		}
		return false;
	}
}
namespace System
{
	internal sealed class Gen2GcCallback : CriticalFinalizerObject
	{
		private readonly Action<object> callback;

		private GCHandle handle;

		private Gen2GcCallback(Action<object> callback, object target)
		{
			this.callback = callback;
			handle = GCHandle.Alloc(target, GCHandleType.Weak);
		}

		public static void Register(Action<object> callback, object target)
		{
			new System.Gen2GcCallback(callback, target);
		}

		~Gen2GcCallback()
		{
			object target = handle.Target;
			if (target != null)
			{
				try
				{
					callback(target);
				}
				catch
				{
				}
				GC.ReRegisterForFinalize(this);
			}
			else
			{
				handle.Free();
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	internal sealed class ConditionalWeakTable2<TKey, TValue> where TKey : class where TValue : class?
	{
		public ref struct Enumerator
		{
			private ConditionalWeakTable2<TKey, TValue> table;

			private readonly int maxIndexInclusive;

			private int currentIndex;

			private TKey? key;

			private TValue? value;

			public Enumerator(ConditionalWeakTable2<TKey, TValue> table)
			{
				this.table = table;
				Container container = table.container;
				if (container == null || container.FirstFreeEntry == 0)
				{
					maxIndexInclusive = -1;
				}
				else
				{
					maxIndexInclusive = container.FirstFreeEntry - 1;
				}
				currentIndex = -1;
				key = null;
				value = null;
			}

			public void Dispose()
			{
				Monitor.Exit(table.lockObject);
				table = null;
				key = null;
				value = null;
			}

			public bool MoveNext()
			{
				Container container = table.container;
				int num = currentIndex;
				int num2 = maxIndexInclusive;
				while (num < num2)
				{
					num++;
					if (container.TryGetEntry(num, out key, out value))
					{
						currentIndex = num;
						return true;
					}
				}
				currentIndex = num;
				return false;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public TKey GetKey()
			{
				return key;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public TValue GetValue()
			{
				return value;
			}
		}

		private struct Entry
		{
			public DependentHandle depHnd;

			public int HashCode;

			public int Next;
		}

		private sealed class Container
		{
			private readonly ConditionalWeakTable2<TKey, TValue> parent;

			private int[] buckets;

			private Entry[] entries;

			private int firstFreeEntry;

			private bool invalid;

			private bool finalized;

			private volatile object? oldKeepAlive;

			internal bool HasCapacity => firstFreeEntry < entries.Length;

			internal int FirstFreeEntry => firstFreeEntry;

			internal Container(ConditionalWeakTable2<TKey, TValue> parent)
			{
				buckets = new int[8];
				for (int i = 0; i < buckets.Length; i++)
				{
					buckets[i] = -1;
				}
				entries = new Entry[8];
				this.parent = parent;
			}

			private Container(ConditionalWeakTable2<TKey, TValue> parent, int[] buckets, Entry[] entries, int firstFreeEntry)
			{
				this.parent = parent;
				this.buckets = buckets;
				this.entries = entries;
				this.firstFreeEntry = firstFreeEntry;
			}

			internal void CreateEntryNoResize(TKey key, TValue value)
			{
				VerifyIntegrity();
				invalid = true;
				int num = RuntimeHelpers.GetHashCode(key) & 0x7FFFFFFF;
				int num2 = firstFreeEntry++;
				entries[num2].HashCode = num;
				entries[num2].depHnd = new DependentHandle(key, value);
				int num3 = num & (buckets.Length - 1);
				entries[num2].Next = buckets[num3];
				Volatile.Write(ref buckets[num3], num2);
				invalid = false;
			}

			internal bool TryGetValueWorker(TKey key, [MaybeNullWhen(false)] out TValue value)
			{
				object value2;
				int num = FindEntry(key, out value2);
				value = Unsafe.As<TValue>(value2);
				return num != -1;
			}

			internal int FindEntry(TKey key, out object? value)
			{
				int num = RuntimeHelpers.GetHashCode(key) & 0x7FFFFFFF;
				int num2 = num & (buckets.Length - 1);
				for (int num3 = Volatile.Read(ref buckets[num2]); num3 != -1; num3 = entries[num3].Next)
				{
					if (entries[num3].HashCode == num)
					{
						object obj;
						(obj, value) = entries[num3].depHnd.TargetAndDependent;
						if (obj == key)
						{
							GC.KeepAlive(this);
							return num3;
						}
					}
				}
				GC.KeepAlive(this);
				value = null;
				return -1;
			}

			internal bool TryGetEntry(int index, [NotNullWhen(true)] out TKey? key, [MaybeNullWhen(false)] out TValue value)
			{
				if (index < entries.Length)
				{
					var (obj, o) = entries[index].depHnd.TargetAndDependent;
					GC.KeepAlive(this);
					if (obj != null)
					{
						key = Unsafe.As<TKey>(obj);
						value = Unsafe.As<TValue>(o);
						return true;
					}
				}
				key = null;
				value = null;
				return false;
			}

			internal bool Remove(TKey key)
			{
				VerifyIntegrity();
				object value;
				int num = FindEntry(key, out value);
				if (num != -1)
				{
					RemoveIndex(num);
					return true;
				}
				return false;
			}

			private void RemoveIndex(int entryIndex)
			{
				ref Entry reference = ref entries[entryIndex];
				Volatile.Write(ref reference.HashCode, -1);
				reference.depHnd.Target = null;
			}

			internal Container Resize()
			{
				bool flag = false;
				int newSize = buckets.Length;
				for (int i = 0; i < entries.Length; i++)
				{
					ref Entry reference = ref entries[i];
					if (reference.HashCode == -1)
					{
						flag = true;
						break;
					}
					if (reference.depHnd.IsAllocated && reference.depHnd.Target == null)
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					newSize = buckets.Length * 2;
				}
				return Resize(newSize);
			}

			internal Container Resize(int newSize)
			{
				int[] array = new int[newSize];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = -1;
				}
				Entry[] array2 = new Entry[newSize];
				int num = 0;
				for (int j = 0; j < entries.Length; j++)
				{
					ref Entry reference = ref entries[j];
					int hashCode = reference.HashCode;
					DependentHandle depHnd = reference.depHnd;
					if (hashCode != -1 && depHnd.IsAllocated)
					{
						if (depHnd.Target != null)
						{
							ref Entry reference2 = ref array2[num];
							reference2.HashCode = hashCode;
							reference2.depHnd = depHnd;
							int num2 = hashCode & (array.Length - 1);
							reference2.Next = array[num2];
							array[num2] = num;
							num++;
						}
						else
						{
							Volatile.Write(ref reference.HashCode, -1);
						}
					}
				}
				Container result = (Container)(oldKeepAlive = new Container(parent, array, array2, num));
				GC.KeepAlive(this);
				return result;
			}

			private void VerifyIntegrity()
			{
				if (invalid)
				{
					Throw();
				}
				static void Throw()
				{
					throw new InvalidOperationException("The current collection is in a corrupted state.");
				}
			}

			~Container()
			{
				if (invalid || parent == null)
				{
					return;
				}
				if (!finalized)
				{
					finalized = true;
					lock (parent.lockObject)
					{
						if (parent.container == this)
						{
							parent.container = null;
						}
					}
					GC.ReRegisterForFinalize(this);
					return;
				}
				Entry[] array = entries;
				invalid = true;
				entries = null;
				buckets = null;
				if (array == null)
				{
					return;
				}
				int i = 0;
				for (; i < array.Length; i++)
				{
					if (oldKeepAlive == null || array[i].HashCode == -1)
					{
						array[i].depHnd.Dispose();
					}
				}
			}
		}

		private const int InitialCapacity = 8;

		private readonly object lockObject;

		private volatile Container container;

		public ConditionalWeakTable2()
		{
			lockObject = new object();
			container = new Container(this);
		}

		public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
		{
			return container.TryGetValueWorker(key, out value);
		}

		public bool TryAdd(TKey key, TValue value)
		{
			lock (lockObject)
			{
				if (container.FindEntry(key, out object _) != -1)
				{
					return false;
				}
				CreateEntry(key, value);
				return true;
			}
		}

		public bool Remove(TKey key)
		{
			lock (lockObject)
			{
				return container.Remove(key);
			}
		}

		public TValue GetValue(TKey key, ConditionalWeakTable<TKey, TValue>.CreateValueCallback createValueCallback)
		{
			if (!TryGetValue(key, out var value))
			{
				return GetValueLocked(key, createValueCallback);
			}
			return value;
		}

		private TValue GetValueLocked(TKey key, ConditionalWeakTable<TKey, TValue>.CreateValueCallback createValueCallback)
		{
			TValue val = createValueCallback(key);
			lock (lockObject)
			{
				if (container.TryGetValueWorker(key, out var value))
				{
					return value;
				}
				CreateEntry(key, val);
				return val;
			}
		}

		public Enumerator GetEnumerator()
		{
			Monitor.Enter(lockObject);
			return new Enumerator(this);
		}

		private void CreateEntry(TKey key, TValue value)
		{
			Container container = this.container;
			if (!container.HasCapacity)
			{
				container = (this.container = container.Resize());
			}
			container.CreateEntryNoResize(key, value);
		}
	}
}
namespace System.Collections.Generic
{
	[DebuggerDisplay("Count = {Count}")]
	internal class Dictionary2<TKey, TValue> : IDictionary2<TKey, TValue>, IDictionary2<TKey>, IDictionary2 where TKey : IEquatable<TKey> where TValue : class?
	{
		public ref struct Enumerator
		{
			private readonly Entry[] entries;

			private int index;

			private readonly int count;

			internal Enumerator(Dictionary2<TKey, TValue> dictionary)
			{
				entries = dictionary.entries;
				index = 0;
				count = dictionary.count;
			}

			public bool MoveNext()
			{
				while ((uint)index < (uint)count)
				{
					if (entries[index++].Next >= -1)
					{
						return true;
					}
				}
				index = count + 1;
				return false;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public TKey GetKey()
			{
				return entries[index - 1].Key;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public TValue GetValue()
			{
				return entries[index - 1].Value;
			}
		}

		private struct Entry
		{
			public uint HashCode;

			public int Next;

			public TKey Key;

			public TValue? Value;
		}

		private const int StartOfFreeList = -3;

		private int[] buckets;

		private Entry[] entries;

		private ulong fastModMultiplier;

		private int count;

		private int freeList;

		private int freeCount;

		public int Count
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				return count - freeCount;
			}
		}

		public TValue this[TKey key]
		{
			get
			{
				ref TValue reference = ref FindValue(key);
				if (!Unsafe.IsNullRef(ref reference))
				{
					return reference;
				}
				ThrowArgumentExceptionForKeyNotFound(key);
				return null;
			}
		}

		public Dictionary2()
		{
			Initialize(0);
		}

		public void Clear()
		{
			int num = count;
			if (num > 0)
			{
				Array.Clear(buckets);
				count = 0;
				freeList = -1;
				freeCount = 0;
				Array.Clear(entries, 0, num);
			}
		}

		public bool ContainsKey(TKey key)
		{
			return !Unsafe.IsNullRef(ref FindValue(key));
		}

		public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
		{
			ref TValue reference = ref FindValue(key);
			if (!Unsafe.IsNullRef(ref reference))
			{
				value = reference;
				return true;
			}
			value = null;
			return false;
		}

		public bool TryRemove(TKey key)
		{
			uint hashCode = (uint)key.GetHashCode();
			ref int bucket = ref GetBucket(hashCode);
			Entry[] array = entries;
			int num = -1;
			int num2 = bucket - 1;
			while (num2 >= 0)
			{
				ref Entry reference = ref array[num2];
				if (reference.HashCode == hashCode && reference.Key.Equals(key))
				{
					if (num < 0)
					{
						bucket = reference.Next + 1;
					}
					else
					{
						array[num].Next = reference.Next;
					}
					reference.Next = -3 - freeList;
					if (RuntimeHelpers.IsReferenceOrContainsReferences<TKey>())
					{
						reference.Key = default(TKey);
					}
					if (RuntimeHelpers.IsReferenceOrContainsReferences<TValue>())
					{
						reference.Value = null;
					}
					freeList = num2;
					freeCount++;
					return true;
				}
				num = num2;
				num2 = reference.Next;
			}
			return false;
		}

		public ref TValue? GetOrAddValueRef(TKey key)
		{
			Entry[] array = entries;
			uint hashCode = (uint)key.GetHashCode();
			ref int bucket = ref GetBucket(hashCode);
			int num = bucket - 1;
			while ((uint)num < (uint)array.Length)
			{
				if (array[num].HashCode == hashCode && array[num].Key.Equals(key))
				{
					return ref array[num].Value;
				}
				num = array[num].Next;
			}
			int num2;
			if (freeCount > 0)
			{
				num2 = freeList;
				freeList = -3 - array[freeList].Next;
				freeCount--;
			}
			else
			{
				int num3 = count;
				if (num3 == array.Length)
				{
					Resize();
					bucket = ref GetBucket(hashCode);
				}
				num2 = num3;
				count = num3 + 1;
				array = entries;
			}
			ref Entry reference = ref array[num2];
			reference.HashCode = hashCode;
			reference.Next = bucket - 1;
			reference.Key = key;
			reference.Value = null;
			bucket = num2 + 1;
			return ref reference.Value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Enumerator GetEnumerator()
		{
			return new Enumerator(this);
		}

		private ref TValue FindValue(TKey key)
		{
			ref Entry reference = ref Unsafe.NullRef<Entry>();
			uint hashCode = (uint)key.GetHashCode();
			int bucket = GetBucket(hashCode);
			Entry[] array = entries;
			bucket--;
			while ((uint)bucket < (uint)array.Length)
			{
				reference = ref array[bucket];
				if (reference.HashCode != hashCode || !reference.Key.Equals(key))
				{
					bucket = reference.Next;
					continue;
				}
				return ref reference.Value;
			}
			return ref Unsafe.NullRef<TValue>();
		}

		[MemberNotNull(new string[] { "buckets", "entries" })]
		private void Initialize(int capacity)
		{
			int prime = HashHelpers.GetPrime(capacity);
			int[] array = new int[prime];
			Entry[] array2 = new Entry[prime];
			freeList = -1;
			fastModMultiplier = HashHelpers.GetFastModMultiplier((uint)prime);
			buckets = array;
			entries = array2;
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void Resize()
		{
			int num = HashHelpers.ExpandPrime(count);
			Entry[] array = new Entry[num];
			int num2 = count;
			Array.Copy(entries, array, num2);
			buckets = new int[num];
			fastModMultiplier = HashHelpers.GetFastModMultiplier((uint)num);
			for (int i = 0; i < num2; i++)
			{
				if (array[i].Next >= -1)
				{
					ref int bucket = ref GetBucket(array[i].HashCode);
					array[i].Next = bucket - 1;
					bucket = i + 1;
				}
			}
			entries = array;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private ref int GetBucket(uint hashCode)
		{
			int[] array = buckets;
			return ref array[HashHelpers.FastMod(hashCode, (uint)array.Length, fastModMultiplier)];
		}

		private static void ThrowArgumentExceptionForKeyNotFound(TKey key)
		{
			throw new ArgumentException($"The target key {key} was not present in the dictionary");
		}
	}
	internal static class HashHelpers
	{
		private const int MaxPrimeArrayLength = 2147483587;

		private const int HashPrime = 101;

		private static readonly int[] primes = new int[72]
		{
			3, 7, 11, 17, 23, 29, 37, 47, 59, 71,
			89, 107, 131, 163, 197, 239, 293, 353, 431, 521,
			631, 761, 919, 1103, 1327, 1597, 1931, 2333, 2801, 3371,
			4049, 4861, 5839, 7013, 8419, 10103, 12143, 14591, 17519, 21023,
			25229, 30293, 36353, 43627, 52361, 62851, 75431, 90523, 108631, 130363,
			156437, 187751, 225307, 270371, 324449, 389357, 467237, 560689, 672827, 807403,
			968897, 1162687, 1395263, 1674319, 2009191, 2411033, 2893249, 3471899, 4166287, 4999559,
			5999471, 7199369
		};

		private static bool IsPrime(int candidate)
		{
			if (((uint)candidate & (true ? 1u : 0u)) != 0)
			{
				int num = (int)Math.Sqrt(candidate);
				for (int i = 3; i <= num; i += 2)
				{
					if (candidate % i == 0)
					{
						return false;
					}
				}
				return true;
			}
			return candidate == 2;
		}

		public static int GetPrime(int min)
		{
			int[] array = primes;
			foreach (int num in array)
			{
				if (num >= min)
				{
					return num;
				}
			}
			for (int j = min | 1; j < int.MaxValue; j += 2)
			{
				if (IsPrime(j) && (j - 1) % 101 != 0)
				{
					return j;
				}
			}
			return min;
		}

		public static int ExpandPrime(int oldSize)
		{
			int num = 2 * oldSize;
			if ((uint)num > 2147483587u && 2147483587 > oldSize)
			{
				return 2147483587;
			}
			return GetPrime(num);
		}

		public static ulong GetFastModMultiplier(uint divisor)
		{
			return ulong.MaxValue / (ulong)divisor + 1;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static uint FastMod(uint value, uint divisor, ulong multiplier)
		{
			return (uint)(((multiplier * value >> 32) + 1) * divisor >> 32);
		}
	}
	internal interface IDictionary2
	{
		int Count { get; }

		void Clear();
	}
	internal interface IDictionary2<in TKey, out TValue> : IDictionary2<TKey>, IDictionary2 where TKey : IEquatable<TKey> where TValue : class?
	{
		TValue this[TKey key] { get; }
	}
	internal interface IDictionary2<in TKey> : IDictionary2 where TKey : IEquatable<TKey>
	{
		bool TryRemove(TKey key);
	}
}
namespace CommunityToolkit.Mvvm
{
	internal sealed class ArgumentNullException
	{
		public static class For<T>
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public static void ThrowIfNull([NotNull] T? argument, [CallerArgumentExpression("argument")] string? paramName = null)
			{
				if (argument == null)
				{
					Throw(paramName);
				}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		[DoesNotReturn]
		private static void Throw(string? paramName)
		{
			throw new System.ArgumentNullException(paramName);
		}
	}
}
namespace CommunityToolkit.Mvvm.Messaging
{
	public interface IMessenger
	{
		bool IsRegistered<TMessage, TToken>(object recipient, TToken token) where TMessage : class where TToken : IEquatable<TToken>;

		void Register<TRecipient, TMessage, TToken>(TRecipient recipient, TToken token, MessageHandler<TRecipient, TMessage> handler) where TRecipient : class where TMessage : class where TToken : IEquatable<TToken>;

		void UnregisterAll(object recipient);

		void UnregisterAll<TToken>(object recipient, TToken token) where TToken : IEquatable<TToken>;

		void Unregister<TMessage, TToken>(object recipient, TToken token) where TMessage : class where TToken : IEquatable<TToken>;

		TMessage Send<TMessage, TToken>(TMessage message, TToken token) where TMessage : class where TToken : IEquatable<TToken>;

		void Cleanup();

		void Reset();
	}
	public static class IMessengerExtensions
	{
		private static class MethodInfos
		{
			public static readonly MethodInfo RegisterIRecipient = new Action<IMessenger, IRecipient<object>, Unit>(Register).Method.GetGenericMethodDefinition();
		}

		private static class DiscoveredRecipients
		{
			public static readonly ConditionalWeakTable<Type, Action<IMessenger, object>?> RegistrationMethods = new ConditionalWeakTable<Type, Action<IMessenger, object>>();
		}

		private static class DiscoveredRecipients<TToken> where TToken : IEquatable<TToken>
		{
			public static readonly ConditionalWeakTable<Type, Action<IMessenger, object, TToken>> RegistrationMethods = new ConditionalWeakTable<Type, Action<IMessenger, object, TToken>>();
		}

		public static bool IsRegistered<TMessage>(this IMessenger messenger, object recipient) where TMessage : class
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			return messenger.IsRegistered<TMessage, Unit>(recipient, default(Unit));
		}

		[RequiresUnreferencedCode("This method requires the generated CommunityToolkit.Mvvm.Messaging.__Internals.__IMessengerExtensions type not to be removed to use the fast path. If this type is removed by the linker, or if the target recipient was created dynamically and was missed by the source generator, a slower fallback path using a compiled LINQ expression will be used. This will have more overhead in the first invocation of this method for any given recipient type.")]
		public static void RegisterAll(this IMessenger messenger, object recipient)
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			Action<IMessenger, object> value = DiscoveredRecipients.RegistrationMethods.GetValue(recipient.GetType(), [RequiresUnreferencedCode("The type of the current instance cannot be statically discovered.")] (Type t) => LoadRegistrationMethodsForType(t));
			if (value != null)
			{
				value(messenger, recipient);
			}
			else
			{
				messenger.RegisterAll(recipient, default(Unit));
			}
			[RequiresUnreferencedCode("The type of the current instance cannot be statically discovered.")]
			static Action<IMessenger, object>? LoadRegistrationMethodsForType(Type recipientType)
			{
				Type type = recipientType.Assembly.GetType("CommunityToolkit.Mvvm.Messaging.__Internals.__IMessengerExtensions");
				if ((object)type != null)
				{
					MethodInfo method = type.GetMethod("CreateAllMessagesRegistrator", new Type[1] { recipientType });
					if ((object)method != null)
					{
						return (Action<IMessenger, object>)method.Invoke(null, new object[1]);
					}
				}
				return null;
			}
		}

		[RequiresUnreferencedCode("This method requires the generated CommunityToolkit.Mvvm.Messaging.__Internals.__IMessengerExtensions type not to be removed to use the fast path. If this type is removed by the linker, or if the target recipient was created dynamically and was missed by the source generator, a slower fallback path using a compiled LINQ expression will be used. This will have more overhead in the first invocation of this method for any given recipient type.")]
		public static void RegisterAll<TToken>(this IMessenger messenger, object recipient, TToken token) where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			DiscoveredRecipients<TToken>.RegistrationMethods.GetValue(recipient.GetType(), [RequiresUnreferencedCode("The type of the current instance cannot be statically discovered.")] (Type t) => LoadRegistrationMethodsForType(t))(messenger, recipient, token);
			[RequiresUnreferencedCode("The type of the current instance cannot be statically discovered.")]
			static Action<IMessenger, object, TToken> LoadRegistrationMethodsForType(Type recipientType)
			{
				Type type = recipientType.Assembly.GetType("CommunityToolkit.Mvvm.Messaging.__Internals.__IMessengerExtensions");
				if ((object)type != null)
				{
					MethodInfo method = type.GetMethod("CreateAllMessagesRegistratorWithToken", new Type[1] { recipientType });
					if ((object)method != null)
					{
						return (Action<IMessenger, object, TToken>)method.MakeGenericMethod(typeof(TToken)).Invoke(null, new object[1]);
					}
				}
				return LoadRegistrationMethodsForTypeFallback(recipientType);
			}
			static Action<IMessenger, object, TToken> LoadRegistrationMethodsForTypeFallback(Type recipientType)
			{
				MethodInfo[] array = (from interfaceType in recipientType.GetInterfaces()
					where interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IRecipient<>)
					let messageType = interfaceType.GenericTypeArguments[0]
					select MethodInfos.RegisterIRecipient.MakeGenericMethod(messageType, typeof(TToken))).ToArray();
				if (array.Length == 0)
				{
					return delegate
					{
					};
				}
				ParameterExpression arg0 = Expression.Parameter(typeof(IMessenger));
				ParameterExpression parameterExpression = Expression.Parameter(typeof(object));
				ParameterExpression arg = Expression.Parameter(typeof(TToken));
				UnaryExpression inst1 = Expression.Convert(parameterExpression, recipientType);
				return Expression.Lambda<Action<IMessenger, object, TToken>>(Expression.Block(array.Select((MethodInfo registrationMethod) => Expression.Call(registrationMethod, new Expression[3] { arg0, inst1, arg }))), new ParameterExpression[3] { arg0, parameterExpression, arg }).Compile();
			}
		}

		public static void Register<TMessage>(this IMessenger messenger, IRecipient<TMessage> recipient) where TMessage : class
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			if (messenger is WeakReferenceMessenger weakReferenceMessenger)
			{
				weakReferenceMessenger.Register(recipient, default(Unit));
				return;
			}
			messenger.Register(recipient, default(Unit), delegate(IRecipient<TMessage> r, TMessage m)
			{
				r.Receive(m);
			});
		}

		public static void Register<TMessage, TToken>(this IMessenger messenger, IRecipient<TMessage> recipient, TToken token) where TMessage : class where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			if (messenger is WeakReferenceMessenger weakReferenceMessenger)
			{
				weakReferenceMessenger.Register(recipient, token);
				return;
			}
			if (messenger is StrongReferenceMessenger strongReferenceMessenger)
			{
				strongReferenceMessenger.Register(recipient, token);
				return;
			}
			messenger.Register(recipient, token, delegate(IRecipient<TMessage> r, TMessage m)
			{
				r.Receive(m);
			});
		}

		public static void Register<TMessage>(this IMessenger messenger, object recipient, MessageHandler<object, TMessage> handler) where TMessage : class
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.ThrowIfNull(handler, "handler");
			messenger.Register(recipient, default(Unit), handler);
		}

		public static void Register<TRecipient, TMessage>(this IMessenger messenger, TRecipient recipient, MessageHandler<TRecipient, TMessage> handler) where TRecipient : class where TMessage : class
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.ThrowIfNull(handler, "handler");
			messenger.Register(recipient, default(Unit), handler);
		}

		public static void Register<TMessage, TToken>(this IMessenger messenger, object recipient, TToken token, MessageHandler<object, TMessage> handler) where TMessage : class where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			ArgumentNullException.ThrowIfNull(handler, "handler");
			messenger.Register(recipient, token, handler);
		}

		public static void Unregister<TMessage>(this IMessenger messenger, object recipient) where TMessage : class
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			messenger.Unregister<TMessage, Unit>(recipient, default(Unit));
		}

		public static TMessage Send<TMessage>(this IMessenger messenger) where TMessage : class, new()
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			return messenger.Send(new TMessage(), default(Unit));
		}

		public static TMessage Send<TMessage>(this IMessenger messenger, TMessage message) where TMessage : class
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			ArgumentNullException.ThrowIfNull(message, "message");
			return messenger.Send(message, default(Unit));
		}

		public static TMessage Send<TMessage, TToken>(this IMessenger messenger, TToken token) where TMessage : class, new() where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			return messenger.Send(new TMessage(), token);
		}
	}
	public interface IRecipient<in TMessage> where TMessage : class
	{
		void Receive(TMessage message);
	}
	public delegate void MessageHandler<in TRecipient, in TMessage>(TRecipient recipient, TMessage message) where TRecipient : class where TMessage : class;
	public sealed class StrongReferenceMessenger : IMessenger
	{
		private sealed class Mapping : Dictionary2<Recipient, object?>, IMapping, IDictionary2<Recipient>, IDictionary2
		{
			public Type2 TypeArguments { get; }

			private Mapping(Type messageType)
			{
				TypeArguments = new Type2(messageType, typeof(Unit));
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public static Mapping Create<TMessage>() where TMessage : class
			{
				return new Mapping(typeof(TMessage));
			}
		}

		private sealed class Mapping<TToken> : Dictionary2<Recipient, Dictionary2<TToken, object?>>, IMapping, IDictionary2<Recipient>, IDictionary2 where TToken : IEquatable<TToken>
		{
			public Type2 TypeArguments { get; }

			private Mapping(Type messageType)
			{
				TypeArguments = new Type2(messageType, typeof(TToken));
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public static Mapping<TToken> Create<TMessage>() where TMessage : class
			{
				return new Mapping<TToken>(typeof(TMessage));
			}
		}

		private interface IMapping : IDictionary2<Recipient>, IDictionary2
		{
			Type2 TypeArguments { get; }
		}

		private readonly struct Recipient : IEquatable<Recipient>
		{
			public readonly object Target;

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public Recipient(object target)
			{
				Target = target;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public bool Equals(Recipient other)
			{
				return Target == other.Target;
			}

			public override bool Equals(object? obj)
			{
				if (obj is Recipient other)
				{
					return Equals(other);
				}
				return false;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public override int GetHashCode()
			{
				return RuntimeHelpers.GetHashCode(Target);
			}
		}

		private readonly Dictionary2<Recipient, HashSet<IMapping>> recipientsMap = new Dictionary2<Recipient, HashSet<IMapping>>();

		private readonly Dictionary2<Type2, IMapping> typesMap = new Dictionary2<Type2, IMapping>();

		public static StrongReferenceMessenger Default { get; } = new StrongReferenceMessenger();


		public bool IsRegistered<TMessage, TToken>(object recipient, TToken token) where TMessage : class where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			lock (recipientsMap)
			{
				if (typeof(TToken) == typeof(Unit))
				{
					if (!TryGetMapping<TMessage>(out Mapping mapping))
					{
						return false;
					}
					Recipient key = new Recipient(recipient);
					return mapping.ContainsKey(key);
				}
				if (!TryGetMapping<TMessage, TToken>(out Mapping<TToken> mapping2))
				{
					return false;
				}
				Recipient key2 = new Recipient(recipient);
				Dictionary2<TToken, object> value;
				return mapping2.TryGetValue(key2, out value) && value.ContainsKey(token);
			}
		}

		public void Register<TRecipient, TMessage, TToken>(TRecipient recipient, TToken token, MessageHandler<TRecipient, TMessage> handler) where TRecipient : class where TMessage : class where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			ArgumentNullException.ThrowIfNull(handler, "handler");
			Register<TMessage, TToken>(recipient, token, new MessageHandlerDispatcher.For<TRecipient, TMessage>(handler));
		}

		internal void Register<TMessage, TToken>(IRecipient<TMessage> recipient, TToken token) where TMessage : class where TToken : IEquatable<TToken>
		{
			Register<TMessage, TToken>(recipient, token, null);
		}

		private void Register<TMessage, TToken>(object recipient, TToken token, MessageHandlerDispatcher? dispatcher) where TMessage : class where TToken : IEquatable<TToken>
		{
			lock (recipientsMap)
			{
				Recipient key = new Recipient(recipient);
				IMapping item;
				if (typeof(TToken) == typeof(Unit))
				{
					Mapping orAddMapping = GetOrAddMapping<TMessage>();
					ref object? orAddValueRef = ref orAddMapping.GetOrAddValueRef(key);
					if (orAddValueRef != null)
					{
						ThrowInvalidOperationExceptionForDuplicateRegistration();
					}
					orAddValueRef = dispatcher;
					item = orAddMapping;
				}
				else
				{
					Mapping<TToken> orAddMapping2 = GetOrAddMapping<TMessage, TToken>();
					ref Dictionary2<TToken, object> orAddValueRef2 = ref orAddMapping2.GetOrAddValueRef(key);
					if (orAddValueRef2 == null)
					{
						orAddValueRef2 = new Dictionary2<TToken, object>();
					}
					ref object? orAddValueRef3 = ref orAddValueRef2.GetOrAddValueRef(token);
					if (orAddValueRef3 != null)
					{
						ThrowInvalidOperationExceptionForDuplicateRegistration();
					}
					orAddValueRef3 = dispatcher;
					item = orAddMapping2;
				}
				ref HashSet<IMapping> orAddValueRef4 = ref recipientsMap.GetOrAddValueRef(key);
				if (orAddValueRef4 == null)
				{
					orAddValueRef4 = new HashSet<IMapping>();
				}
				orAddValueRef4.Add(item);
			}
		}

		public void UnregisterAll(object recipient)
		{
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			lock (recipientsMap)
			{
				Recipient key = new Recipient(recipient);
				if (!recipientsMap.TryGetValue(key, out HashSet<IMapping> value))
				{
					return;
				}
				foreach (IMapping item in value)
				{
					if (item.TryRemove(key) && item.Count == 0)
					{
						typesMap.TryRemove(item.TypeArguments);
					}
				}
				recipientsMap.TryRemove(key);
			}
		}

		public void UnregisterAll<TToken>(object recipient, TToken token) where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			if (typeof(TToken) == typeof(Unit))
			{
				throw new NotImplementedException();
			}
			bool lockTaken = false;
			object[] array = null;
			int length = 0;
			try
			{
				Monitor.Enter(recipientsMap, ref lockTaken);
				Recipient key = new Recipient(recipient);
				if (!recipientsMap.TryGetValue(key, out HashSet<IMapping> value))
				{
					return;
				}
				array = ArrayPool<object>.Shared.Rent(value.Count);
				foreach (IMapping item in value)
				{
					if (item is IDictionary2<Recipient, IDictionary2<TToken>> dictionary)
					{
						array[length++] = dictionary;
					}
				}
				Span<object> span = array.AsSpan(0, length);
				for (int i = 0; i < span.Length; i++)
				{
					IDictionary2<Recipient, IDictionary2<TToken>> dictionary2 = Unsafe.As<IDictionary2<Recipient, IDictionary2<TToken>>>(span[i]);
					IDictionary2<TToken> dictionary3 = dictionary2[key];
					if (dictionary3.TryRemove(token) && dictionary3.Count == 0)
					{
						dictionary2.TryRemove(key);
						IMapping mapping = Unsafe.As<IMapping>(dictionary2);
						value.Remove(mapping);
						if (value.Count == 0)
						{
							recipientsMap.TryRemove(key);
						}
						if (dictionary2.Count == 0)
						{
							typesMap.TryRemove(mapping.TypeArguments);
						}
					}
				}
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(recipientsMap);
				}
				if (array != null)
				{
					array.AsSpan(0, length).Clear();
					ArrayPool<object>.Shared.Return(array);
				}
			}
		}

		public void Unregister<TMessage, TToken>(object recipient, TToken token) where TMessage : class where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			lock (recipientsMap)
			{
				if (typeof(TToken) == typeof(Unit))
				{
					if (!TryGetMapping<TMessage>(out Mapping mapping))
					{
						return;
					}
					Recipient key = new Recipient(recipient);
					if (mapping.TryRemove(key))
					{
						mapping.TryRemove(key);
						if (mapping.Count == 0)
						{
							typesMap.TryRemove(mapping.TypeArguments);
						}
						HashSet<IMapping> hashSet = recipientsMap[key];
						hashSet.Remove(mapping);
						if (hashSet.Count == 0)
						{
							recipientsMap.TryRemove(key);
						}
					}
				}
				else
				{
					if (!TryGetMapping<TMessage, TToken>(out Mapping<TToken> mapping2))
					{
						return;
					}
					Recipient key2 = new Recipient(recipient);
					if (mapping2.TryGetValue(key2, out Dictionary2<TToken, object> value) && value.TryRemove(token) && value.Count == 0)
					{
						mapping2.TryRemove(key2);
						if (mapping2.Count == 0)
						{
							typesMap.TryRemove(mapping2.TypeArguments);
						}
						HashSet<IMapping> hashSet2 = recipientsMap[key2];
						hashSet2.Remove(mapping2);
						if (hashSet2.Count == 0)
						{
							recipientsMap.TryRemove(key2);
						}
					}
				}
			}
		}

		public TMessage Send<TMessage, TToken>(TMessage message, TToken token) where TMessage : class where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(message, "message");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			int num = 0;
			Span<object> span;
			object[] array;
			lock (recipientsMap)
			{
				Mapping<TToken> mapping2;
				if (typeof(TToken) == typeof(Unit))
				{
					if (TryGetMapping<TMessage>(out Mapping mapping))
					{
						int count = mapping.Count;
						if (count != 0)
						{
							span = (array = ArrayPool<object>.Shared.Rent(2 * count));
							Dictionary2<Recipient, object>.Enumerator enumerator = mapping.GetEnumerator();
							while (enumerator.MoveNext())
							{
								span[2 * num] = enumerator.GetValue();
								span[2 * num + 1] = enumerator.GetKey().Target;
								num++;
							}
							goto IL_015d;
						}
					}
				}
				else if (TryGetMapping<TMessage, TToken>(out mapping2))
				{
					int count2 = mapping2.Count;
					if (count2 != 0)
					{
						span = (array = ArrayPool<object>.Shared.Rent(2 * count2));
						Dictionary2<Recipient, Dictionary2<TToken, object>>.Enumerator enumerator2 = mapping2.GetEnumerator();
						while (enumerator2.MoveNext())
						{
							if (enumerator2.GetValue().TryGetValue(token, out var value))
							{
								span[2 * num] = value;
								span[2 * num + 1] = enumerator2.GetKey().Target;
								num++;
							}
						}
						goto IL_015d;
					}
				}
			}
			goto IL_0183;
			IL_015d:
			try
			{
				WeakReferenceMessenger.SendAll(span, num, message);
			}
			finally
			{
				Array.Clear(array, 0, 2 * num);
				ArrayPool<object>.Shared.Return(array);
			}
			goto IL_0183;
			IL_0183:
			return message;
		}

		void IMessenger.Cleanup()
		{
		}

		public void Reset()
		{
			lock (recipientsMap)
			{
				recipientsMap.Clear();
				typesMap.Clear();
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private bool TryGetMapping<TMessage>([NotNullWhen(true)] out Mapping? mapping) where TMessage : class
		{
			Type2 key = new Type2(typeof(TMessage), typeof(Unit));
			if (typesMap.TryGetValue(key, out IMapping value))
			{
				mapping = Unsafe.As<Mapping>(value);
				return true;
			}
			mapping = null;
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private bool TryGetMapping<TMessage, TToken>([NotNullWhen(true)] out Mapping<TToken>? mapping) where TMessage : class where TToken : IEquatable<TToken>
		{
			Type2 key = new Type2(typeof(TMessage), typeof(TToken));
			if (typesMap.TryGetValue(key, out IMapping value))
			{
				mapping = Unsafe.As<Mapping<TToken>>(value);
				return true;
			}
			mapping = null;
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private Mapping GetOrAddMapping<TMessage>() where TMessage : class
		{
			Type2 key = new Type2(typeof(TMessage), typeof(Unit));
			ref IMapping orAddValueRef = ref typesMap.GetOrAddValueRef(key);
			if (orAddValueRef == null)
			{
				orAddValueRef = Mapping.Create<TMessage>();
			}
			return Unsafe.As<Mapping>(orAddValueRef);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private Mapping<TToken> GetOrAddMapping<TMessage, TToken>() where TMessage : class where TToken : IEquatable<TToken>
		{
			Type2 key = new Type2(typeof(TMessage), typeof(TToken));
			ref IMapping orAddValueRef = ref typesMap.GetOrAddValueRef(key);
			if (orAddValueRef == null)
			{
				orAddValueRef = Mapping<TToken>.Create<TMessage>();
			}
			return Unsafe.As<Mapping<TToken>>(orAddValueRef);
		}

		private static void ThrowInvalidOperationExceptionForDuplicateRegistration()
		{
			throw new InvalidOperationException("The target recipient has already subscribed to the target message.");
		}
	}
	public sealed class WeakReferenceMessenger : IMessenger
	{
		private readonly Dictionary2<Type2, ConditionalWeakTable2<object, object?>> recipientsMap = new Dictionary2<Type2, ConditionalWeakTable2<object, object>>();

		public static WeakReferenceMessenger Default { get; } = new WeakReferenceMessenger();


		public WeakReferenceMessenger()
		{
			System.Gen2GcCallback.Register(Gen2GcCallbackProxy, this);
			static void Gen2GcCallbackProxy(object target)
			{
				((WeakReferenceMessenger)target).CleanupWithNonBlockingLock();
			}
		}

		public bool IsRegistered<TMessage, TToken>(object recipient, TToken token) where TMessage : class where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			lock (recipientsMap)
			{
				Type2 key = new Type2(typeof(TMessage), typeof(TToken));
				if (!recipientsMap.TryGetValue(key, out ConditionalWeakTable2<object, object> value))
				{
					return false;
				}
				object value2;
				if (typeof(TToken) == typeof(Unit))
				{
					return value.TryGetValue(recipient, out value2);
				}
				object value3;
				return value.TryGetValue(recipient, out value3) && Unsafe.As<Dictionary2<TToken, object>>(value3).ContainsKey(token);
			}
		}

		public void Register<TRecipient, TMessage, TToken>(TRecipient recipient, TToken token, MessageHandler<TRecipient, TMessage> handler) where TRecipient : class where TMessage : class where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			ArgumentNullException.ThrowIfNull(handler, "handler");
			Register<TMessage, TToken>(recipient, token, new MessageHandlerDispatcher.For<TRecipient, TMessage>(handler));
		}

		internal void Register<TMessage, TToken>(IRecipient<TMessage> recipient, TToken token) where TMessage : class where TToken : IEquatable<TToken>
		{
			Register<TMessage, TToken>(recipient, token, null);
		}

		private void Register<TMessage, TToken>(object recipient, TToken token, MessageHandlerDispatcher? dispatcher) where TMessage : class where TToken : IEquatable<TToken>
		{
			lock (recipientsMap)
			{
				Type2 key = new Type2(typeof(TMessage), typeof(TToken));
				ref ConditionalWeakTable2<object, object> orAddValueRef = ref recipientsMap.GetOrAddValueRef(key);
				if (orAddValueRef == null)
				{
					orAddValueRef = new ConditionalWeakTable2<object, object>();
				}
				if (typeof(TToken) == typeof(Unit))
				{
					if (!orAddValueRef.TryAdd(recipient, dispatcher))
					{
						ThrowInvalidOperationExceptionForDuplicateRegistration();
					}
					return;
				}
				ref object? orAddValueRef2 = ref Unsafe.As<Dictionary2<TToken, object>>(orAddValueRef.GetValue(recipient, (object _) => new Dictionary2<TToken, object>())).GetOrAddValueRef(token);
				if (orAddValueRef2 != null)
				{
					ThrowInvalidOperationExceptionForDuplicateRegistration();
				}
				orAddValueRef2 = dispatcher;
			}
		}

		public void UnregisterAll(object recipient)
		{
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			lock (recipientsMap)
			{
				Dictionary2<Type2, ConditionalWeakTable2<object, object>>.Enumerator enumerator = recipientsMap.GetEnumerator();
				while (enumerator.MoveNext())
				{
					enumerator.GetValue().Remove(recipient);
				}
			}
		}

		public void UnregisterAll<TToken>(object recipient, TToken token) where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			if (typeof(TToken) == typeof(Unit))
			{
				throw new NotImplementedException();
			}
			lock (recipientsMap)
			{
				Dictionary2<Type2, ConditionalWeakTable2<object, object>>.Enumerator enumerator = recipientsMap.GetEnumerator();
				while (enumerator.MoveNext())
				{
					if (enumerator.GetKey().TToken == typeof(TToken) && enumerator.GetValue().TryGetValue(recipient, out var value))
					{
						Unsafe.As<Dictionary2<TToken, object>>(value).TryRemove(token);
					}
				}
			}
		}

		public void Unregister<TMessage, TToken>(object recipient, TToken token) where TMessage : class where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(recipient, "recipient");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			lock (recipientsMap)
			{
				Type2 key = new Type2(typeof(TMessage), typeof(TToken));
				if (recipientsMap.TryGetValue(key, out ConditionalWeakTable2<object, object> value))
				{
					object value2;
					if (typeof(TToken) == typeof(Unit))
					{
						value.Remove(recipient);
					}
					else if (value.TryGetValue(recipient, out value2))
					{
						Unsafe.As<Dictionary2<TToken, object>>(value2).TryRemove(token);
					}
				}
			}
		}

		public TMessage Send<TMessage, TToken>(TMessage message, TToken token) where TMessage : class where TToken : IEquatable<TToken>
		{
			ArgumentNullException.ThrowIfNull(message, "message");
			ArgumentNullException.For<TToken>.ThrowIfNull(token, "token");
			int num = 0;
			ArrayPoolBufferWriter<object> arrayPoolBufferWriter;
			lock (recipientsMap)
			{
				Type2 key = new Type2(typeof(TMessage), typeof(TToken));
				if (!recipientsMap.TryGetValue(key, out ConditionalWeakTable2<object, object> value))
				{
					return message;
				}
				arrayPoolBufferWriter = ArrayPoolBufferWriter<object>.Create();
				ConditionalWeakTable2<object, object>.Enumerator enumerator = value.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						object value2;
						if (typeof(TToken) == typeof(Unit))
						{
							arrayPoolBufferWriter.Add(enumerator.GetValue());
							arrayPoolBufferWriter.Add(enumerator.GetKey());
							num++;
						}
						else if (Unsafe.As<Dictionary2<TToken, object>>(enumerator.GetValue()).TryGetValue(token, out value2))
						{
							arrayPoolBufferWriter.Add(value2);
							arrayPoolBufferWriter.Add(enumerator.GetKey());
							num++;
						}
					}
				}
				finally
				{
					enumerator.Dispose();
				}
			}
			try
			{
				SendAll(arrayPoolBufferWriter.Span, num, message);
				return message;
			}
			finally
			{
				arrayPoolBufferWriter.Dispose();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		internal static void SendAll<TMessage>(ReadOnlySpan<object?> pairs, int i, TMessage message) where TMessage : class
		{
			ReadOnlySpan<object> span = pairs.Slice(0, 2 * i);
			ref object reference = ref MemoryMarshal.GetReference(span);
			ref object right = ref Unsafe.Add(ref reference, span.Length);
			while (Unsafe.IsAddressLessThan(ref reference, ref right))
			{
				object obj = reference;
				object obj2 = Unsafe.Add(ref reference, 1);
				if (obj == null)
				{
					Unsafe.As<IRecipient<TMessage>>(obj2).Receive(message);
				}
				else
				{
					Unsafe.As<MessageHandlerDispatcher>(obj).Invoke(obj2, message);
				}
				reference = ref Unsafe.Add(ref reference, 2);
			}
		}

		public void Cleanup()
		{
			lock (recipientsMap)
			{
				CleanupWithoutLock();
			}
		}

		public void Reset()
		{
			lock (recipientsMap)
			{
				recipientsMap.Clear();
			}
		}

		private void CleanupWithNonBlockingLock()
		{
			object obj = recipientsMap;
			bool lockTaken = false;
			try
			{
				Monitor.TryEnter(obj, ref lockTaken);
				if (lockTaken)
				{
					CleanupWithoutLock();
				}
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(obj);
				}
			}
		}

		private void CleanupWithoutLock()
		{
			ArrayPoolBufferWriter<Type2> arrayPoolBufferWriter = ArrayPoolBufferWriter<Type2>.Create();
			try
			{
				ArrayPoolBufferWriter<object> arrayPoolBufferWriter2 = ArrayPoolBufferWriter<object>.Create();
				try
				{
					Dictionary2<Type2, ConditionalWeakTable2<object, object>>.Enumerator enumerator = recipientsMap.GetEnumerator();
					while (enumerator.MoveNext())
					{
						arrayPoolBufferWriter2.Reset();
						bool flag = false;
						if (enumerator.GetKey().TToken == typeof(Unit))
						{
							ConditionalWeakTable2<object, object>.Enumerator enumerator2 = enumerator.GetValue().GetEnumerator();
							try
							{
								if (enumerator2.MoveNext())
								{
									flag = true;
								}
							}
							finally
							{
								enumerator2.Dispose();
							}
						}
						else
						{
							ConditionalWeakTable2<object, object>.Enumerator enumerator3 = enumerator.GetValue().GetEnumerator();
							try
							{
								while (enumerator3.MoveNext())
								{
									if (Unsafe.As<IDictionary2>(enumerator3.GetValue()).Count == 0)
									{
										arrayPoolBufferWriter2.Add(enumerator3.GetKey());
									}
									else
									{
										flag = true;
									}
								}
							}
							finally
							{
								enumerator3.Dispose();
							}
							ReadOnlySpan<object> span = arrayPoolBufferWriter2.Span;
							for (int i = 0; i < span.Length; i++)
							{
								object key = span[i];
								enumerator.GetValue().Remove(key);
							}
						}
						if (!flag)
						{
							arrayPoolBufferWriter.Add(enumerator.GetKey());
						}
					}
					ReadOnlySpan<Type2> span2 = arrayPoolBufferWriter.Span;
					for (int i = 0; i < span2.Length; i++)
					{
						Type2 key2 = span2[i];
						recipientsMap.TryRemove(key2);
					}
				}
				finally
				{
					arrayPoolBufferWriter2.Dispose();
				}
			}
			finally
			{
				arrayPoolBufferWriter.Dispose();
			}
		}

		private static void ThrowInvalidOperationExceptionForDuplicateRegistration()
		{
			throw new InvalidOperationException("The target recipient has already subscribed to the target message.");
		}
	}
}
namespace CommunityToolkit.Mvvm.Messaging.Messages
{
	public class AsyncCollectionRequestMessage<T> : IAsyncEnumerable<T>
	{
		private readonly List<(Task<T>?, Func<CancellationToken, Task<T>>?)> responses = new List<(Task<T>, Func<CancellationToken, Task<T>>)>();

		private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();

		public CancellationToken CancellationToken => cancellationTokenSource.Token;

		public void Reply(T response)
		{
			Reply(Task.FromResult(response));
		}

		public void Reply(Task<T> response)
		{
			ArgumentNullException.ThrowIfNull(response, "response");
			responses.Add((response, null));
		}

		public void Reply(Func<CancellationToken, Task<T>> response)
		{
			ArgumentNullException.ThrowIfNull(response, "response");
			responses.Add((null, response));
		}

		public async Task<IReadOnlyCollection<T>> GetResponsesAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			if (cancellationToken.CanBeCanceled)
			{
				cancellationToken.Register(cancellationTokenSource.Cancel);
			}
			List<T> results = new List<T>(responses.Count);
			await foreach (T item in this.WithCancellation(cancellationToken).ConfigureAwait(continueOnCapturedContext: false))
			{
				results.Add(item);
			}
			return results;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public async IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default(CancellationToken))
		{
			if (cancellationToken.CanBeCanceled)
			{
				cancellationToken.Register(cancellationTokenSource.Cancel);
			}
			foreach (var (task, func) in responses)
			{
				if (cancellationToken.IsCancellationRequested)
				{
					yield break;
				}
				if (task != null)
				{
					yield return await task.ConfigureAwait(continueOnCapturedContext: false);
				}
				else
				{
					yield return await func(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
				}
			}
		}
	}
	public class AsyncRequestMessage<T>
	{
		private Task<T>? response;

		public Task<T> Response
		{
			get
			{
				if (!HasReceivedResponse)
				{
					ThrowInvalidOperationExceptionForNoResponseReceived();
				}
				return response;
			}
		}

		public bool HasReceivedResponse { get; private set; }

		public void Reply(T response)
		{
			Reply(Task.FromResult(response));
		}

		public void Reply(Task<T> response)
		{
			ArgumentNullException.ThrowIfNull(response, "response");
			if (HasReceivedResponse)
			{
				ThrowInvalidOperationExceptionForDuplicateReply();
			}
			HasReceivedResponse = true;
			this.response = response;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public TaskAwaiter<T> GetAwaiter()
		{
			return Response.GetAwaiter();
		}

		[DoesNotReturn]
		private static void ThrowInvalidOperationExceptionForNoResponseReceived()
		{
			throw new InvalidOperationException("No response was received for the given request message.");
		}

		[DoesNotReturn]
		private static void ThrowInvalidOperationExceptionForDuplicateReply()
		{
			throw new InvalidOperationException("A response has already been issued for the current message.");
		}
	}
	public class CollectionRequestMessage<T> : IEnumerable<T>, IEnumerable
	{
		private readonly List<T> responses = new List<T>();

		public IReadOnlyCollection<T> Responses => responses;

		public void Reply(T response)
		{
			responses.Add(response);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public IEnumerator<T> GetEnumerator()
		{
			return responses.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
	public class PropertyChangedMessage<T>
	{
		public object Sender { get; }

		public string? PropertyName { get; }

		public T OldValue { get; }

		public T NewValue { get; }

		public PropertyChangedMessage(object sender, string? propertyName, T oldValue, T newValue)
		{
			ArgumentNullException.ThrowIfNull(sender, "sender");
			Sender = sender;
			PropertyName = propertyName;
			OldValue = oldValue;
			NewValue = newValue;
		}
	}
	public class RequestMessage<T>
	{
		private T response;

		public T Response
		{
			get
			{
				if (!HasReceivedResponse)
				{
					ThrowInvalidOperationExceptionForNoResponseReceived();
				}
				return response;
			}
		}

		public bool HasReceivedResponse { get; private set; }

		public void Reply(T response)
		{
			if (HasReceivedResponse)
			{
				ThrowInvalidOperationExceptionForDuplicateReply();
			}
			HasReceivedResponse = true;
			this.response = response;
		}

		public static implicit operator T(RequestMessage<T> message)
		{
			ArgumentNullException.ThrowIfNull(message, "message");
			return message.Response;
		}

		[DoesNotReturn]
		private static void ThrowInvalidOperationExceptionForNoResponseReceived()
		{
			throw new InvalidOperationException("No response was received for the given request message.");
		}

		[DoesNotReturn]
		private static void ThrowInvalidOperationExceptionForDuplicateReply()
		{
			throw new InvalidOperationException("A response has already been issued for the current message.");
		}
	}
	public class ValueChangedMessage<T>
	{
		public T Value { get; }

		public ValueChangedMessage(T value)
		{
			Value = value;
		}
	}
}
namespace CommunityToolkit.Mvvm.Messaging.Internals
{
	internal ref struct ArrayPoolBufferWriter<T>
	{
		private const int DefaultInitialBufferSize = 128;

		private T[] array;

		private Span<T> span;

		private int index;

		public ReadOnlySpan<T> Span
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				return span.Slice(0, index);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static ArrayPoolBufferWriter<T> Create()
		{
			Unsafe.SkipInit(out ArrayPoolBufferWriter<T> result);
			result.span = (result.array = ArrayPool<T>.Shared.Rent(128));
			result.index = 0;
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Add(T item)
		{
			Span<T> span = this.span;
			int num = index;
			if ((uint)num < (uint)span.Length)
			{
				span[num] = item;
				index = num + 1;
			}
			else
			{
				ResizeBufferAndAdd(item);
			}
		}

		public void Reset()
		{
			Array.Clear(array, 0, index);
			index = 0;
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void ResizeBufferAndAdd(T item)
		{
			T[] destinationArray = ArrayPool<T>.Shared.Rent(index << 2);
			Array.Copy(array, 0, destinationArray, 0, index);
			Array.Clear(array, 0, index);
			ArrayPool<T>.Shared.Return(array);
			span = (array = destinationArray);
			span[index++] = item;
		}

		public void Dispose()
		{
			Array.Clear(array, 0, index);
			ArrayPool<T>.Shared.Return(array);
		}
	}
	internal abstract class MessageHandlerDispatcher
	{
		public sealed class For<TRecipient, TMessage> : MessageHandlerDispatcher where TRecipient : class where TMessage : class
		{
			private readonly MessageHandler<TRecipient, TMessage> handler;

			public For(MessageHandler<TRecipient, TMessage> handler)
			{
				this.handler = handler;
			}

			public override void Invoke(object recipient, object message)
			{
				handler(Unsafe.As<TRecipient>(recipient), Unsafe.As<TMessage>(message));
			}
		}

		public abstract void Invoke(object recipient, object message);
	}
	internal readonly struct Type2 : IEquatable<Type2>
	{
		public readonly Type TMessage;

		public readonly Type TToken;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Type2(Type tMessage, Type tToken)
		{
			TMessage = tMessage;
			TToken = tToken;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool Equals(Type2 other)
		{
			if (TMessage == other.TMessage)
			{
				return TToken == other.TToken;
			}
			return false;
		}

		public override bool Equals(object? obj)
		{
			if (obj is Type2 other)
			{
				return Equals(other);
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public override int GetHashCode()
		{
			int hashCode = TMessage.GetHashCode();
			hashCode = (hashCode << 5) + hashCode;
			return hashCode + TToken.GetHashCode();
		}
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	internal readonly struct Unit : IEquatable<Unit>
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool Equals(Unit other)
		{
			return true;
		}

		public override bool Equals(object? obj)
		{
			return obj is Unit;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public override int GetHashCode()
		{
			return 0;
		}
	}
}
namespace CommunityToolkit.Mvvm.Input
{
	public sealed class AsyncRelayCommand : IAsyncRelayCommand, IRelayCommand, ICommand, INotifyPropertyChanged, ICancellationAwareCommand
	{
		internal static readonly PropertyChangedEventArgs ExecutionTaskChangedEventArgs = new PropertyChangedEventArgs("ExecutionTask");

		internal static readonly PropertyChangedEventArgs CanBeCanceledChangedEventArgs = new PropertyChangedEventArgs("CanBeCanceled");

		internal static readonly PropertyChangedEventArgs IsCancellationRequestedChangedEventArgs = new PropertyChangedEventArgs("IsCancellationRequested");

		internal static readonly PropertyChangedEventArgs IsRunningChangedEventArgs = new PropertyChangedEventArgs("IsRunning");

		private readonly Func<Task>? execute;

		private readonly Func<CancellationToken, Task>? cancelableExecute;

		private readonly Func<bool>? canExecute;

		private readonly AsyncRelayCommandOptions options;

		private CancellationTokenSource? cancellationTokenSource;

		private Task? executionTask;

		public Task? ExecutionTask
		{
			get
			{
				return executionTask;
			}
			private set
			{
				if (executionTask != value)
				{
					executionTask = value;
					this.PropertyChanged?.Invoke(this, ExecutionTaskChangedEventArgs);
					this.PropertyChanged?.Invoke(this, IsRunningChangedEventArgs);
					bool num = value?.IsCompleted ?? true;
					if (cancellationTokenSource != null)
					{
						this.PropertyChanged?.Invoke(this, CanBeCanceledChangedEventArgs);
						this.PropertyChanged?.Invoke(this, IsCancellationRequestedChangedEventArgs);
					}
					if (!num)
					{
						MonitorTask(this, value);
					}
				}
				static async void MonitorTask(AsyncRelayCommand @this, Task task)
				{
					await task.GetAwaitableWithoutEndValidation();
					if (@this.executionTask == task)
					{
						@this.PropertyChanged?.Invoke(@this, ExecutionTaskChangedEventArgs);
						@this.PropertyChanged?.Invoke(@this, IsRunningChangedEventArgs);
						if (@this.cancellationTokenSource != null)
						{
							@this.PropertyChanged?.Invoke(@this, CanBeCanceledChangedEventArgs);
						}
						if ((@this.options & AsyncRelayCommandOptions.AllowConcurrentExecutions) == 0)
						{
							@this.CanExecuteChanged?.Invoke(@this, EventArgs.Empty);
						}
					}
				}
			}
		}

		public bool CanBeCanceled
		{
			get
			{
				if (IsRunning)
				{
					CancellationTokenSource cancellationTokenSource = this.cancellationTokenSource;
					if (cancellationTokenSource != null)
					{
						return !cancellationTokenSource.IsCancellationRequested;
					}
					return false;
				}
				return false;
			}
		}

		public bool IsCancellationRequested => cancellationTokenSource?.IsCancellationRequested ?? false;

		public bool IsRunning
		{
			get
			{
				Task task = ExecutionTask;
				if (task != null)
				{
					return !task.IsCompleted;
				}
				return false;
			}
		}

		bool ICancellationAwareCommand.IsCancellationSupported => execute == null;

		public event PropertyChangedEventHandler? PropertyChanged;

		public event EventHandler? CanExecuteChanged;

		public AsyncRelayCommand(Func<Task> execute)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			this.execute = execute;
		}

		public AsyncRelayCommand(Func<Task> execute, AsyncRelayCommandOptions options)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			this.execute = execute;
			this.options = options;
		}

		public AsyncRelayCommand(Func<CancellationToken, Task> cancelableExecute)
		{
			ArgumentNullException.ThrowIfNull(cancelableExecute, "cancelableExecute");
			this.cancelableExecute = cancelableExecute;
		}

		public AsyncRelayCommand(Func<CancellationToken, Task> cancelableExecute, AsyncRelayCommandOptions options)
		{
			ArgumentNullException.ThrowIfNull(cancelableExecute, "cancelableExecute");
			this.cancelableExecute = cancelableExecute;
			this.options = options;
		}

		public AsyncRelayCommand(Func<Task> execute, Func<bool> canExecute)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			ArgumentNullException.ThrowIfNull(canExecute, "canExecute");
			this.execute = execute;
			this.canExecute = canExecute;
		}

		public AsyncRelayCommand(Func<Task> execute, Func<bool> canExecute, AsyncRelayCommandOptions options)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			ArgumentNullException.ThrowIfNull(canExecute, "canExecute");
			this.execute = execute;
			this.canExecute = canExecute;
			this.options = options;
		}

		public AsyncRelayCommand(Func<CancellationToken, Task> cancelableExecute, Func<bool> canExecute)
		{
			ArgumentNullException.ThrowIfNull(cancelableExecute, "cancelableExecute");
			ArgumentNullException.ThrowIfNull(canExecute, "canExecute");
			this.cancelableExecute = cancelableExecute;
			this.canExecute = canExecute;
		}

		public AsyncRelayCommand(Func<CancellationToken, Task> cancelableExecute, Func<bool> canExecute, AsyncRelayCommandOptions options)
		{
			ArgumentNullException.ThrowIfNull(cancelableExecute, "cancelableExecute");
			ArgumentNullException.ThrowIfNull(canExecute, "canExecute");
			this.cancelableExecute = cancelableExecute;
			this.canExecute = canExecute;
			this.options = options;
		}

		public void NotifyCanExecuteChanged()
		{
			this.CanExecuteChanged?.Invoke(this, EventArgs.Empty);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool CanExecute(object? parameter)
		{
			Func<bool>? func = canExecute;
			if (func == null || func())
			{
				if ((options & AsyncRelayCommandOptions.AllowConcurrentExecutions) == 0)
				{
					Task task = ExecutionTask;
					return task == null || task.IsCompleted;
				}
				return true;
			}
			return false;
		}

		public void Execute(object? parameter)
		{
			Task task = ExecuteAsync(parameter);
			if ((options & AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler) == 0)
			{
				AwaitAndThrowIfFailed(task);
			}
		}

		public Task ExecuteAsync(object? parameter)
		{
			Task result;
			if (execute != null)
			{
				Task task2 = (ExecutionTask = execute());
				result = task2;
			}
			else
			{
				this.cancellationTokenSource?.Cancel();
				CancellationTokenSource cancellationTokenSource = (this.cancellationTokenSource = new CancellationTokenSource());
				Task task2 = (ExecutionTask = cancelableExecute(cancellationTokenSource.Token));
				result = task2;
			}
			if ((options & AsyncRelayCommandOptions.AllowConcurrentExecutions) == 0)
			{
				this.CanExecuteChanged?.Invoke(this, EventArgs.Empty);
			}
			return result;
		}

		public void Cancel()
		{
			CancellationTokenSource cancellationTokenSource = this.cancellationTokenSource;
			if (cancellationTokenSource != null && !cancellationTokenSource.IsCancellationRequested)
			{
				cancellationTokenSource.Cancel();
				this.PropertyChanged?.Invoke(this, CanBeCanceledChangedEventArgs);
				this.PropertyChanged?.Invoke(this, IsCancellationRequestedChangedEventArgs);
			}
		}

		internal static async void AwaitAndThrowIfFailed(Task executionTask)
		{
			await executionTask;
		}
	}
	[Flags]
	public enum AsyncRelayCommandOptions
	{
		None = 0,
		AllowConcurrentExecutions = 1,
		FlowExceptionsToTaskScheduler = 2
	}
	public sealed class AsyncRelayCommand<T> : IAsyncRelayCommand<T>, IAsyncRelayCommand, IRelayCommand, ICommand, INotifyPropertyChanged, IRelayCommand<T>, ICancellationAwareCommand
	{
		private readonly Func<T?, Task>? execute;

		private readonly Func<T?, CancellationToken, Task>? cancelableExecute;

		private readonly Predicate<T?>? canExecute;

		private readonly AsyncRelayCommandOptions options;

		private CancellationTokenSource? cancellationTokenSource;

		private Task? executionTask;

		public Task? ExecutionTask
		{
			get
			{
				return executionTask;
			}
			private set
			{
				if (executionTask != value)
				{
					executionTask = value;
					this.PropertyChanged?.Invoke(this, AsyncRelayCommand.ExecutionTaskChangedEventArgs);
					this.PropertyChanged?.Invoke(this, AsyncRelayCommand.IsRunningChangedEventArgs);
					bool num = value?.IsCompleted ?? true;
					if (cancellationTokenSource != null)
					{
						this.PropertyChanged?.Invoke(this, AsyncRelayCommand.CanBeCanceledChangedEventArgs);
						this.PropertyChanged?.Invoke(this, AsyncRelayCommand.IsCancellationRequestedChangedEventArgs);
					}
					if (!num)
					{
						MonitorTask(this, value);
					}
				}
				static async void MonitorTask(AsyncRelayCommand<T> @this, Task task)
				{
					await task.GetAwaitableWithoutEndValidation();
					if (@this.executionTask == task)
					{
						@this.PropertyChanged?.Invoke(@this, AsyncRelayCommand.ExecutionTaskChangedEventArgs);
						@this.PropertyChanged?.Invoke(@this, AsyncRelayCommand.IsRunningChangedEventArgs);
						if (@this.cancellationTokenSource != null)
						{
							@this.PropertyChanged?.Invoke(@this, AsyncRelayCommand.CanBeCanceledChangedEventArgs);
						}
						if ((@this.options & AsyncRelayCommandOptions.AllowConcurrentExecutions) == 0)
						{
							@this.CanExecuteChanged?.Invoke(@this, EventArgs.Empty);
						}
					}
				}
			}
		}

		public bool CanBeCanceled
		{
			get
			{
				if (IsRunning)
				{
					CancellationTokenSource cancellationTokenSource = this.cancellationTokenSource;
					if (cancellationTokenSource != null)
					{
						return !cancellationTokenSource.IsCancellationRequested;
					}
					return false;
				}
				return false;
			}
		}

		public bool IsCancellationRequested => cancellationTokenSource?.IsCancellationRequested ?? false;

		public bool IsRunning
		{
			get
			{
				Task task = ExecutionTask;
				if (task != null)
				{
					return !task.IsCompleted;
				}
				return false;
			}
		}

		bool ICancellationAwareCommand.IsCancellationSupported => execute == null;

		public event PropertyChangedEventHandler? PropertyChanged;

		public event EventHandler? CanExecuteChanged;

		public AsyncRelayCommand(Func<T?, Task> execute)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			this.execute = execute;
		}

		public AsyncRelayCommand(Func<T?, Task> execute, AsyncRelayCommandOptions options)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			this.execute = execute;
			this.options = options;
		}

		public AsyncRelayCommand(Func<T?, CancellationToken, Task> cancelableExecute)
		{
			ArgumentNullException.ThrowIfNull(cancelableExecute, "cancelableExecute");
			this.cancelableExecute = cancelableExecute;
		}

		public AsyncRelayCommand(Func<T?, CancellationToken, Task> cancelableExecute, AsyncRelayCommandOptions options)
		{
			ArgumentNullException.ThrowIfNull(cancelableExecute, "cancelableExecute");
			this.cancelableExecute = cancelableExecute;
			this.options = options;
		}

		public AsyncRelayCommand(Func<T?, Task> execute, Predicate<T?> canExecute)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			ArgumentNullException.ThrowIfNull(canExecute, "canExecute");
			this.execute = execute;
			this.canExecute = canExecute;
		}

		public AsyncRelayCommand(Func<T?, Task> execute, Predicate<T?> canExecute, AsyncRelayCommandOptions options)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			ArgumentNullException.ThrowIfNull(canExecute, "canExecute");
			this.execute = execute;
			this.canExecute = canExecute;
			this.options = options;
		}

		public AsyncRelayCommand(Func<T?, CancellationToken, Task> cancelableExecute, Predicate<T?> canExecute)
		{
			ArgumentNullException.ThrowIfNull(cancelableExecute, "cancelableExecute");
			ArgumentNullException.ThrowIfNull(canExecute, "canExecute");
			this.cancelableExecute = cancelableExecute;
			this.canExecute = canExecute;
		}

		public AsyncRelayCommand(Func<T?, CancellationToken, Task> cancelableExecute, Predicate<T?> canExecute, AsyncRelayCommandOptions options)
		{
			ArgumentNullException.ThrowIfNull(cancelableExecute, "cancelableExecute");
			ArgumentNullException.ThrowIfNull(canExecute, "canExecute");
			this.cancelableExecute = cancelableExecute;
			this.canExecute = canExecute;
			this.options = options;
		}

		public void NotifyCanExecuteChanged()
		{
			this.CanExecuteChanged?.Invoke(this, EventArgs.Empty);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool CanExecute(T? parameter)
		{
			Predicate<T?>? predicate = canExecute;
			if (predicate == null || predicate(parameter))
			{
				if ((options & AsyncRelayCommandOptions.AllowConcurrentExecutions) == 0)
				{
					Task task = ExecutionTask;
					return task == null || task.IsCompleted;
				}
				return true;
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool CanExecute(object? parameter)
		{
			if (parameter == null && default(T) != null)
			{
				return false;
			}
			if (!RelayCommand<T>.TryGetCommandArgument(parameter, out T result))
			{
				RelayCommand<T>.ThrowArgumentExceptionForInvalidCommandArgument(parameter);
			}
			return CanExecute(result);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Execute(T? parameter)
		{
			Task task = ExecuteAsync(parameter);
			if ((options & AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler) == 0)
			{
				AsyncRelayCommand.AwaitAndThrowIfFailed(task);
			}
		}

		public void Execute(object? parameter)
		{
			if (!RelayCommand<T>.TryGetCommandArgument(parameter, out T result))
			{
				RelayCommand<T>.ThrowArgumentExceptionForInvalidCommandArgument(parameter);
			}
			Execute(result);
		}

		public Task ExecuteAsync(T? parameter)
		{
			Task result;
			if (execute != null)
			{
				Task task2 = (ExecutionTask = execute(parameter));
				result = task2;
			}
			else
			{
				this.cancellationTokenSource?.Cancel();
				CancellationTokenSource cancellationTokenSource = (this.cancellationTokenSource = new CancellationTokenSource());
				Task task2 = (ExecutionTask = cancelableExecute(parameter, cancellationTokenSource.Token));
				result = task2;
			}
			if ((options & AsyncRelayCommandOptions.AllowConcurrentExecutions) == 0)
			{
				this.CanExecuteChanged?.Invoke(this, EventArgs.Empty);
			}
			return result;
		}

		public Task ExecuteAsync(object? parameter)
		{
			if (!RelayCommand<T>.TryGetCommandArgument(parameter, out T result))
			{
				RelayCommand<T>.ThrowArgumentExceptionForInvalidCommandArgument(parameter);
			}
			return ExecuteAsync(result);
		}

		public void Cancel()
		{
			CancellationTokenSource cancellationTokenSource = this.cancellationTokenSource;
			if (cancellationTokenSource != null && !cancellationTokenSource.IsCancellationRequested)
			{
				cancellationTokenSource.Cancel();
				this.PropertyChanged?.Invoke(this, AsyncRelayCommand.CanBeCanceledChangedEventArgs);
				this.PropertyChanged?.Invoke(this, AsyncRelayCommand.IsCancellationRequestedChangedEventArgs);
			}
		}
	}
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	public sealed class RelayCommandAttribute : Attribute
	{
		public string? CanExecute { get; init; }

		public bool AllowConcurrentExecutions { get; init; }

		public bool FlowExceptionsToTaskScheduler { get; init; }

		public bool IncludeCancelCommand { get; init; }
	}
	public static class IAsyncRelayCommandExtensions
	{
		public static ICommand CreateCancelCommand(this IAsyncRelayCommand command)
		{
			ArgumentNullException.ThrowIfNull(command, "command");
			if (command is ICancellationAwareCommand cancellationAwareCommand && !cancellationAwareCommand.IsCancellationSupported)
			{
				return DisabledCommand.Instance;
			}
			return new CancelCommand(command);
		}
	}
	public interface IAsyncRelayCommand : IRelayCommand, ICommand, INotifyPropertyChanged
	{
		Task? ExecutionTask { get; }

		bool CanBeCanceled { get; }

		bool IsCancellationRequested { get; }

		bool IsRunning { get; }

		Task ExecuteAsync(object? parameter);

		void Cancel();
	}
	public interface IAsyncRelayCommand<in T> : IAsyncRelayCommand, IRelayCommand, ICommand, INotifyPropertyChanged, IRelayCommand<T>
	{
		Task ExecuteAsync(T? parameter);
	}
	public interface IRelayCommand : ICommand
	{
		void NotifyCanExecuteChanged();
	}
	public interface IRelayCommand<in T> : IRelayCommand, ICommand
	{
		bool CanExecute(T? parameter);

		void Execute(T? parameter);
	}
	public sealed class RelayCommand : IRelayCommand, ICommand
	{
		private readonly Action execute;

		private readonly Func<bool>? canExecute;

		public event EventHandler? CanExecuteChanged;

		public RelayCommand(Action execute)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			this.execute = execute;
		}

		public RelayCommand(Action execute, Func<bool> canExecute)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			ArgumentNullException.ThrowIfNull(canExecute, "canExecute");
			this.execute = execute;
			this.canExecute = canExecute;
		}

		public void NotifyCanExecuteChanged()
		{
			this.CanExecuteChanged?.Invoke(this, EventArgs.Empty);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool CanExecute(object? parameter)
		{
			return canExecute?.Invoke() ?? true;
		}

		public void Execute(object? parameter)
		{
			execute();
		}
	}
	public sealed class RelayCommand<T> : IRelayCommand<T>, IRelayCommand, ICommand
	{
		private readonly Action<T?> execute;

		private readonly Predicate<T?>? canExecute;

		public event EventHandler? CanExecuteChanged;

		public RelayCommand(Action<T?> execute)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			this.execute = execute;
		}

		public RelayCommand(Action<T?> execute, Predicate<T?> canExecute)
		{
			ArgumentNullException.ThrowIfNull(execute, "execute");
			ArgumentNullException.ThrowIfNull(canExecute, "canExecute");
			this.execute = execute;
			this.canExecute = canExecute;
		}

		public void NotifyCanExecuteChanged()
		{
			this.CanExecuteChanged?.Invoke(this, EventArgs.Empty);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool CanExecute(T? parameter)
		{
			return canExecute?.Invoke(parameter) ?? true;
		}

		public bool CanExecute(object? parameter)
		{
			if (parameter == null && default(T) != null)
			{
				return false;
			}
			if (!TryGetCommandArgument(parameter, out T result))
			{
				ThrowArgumentExceptionForInvalidCommandArgument(parameter);
			}
			return CanExecute(result);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Execute(T? parameter)
		{
			execute(parameter);
		}

		public void Execute(object? parameter)
		{
			if (!TryGetCommandArgument(parameter, out T result))
			{
				ThrowArgumentExceptionForInvalidCommandArgument(parameter);
			}
			Execute(result);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static bool TryGetCommandArgument(object? parameter, out T? result)
		{
			if (parameter == null && default(T) == null)
			{
				result = default(T);
				return true;
			}
			if (parameter is T val)
			{
				result = val;
				return true;
			}
			result = default(T);
			return false;
		}

		[DoesNotReturn]
		internal static void ThrowArgumentExceptionForInvalidCommandArgument(object? parameter)
		{
			throw GetException(parameter);
			[MethodImpl(MethodImplOptions.NoInlining)]
			static Exception GetException(object? parameter)
			{
				if (parameter == null)
				{
					return new ArgumentException($"Parameter \"{"parameter"}\" (object) must not be null, as the command type requires an argument of type {typeof(T)}.", "parameter");
				}
				return new ArgumentException($"Parameter \"{"parameter"}\" (object) cannot be of type {parameter.GetType()}, as the command type requires an argument of type {typeof(T)}.", "parameter");
			}
		}
	}
}
namespace CommunityToolkit.Mvvm.Input.Internals
{
	internal sealed class CancelCommand : ICommand
	{
		private readonly IAsyncRelayCommand command;

		public event EventHandler? CanExecuteChanged;

		public CancelCommand(IAsyncRelayCommand command)
		{
			this.command = command;
			this.command.PropertyChanged += OnPropertyChanged;
		}

		public bool CanExecute(object? parameter)
		{
			return command.CanBeCanceled;
		}

		public void Execute(object? parameter)
		{
			command.Cancel();
		}

		private void OnPropertyChanged(object? sender, PropertyChangedEventArgs e)
		{
			string propertyName = e.PropertyName;
			if (propertyName == null || propertyName == "CanBeCanceled")
			{
				this.CanExecuteChanged?.Invoke(this, EventArgs.Empty);
			}
		}
	}
	internal sealed class DisabledCommand : ICommand
	{
		public static DisabledCommand Instance { get; } = new DisabledCommand();


		public event EventHandler? CanExecuteChanged
		{
			add
			{
			}
			remove
			{
			}
		}

		public bool CanExecute(object? parameter)
		{
			return false;
		}

		public void Execute(object? parameter)
		{
		}
	}
	internal interface ICancellationAwareCommand
	{
		bool IsCancellationSupported { get; }
	}
}
namespace CommunityToolkit.Mvvm.DependencyInjection
{
	public sealed class Ioc : IServiceProvider
	{
		private volatile IServiceProvider? serviceProvider;

		public static Ioc Default { get; } = new Ioc();


		public object? GetService(Type serviceType)
		{
			ArgumentNullException.ThrowIfNull(serviceType, "serviceType");
			IServiceProvider? obj = serviceProvider;
			if (obj == null)
			{
				ThrowInvalidOperationExceptionForMissingInitialization();
			}
			return obj.GetService(serviceType);
		}

		public T? GetService<T>() where T : class
		{
			IServiceProvider? obj = serviceProvider;
			if (obj == null)
			{
				ThrowInvalidOperationExceptionForMissingInitialization();
			}
			return (T)obj.GetService(typeof(T));
		}

		public T GetRequiredService<T>() where T : class
		{
			IServiceProvider? obj = serviceProvider;
			if (obj == null)
			{
				ThrowInvalidOperationExceptionForMissingInitialization();
			}
			T obj2 = (T)obj.GetService(typeof(T));
			if (obj2 == null)
			{
				ThrowInvalidOperationExceptionForUnregisteredType();
			}
			return obj2;
		}

		public void ConfigureServices(IServiceProvider serviceProvider)
		{
			ArgumentNullException.ThrowIfNull(serviceProvider, "serviceProvider");
			if (Interlocked.CompareExchange(ref this.serviceProvider, serviceProvider, null) != null)
			{
				ThrowInvalidOperationExceptionForRepeatedConfiguration();
			}
		}

		[DoesNotReturn]
		private static void ThrowInvalidOperationExceptionForMissingInitialization()
		{
			throw new InvalidOperationException("The service provider has not been configured yet.");
		}

		[DoesNotReturn]
		private static void ThrowInvalidOperationExceptionForUnregisteredType()
		{
			throw new InvalidOperationException("The requested service type was not registered.");
		}

		[DoesNotReturn]
		private static void ThrowInvalidOperationExceptionForRepeatedConfiguration()
		{
			throw new InvalidOperationException("The default service provider has already been configured.");
		}
	}
}
namespace CommunityToolkit.Mvvm.ComponentModel
{
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	public sealed class INotifyPropertyChangedAttribute : Attribute
	{
		public bool IncludeAdditionalHelperMethods { get; init; } = true;

	}
	[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	public sealed class NotifyCanExecuteChangedForAttribute : Attribute
	{
		public string[] CommandNames { get; }

		public NotifyCanExecuteChangedForAttribute(string commandName)
		{
			CommandNames = new string[1] { commandName };
		}

		public NotifyCanExecuteChangedForAttribute(string commandName, params string[] otherCommandNames)
		{
			CommandNames = new string[1] { commandName }.Concat(otherCommandNames).ToArray();
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	public sealed class NotifyDataErrorInfoAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	public sealed class NotifyPropertyChangedForAttribute : Attribute
	{
		public string[] PropertyNames { get; }

		public NotifyPropertyChangedForAttribute(string propertyName)
		{
			PropertyNames = new string[1] { propertyName };
		}

		public NotifyPropertyChangedForAttribute(string propertyName, params string[] otherPropertyNames)
		{
			PropertyNames = new string[1] { propertyName }.Concat(otherPropertyNames).ToArray();
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	public sealed class NotifyPropertyChangedRecipientsAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	public sealed class ObservableObjectAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	public sealed class ObservablePropertyAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	public sealed class ObservableRecipientAttribute : Attribute
	{
	}
	public abstract class ObservableObject : INotifyPropertyChanged, INotifyPropertyChanging
	{
		private interface ITaskNotifier<TTask> where TTask : Task
		{
			TTask? Task { get; set; }
		}

		protected sealed class TaskNotifier : ITaskNotifier<Task>
		{
			private Task? task;

			Task? ITaskNotifier<Task>.Task
			{
				get
				{
					return task;
				}
				set
				{
					task = value;
				}
			}

			internal TaskNotifier()
			{
			}

			public static implicit operator Task?(TaskNotifier? notifier)
			{
				return notifier?.task;
			}
		}

		protected sealed class TaskNotifier<T> : ITaskNotifier<Task<T>>
		{
			private Task<T>? task;

			Task<T>? ITaskNotifier<Task<T>>.Task
			{
				get
				{
					return task;
				}
				set
				{
					task = value;
				}
			}

			internal TaskNotifier()
			{
			}

			public static implicit operator Task<T>?(TaskNotifier<T>? notifier)
			{
				return notifier?.task;
			}
		}

		public event PropertyChangedEventHandler? PropertyChanged;

		public event PropertyChangingEventHandler? PropertyChanging;

		protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
		{
			ArgumentNullException.ThrowIfNull(e, "e");
			this.PropertyChanged?.Invoke(this, e);
		}

		protected virtual void OnPropertyChanging(PropertyChangingEventArgs e)
		{
			ArgumentNullException.ThrowIfNull(e, "e");
			this.PropertyChanging?.Invoke(this, e);
		}

		protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
		{
			OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
		}

		protected void OnPropertyChanging([CallerMemberName] string? propertyName = null)
		{
			if (!Configuration.IsINotifyPropertyChangingDisabled)
			{
				OnPropertyChanging(new PropertyChangingEventArgs(propertyName));
			}
		}

		protected bool SetProperty<T>([NotNullIfNotNull("newValue")] ref T field, T newValue, [CallerMemberName] string? propertyName = null)
		{
			if (EqualityComparer<T>.Default.Equals(field, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			field = newValue;
			OnPropertyChanged(propertyName);
			return true;
		}

		protected bool SetProperty<T>([NotNullIfNotNull("newValue")] ref T field, T newValue, IEqualityComparer<T> comparer, [CallerMemberName] string? propertyName = null)
		{
			ArgumentNullException.ThrowIfNull(comparer, "comparer");
			if (comparer.Equals(field, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			field = newValue;
			OnPropertyChanged(propertyName);
			return true;
		}

		protected bool SetProperty<T>(T oldValue, T newValue, Action<T> callback, [CallerMemberName] string? propertyName = null)
		{
			ArgumentNullException.ThrowIfNull(callback, "callback");
			if (EqualityComparer<T>.Default.Equals(oldValue, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			callback(newValue);
			OnPropertyChanged(propertyName);
			return true;
		}

		protected bool SetProperty<T>(T oldValue, T newValue, IEqualityComparer<T> comparer, Action<T> callback, [CallerMemberName] string? propertyName = null)
		{
			ArgumentNullException.ThrowIfNull(comparer, "comparer");
			ArgumentNullException.ThrowIfNull(callback, "callback");
			if (comparer.Equals(oldValue, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			callback(newValue);
			OnPropertyChanged(propertyName);
			return true;
		}

		protected bool SetProperty<TModel, T>(T oldValue, T newValue, TModel model, Action<TModel, T> callback, [CallerMemberName] string? propertyName = null) where TModel : class
		{
			ArgumentNullException.ThrowIfNull(model, "model");
			ArgumentNullException.ThrowIfNull(callback, "callback");
			if (EqualityComparer<T>.Default.Equals(oldValue, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			callback(model, newValue);
			OnPropertyChanged(propertyName);
			return true;
		}

		protected bool SetProperty<TModel, T>(T oldValue, T newValue, IEqualityComparer<T> comparer, TModel model, Action<TModel, T> callback, [CallerMemberName] string? propertyName = null) where TModel : class
		{
			ArgumentNullException.ThrowIfNull(comparer, "comparer");
			ArgumentNullException.ThrowIfNull(model, "model");
			ArgumentNullException.ThrowIfNull(callback, "callback");
			if (comparer.Equals(oldValue, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			callback(model, newValue);
			OnPropertyChanged(propertyName);
			return true;
		}

		protected bool SetPropertyAndNotifyOnCompletion([NotNull] ref TaskNotifier? taskNotifier, Task? newValue, [CallerMemberName] string? propertyName = null)
		{
			return SetPropertyAndNotifyOnCompletion(taskNotifier ?? (taskNotifier = new TaskNotifier()), newValue, null, propertyName);
		}

		protected bool SetPropertyAndNotifyOnCompletion([NotNull] ref TaskNotifier? taskNotifier, Task? newValue, Action<Task?> callback, [CallerMemberName] string? propertyName = null)
		{
			ArgumentNullException.ThrowIfNull(callback, "callback");
			return SetPropertyAndNotifyOnCompletion(taskNotifier ?? (taskNotifier = new TaskNotifier()), newValue, callback, propertyName);
		}

		protected bool SetPropertyAndNotifyOnCompletion<T>([NotNull] ref TaskNotifier<T>? taskNotifier, Task<T>? newValue, [CallerMemberName] string? propertyName = null)
		{
			return SetPropertyAndNotifyOnCompletion(taskNotifier ?? (taskNotifier = new TaskNotifier<T>()), newValue, null, propertyName);
		}

		protected bool SetPropertyAndNotifyOnCompletion<T>([NotNull] ref TaskNotifier<T>? taskNotifier, Task<T>? newValue, Action<Task<T>?> callback, [CallerMemberName] string? propertyName = null)
		{
			ArgumentNullException.ThrowIfNull(callback, "callback");
			return SetPropertyAndNotifyOnCompletion(taskNotifier ?? (taskNotifier = new TaskNotifier<T>()), newValue, callback, propertyName);
		}

		private bool SetPropertyAndNotifyOnCompletion<TTask>(ITaskNotifier<TTask> taskNotifier, TTask? newValue, Action<TTask?>? callback, [CallerMemberName] string? propertyName = null) where TTask : Task
		{
			TTask newValue2 = newValue;
			ITaskNotifier<TTask> taskNotifier2 = taskNotifier;
			string propertyName2 = propertyName;
			Action<TTask?> callback2 = callback;
			if (taskNotifier2.Task == newValue2)
			{
				return false;
			}
			bool num = newValue2?.IsCompleted ?? true;
			OnPropertyChanging(propertyName2);
			taskNotifier2.Task = newValue2;
			OnPropertyChanged(propertyName2);
			if (num)
			{
				if (callback2 != null)
				{
					callback2(newValue2);
				}
				return true;
			}
			MonitorTask();
			return true;
			async void MonitorTask()
			{
				await newValue2.GetAwaitableWithoutEndValidation();
				if (taskNotifier2.Task == newValue2)
				{
					OnPropertyChanged(propertyName2);
				}
				if (callback2 != null)
				{
					callback2(newValue2);
				}
			}
		}
	}
	public abstract class ObservableRecipient : ObservableObject
	{
		private bool isActive;

		protected IMessenger Messenger { get; }

		public bool IsActive
		{
			get
			{
				return isActive;
			}
			[RequiresUnreferencedCode("When this property is set to true, the OnActivated() method will be invoked, which will register all necessary message handlers for this recipient. This method requires the generated CommunityToolkit.Mvvm.Messaging.__Internals.__IMessengerExtensions type not to be removed to use the fast path. If this type is removed by the linker, or if the target recipient was created dynamically and was missed by the source generator, a slower fallback path using a compiled LINQ expression will be used. This will have more overhead in the first invocation of this method for any given recipient type. Alternatively, OnActivated() can be manually overwritten, and registration can be done individually for each required message for this recipient.")]
			set
			{
				if (SetProperty(ref isActive, value, broadcast: true, "IsActive"))
				{
					if (value)
					{
						OnActivated();
					}
					else
					{
						OnDeactivated();
					}
				}
			}
		}

		protected ObservableRecipient()
			: this(WeakReferenceMessenger.Default)
		{
		}

		protected ObservableRecipient(IMessenger messenger)
		{
			ArgumentNullException.ThrowIfNull(messenger, "messenger");
			Messenger = messenger;
		}

		[RequiresUnreferencedCode("This method requires the generated CommunityToolkit.Mvvm.Messaging.__Internals.__IMessengerExtensions type not to be removed to use the fast path. If this type is removed by the linker, or if the target recipient was created dynamically and was missed by the source generator, a slower fallback path using a compiled LINQ expression will be used. This will have more overhead in the first invocation of this method for any given recipient type. Alternatively, OnActivated() can be manually overwritten, and registration can be done individually for each required message for this recipient.")]
		protected virtual void OnActivated()
		{
			Messenger.RegisterAll(this);
		}

		protected virtual void OnDeactivated()
		{
			Messenger.UnregisterAll(this);
		}

		protected virtual void Broadcast<T>(T oldValue, T newValue, string? propertyName)
		{
			PropertyChangedMessage<T> message = new PropertyChangedMessage<T>(this, propertyName, oldValue, newValue);
			Messenger.Send(message);
		}

		protected bool SetProperty<T>([NotNullIfNotNull("newValue")] ref T field, T newValue, bool broadcast, [CallerMemberName] string? propertyName = null)
		{
			T oldValue = field;
			bool num = SetProperty(ref field, newValue, propertyName);
			if (num && broadcast)
			{
				Broadcast(oldValue, newValue, propertyName);
			}
			return num;
		}

		protected bool SetProperty<T>([NotNullIfNotNull("newValue")] ref T field, T newValue, IEqualityComparer<T> comparer, bool broadcast, [CallerMemberName] string? propertyName = null)
		{
			ArgumentNullException.ThrowIfNull(comparer, "comparer");
			T oldValue = field;
			bool num = SetProperty(ref field, newValue, comparer, propertyName);
			if (num && broadcast)
			{
				Broadcast(oldValue, newValue, propertyName);
			}
			return num;
		}

		protected bool SetProperty<T>(T oldValue, T newValue, Action<T> callback, bool broadcast, [CallerMemberName] string? propertyName = null)
		{
			ArgumentNullException.ThrowIfNull(callback, "callback");
			bool num = SetProperty(oldValue, newValue, callback, propertyName);
			if (num && broadcast)
			{
				Broadcast(oldValue, newValue, propertyName);
			}
			return num;
		}

		protected bool SetProperty<T>(T oldValue, T newValue, IEqualityComparer<T> comparer, Action<T> callback, bool broadcast, [CallerMemberName] string? propertyName = null)
		{
			ArgumentNullException.ThrowIfNull(comparer, "comparer");
			ArgumentNullException.ThrowIfNull(callback, "callback");
			bool num = SetProperty(oldValue, newValue, comparer, callback, propertyName);
			if (num && broadcast)
			{
				Broadcast(oldValue, newValue, propertyName);
			}
			return num;
		}

		protected bool SetProperty<TModel, T>(T oldValue, T newValue, TModel model, Action<TModel, T> callback, bool broadcast, [CallerMemberName] string? propertyName = null) where TModel : class
		{
			ArgumentNullException.ThrowIfNull(model, "model");
			ArgumentNullException.ThrowIfNull(callback, "callback");
			bool num = SetProperty(oldValue, newValue, model, callback, propertyName);
			if (num && broadcast)
			{
				Broadcast(oldValue, newValue, propertyName);
			}
			return num;
		}

		protected bool SetProperty<TModel, T>(T oldValue, T newValue, IEqualityComparer<T> comparer, TModel model, Action<TModel, T> callback, bool broadcast, [CallerMemberName] string? propertyName = null) where TModel : class
		{
			ArgumentNullException.ThrowIfNull(comparer, "comparer");
			ArgumentNullException.ThrowIfNull(model, "model");
			ArgumentNullException.ThrowIfNull(callback, "callback");
			bool num = SetProperty(oldValue, newValue, comparer, model, callbac

ControlzEx.dll

Decompiled 5 months ago
#define TRACE
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Media;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows;
using System.Windows.Automation.Peers;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using ControlzEx.Automation.Peers;
using ControlzEx.Behaviors;
using ControlzEx.Controls;
using ControlzEx.Internal;
using ControlzEx.Native;
using ControlzEx.Standard;
using ControlzEx.Windows.Shell;
using Microsoft.CodeAnalysis;
using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;
using Microsoft.Xaml.Behaviors;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: XmlnsPrefix("urn:controlzex", "controlzex")]
[assembly: XmlnsDefinition("urn:controlzex", "ControlzEx")]
[assembly: XmlnsDefinition("urn:controlzex", "ControlzEx.Controls")]
[assembly: XmlnsDefinition("urn:controlzex", "ControlzEx.Behaviors")]
[assembly: XmlnsDefinition("urn:controlzex", "ControlzEx.Theming")]
[assembly: XmlnsDefinition("urn:controlzex", "ControlzEx.Windows.Shell")]
[assembly: ThemeInfo(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("https://github.com/ControlzEx/ControlzEx")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2020 Jan Karger, Bastian Schmidt, James Willock")]
[assembly: AssemblyDescription("ControlzEx is a library with some shared Controls for WPF.")]
[assembly: AssemblyFileVersion("4.4.0.50")]
[assembly: AssemblyInformationalVersion("4.4.0-rc.50+Branch.main.Sha.3d188a23b59272b6feff707c4f96be8743576e0d.3d188a23b59272b6feff707c4f96be8743576e0d")]
[assembly: AssemblyProduct("ControlzEx")]
[assembly: AssemblyTitle("ControlzEx")]
[assembly: AssemblyVersion("4.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ControlzEx
{
	public enum BadgePlacementMode
	{
		TopLeft,
		Top,
		TopRight,
		Right,
		BottomRight,
		Bottom,
		BottomLeft,
		Left
	}
	[TemplatePart(Name = "PART_BadgeContainer", Type = typeof(UIElement))]
	public class BadgedEx : ContentControl
	{
		public const string BadgeContainerPartName = "PART_BadgeContainer";

		[CLSCompliant(false)]
		protected FrameworkElement _badgeContainer;

		public static readonly DependencyProperty BadgeProperty;

		public static readonly DependencyProperty BadgeFontFamilyProperty;

		public static readonly DependencyProperty BadgeFontStyleProperty;

		public static readonly DependencyProperty BadgeFontWeightProperty;

		public static readonly DependencyProperty BadgeFontStretchProperty;

		public static readonly DependencyProperty BadgeFontSizeProperty;

		public static readonly DependencyProperty BadgeBackgroundProperty;

		public static readonly DependencyProperty BadgeForegroundProperty;

		public static readonly DependencyProperty BadgeBorderBrushProperty;

		public static readonly DependencyProperty BadgeBorderThicknessProperty;

		public static readonly DependencyProperty BadgePlacementModeProperty;

		public static readonly DependencyProperty BadgeMarginProperty;

		public static readonly DependencyProperty BadgeTemplateProperty;

		public static readonly DependencyProperty BadgeTemplateSelectorProperty;

		public static readonly DependencyProperty BadgeStringFormatProperty;

		public static readonly RoutedEvent BadgeChangedEvent;

		private static readonly DependencyPropertyKey IsBadgeSetPropertyKey;

		public static readonly DependencyProperty IsBadgeSetProperty;

		public object Badge
		{
			get
			{
				return ((DependencyObject)this).GetValue(BadgeProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BadgeProperty, value);
			}
		}

		[Bindable(true)]
		[Localizability(/*Could not decode attribute arguments.*/)]
		public FontFamily BadgeFontFamily
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (FontFamily)((DependencyObject)this).GetValue(BadgeFontFamilyProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BadgeFontFamilyProperty, (object)value);
			}
		}

		[Bindable(true)]
		public FontStyle BadgeFontStyle
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return (FontStyle)((DependencyObject)this).GetValue(BadgeFontStyleProperty);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((DependencyObject)this).SetValue(BadgeFontStyleProperty, (object)value);
			}
		}

		[Bindable(true)]
		public FontWeight BadgeFontWeight
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return (FontWeight)((DependencyObject)this).GetValue(BadgeFontWeightProperty);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((DependencyObject)this).SetValue(BadgeFontWeightProperty, (object)value);
			}
		}

		[Bindable(true)]
		public FontStretch BadgeFontStretch
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return (FontStretch)((DependencyObject)this).GetValue(BadgeFontStretchProperty);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((DependencyObject)this).SetValue(BadgeFontStretchProperty, (object)value);
			}
		}

		[TypeConverter(typeof(FontSizeConverter))]
		[Localizability(/*Could not decode attribute arguments.*/)]
		public double BadgeFontSize
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(BadgeFontSizeProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BadgeFontSizeProperty, (object)value);
			}
		}

		public Brush BadgeBackground
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Brush)((DependencyObject)this).GetValue(BadgeBackgroundProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BadgeBackgroundProperty, (object)value);
			}
		}

		public Brush BadgeForeground
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Brush)((DependencyObject)this).GetValue(BadgeForegroundProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BadgeForegroundProperty, (object)value);
			}
		}

		public Brush BadgeBorderBrush
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Brush)((DependencyObject)this).GetValue(BadgeBorderBrushProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BadgeBorderBrushProperty, (object)value);
			}
		}

		public Thickness BadgeBorderThickness
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return (Thickness)((DependencyObject)this).GetValue(BadgeBorderThicknessProperty);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((DependencyObject)this).SetValue(BadgeBorderThicknessProperty, (object)value);
			}
		}

		public BadgePlacementMode BadgePlacementMode
		{
			get
			{
				return (BadgePlacementMode)((DependencyObject)this).GetValue(BadgePlacementModeProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BadgePlacementModeProperty, (object)value);
			}
		}

		public Thickness BadgeMargin
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return (Thickness)((DependencyObject)this).GetValue(BadgeMarginProperty);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((DependencyObject)this).SetValue(BadgeMarginProperty, (object)value);
			}
		}

		public DataTemplate BadgeTemplate
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (DataTemplate)((DependencyObject)this).GetValue(BadgeTemplateProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BadgeTemplateProperty, (object)value);
			}
		}

		public DataTemplateSelector BadgeTemplateSelector
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (DataTemplateSelector)((DependencyObject)this).GetValue(BadgeTemplateSelectorProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BadgeTemplateSelectorProperty, (object)value);
			}
		}

		public string BadgeStringFormat
		{
			get
			{
				return (string)((DependencyObject)this).GetValue(BadgeStringFormatProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BadgeStringFormatProperty, (object)value);
			}
		}

		public bool IsBadgeSet
		{
			get
			{
				return (bool)((DependencyObject)this).GetValue(IsBadgeSetProperty);
			}
			private set
			{
				((DependencyObject)this).SetValue(IsBadgeSetPropertyKey, (object)value);
			}
		}

		public event RoutedPropertyChangedEventHandler<object> BadgeChanged
		{
			add
			{
				((UIElement)this).AddHandler(BadgeChangedEvent, (Delegate)(object)value);
			}
			remove
			{
				((UIElement)this).RemoveHandler(BadgeChangedEvent, (Delegate)(object)value);
			}
		}

		private static void OnBadgeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			BadgedEx badgedEx = (BadgedEx)(object)d;
			badgedEx.IsBadgeSet = !string.IsNullOrWhiteSpace(((DependencyPropertyChangedEventArgs)(ref e)).NewValue as string) || (((DependencyPropertyChangedEventArgs)(ref e)).NewValue != null && !(((DependencyPropertyChangedEventArgs)(ref e)).NewValue is string));
			RoutedPropertyChangedEventArgs<object> obj = new RoutedPropertyChangedEventArgs<object>(((DependencyPropertyChangedEventArgs)(ref e)).OldValue, ((DependencyPropertyChangedEventArgs)(ref e)).NewValue);
			((RoutedEventArgs)obj).RoutedEvent = BadgeChanged;
			RoutedPropertyChangedEventArgs<object> val = obj;
			((UIElement)badgedEx).RaiseEvent((RoutedEventArgs)(object)val);
		}

		static BadgedEx()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Expected O, but got Unknown
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Expected O, but got Unknown
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Expected O, but got Unknown
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Expected O, but got Unknown
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Expected O, but got Unknown
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Expected O, but got Unknown
			BadgeProperty = DependencyProperty.Register("Badge", typeof(object), typeof(BadgedEx), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)2, new PropertyChangedCallback(OnBadgeChanged)));
			BadgeFontFamilyProperty = DependencyProperty.RegisterAttached("BadgeFontFamily", typeof(FontFamily), typeof(BadgedEx), (PropertyMetadata)new FrameworkPropertyMetadata((object)SystemFonts.MessageFontFamily, (FrameworkPropertyMetadataOptions)49));
			BadgeFontStyleProperty = DependencyProperty.RegisterAttached("BadgeFontStyle", typeof(FontStyle), typeof(BadgedEx), (PropertyMetadata)new FrameworkPropertyMetadata((object)SystemFonts.MessageFontStyle, (FrameworkPropertyMetadataOptions)49));
			BadgeFontWeightProperty = DependencyProperty.RegisterAttached("BadgeFontWeight", typeof(FontWeight), typeof(BadgedEx), (PropertyMetadata)new FrameworkPropertyMetadata((object)SystemFonts.MessageFontWeight, (FrameworkPropertyMetadataOptions)49));
			BadgeFontStretchProperty = DependencyProperty.RegisterAttached("BadgeFontStretch", typeof(FontStretch), typeof(BadgedEx), (PropertyMetadata)new FrameworkPropertyMetadata((object)FontStretches.Normal, (FrameworkPropertyMetadataOptions)49));
			BadgeFontSizeProperty = DependencyProperty.RegisterAttached("BadgeFontSize", typeof(double), typeof(BadgedEx), (PropertyMetadata)new FrameworkPropertyMetadata((object)SystemFonts.MessageFontSize, (FrameworkPropertyMetadataOptions)49));
			BadgeBackgroundProperty = DependencyProperty.Register("BadgeBackground", typeof(Brush), typeof(BadgedEx), new PropertyMetadata((object)null));
			BadgeForegroundProperty = DependencyProperty.Register("BadgeForeground", typeof(Brush), typeof(BadgedEx), new PropertyMetadata((object)null));
			BadgeBorderBrushProperty = DependencyProperty.Register("BadgeBorderBrush", typeof(Brush), typeof(BadgedEx), new PropertyMetadata((object)null));
			BadgeBorderThicknessProperty = DependencyProperty.Register("BadgeBorderThickness", typeof(Thickness), typeof(BadgedEx), new PropertyMetadata((object)default(Thickness)));
			BadgePlacementModeProperty = DependencyProperty.Register("BadgePlacementMode", typeof(BadgePlacementMode), typeof(BadgedEx), new PropertyMetadata((object)BadgePlacementMode.TopLeft));
			BadgeMarginProperty = DependencyProperty.Register("BadgeMargin", typeof(Thickness), typeof(BadgedEx), new PropertyMetadata((object)default(Thickness)));
			BadgeTemplateProperty = DependencyProperty.Register("BadgeTemplate", typeof(DataTemplate), typeof(BadgedEx), new PropertyMetadata((PropertyChangedCallback)null));
			BadgeTemplateSelectorProperty = DependencyProperty.Register("BadgeTemplateSelector", typeof(DataTemplateSelector), typeof(BadgedEx), new PropertyMetadata((PropertyChangedCallback)null));
			BadgeStringFormatProperty = DependencyProperty.Register("BadgeStringFormat", typeof(string), typeof(BadgedEx), (PropertyMetadata)new FrameworkPropertyMetadata((object)null));
			BadgeChanged = EventManager.RegisterRoutedEvent("BadgeChanged", (RoutingStrategy)1, typeof(RoutedPropertyChangedEventHandler<object>), typeof(BadgedEx));
			IsBadgeSetPropertyKey = DependencyProperty.RegisterReadOnly("IsBadgeSet", typeof(bool), typeof(BadgedEx), new PropertyMetadata((object)false));
			IsBadgeSetProperty = IsBadgeSetPropertyKey.DependencyProperty;
			FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(BadgedEx), (PropertyMetadata)new FrameworkPropertyMetadata((object)typeof(BadgedEx)));
		}

		public override void OnApplyTemplate()
		{
			((FrameworkElement)this).OnApplyTemplate();
			ref FrameworkElement badgeContainer = ref _badgeContainer;
			DependencyObject templateChild = ((FrameworkElement)this).GetTemplateChild("PART_BadgeContainer");
			badgeContainer = (FrameworkElement)(object)((templateChild is FrameworkElement) ? templateChild : null);
		}

		protected override Size ArrangeOverride(Size arrangeBounds)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			Size result = ((Control)this).ArrangeOverride(arrangeBounds);
			if (_badgeContainer == null)
			{
				return result;
			}
			Size desiredSize = ((UIElement)_badgeContainer).DesiredSize;
			if ((((Size)(ref desiredSize)).Width <= 0.0 || ((Size)(ref desiredSize)).Height <= 0.0) && !double.IsNaN(_badgeContainer.ActualWidth) && !double.IsInfinity(_badgeContainer.ActualWidth) && !double.IsNaN(_badgeContainer.ActualHeight) && !double.IsInfinity(_badgeContainer.ActualHeight))
			{
				((Size)(ref desiredSize))..ctor(_badgeContainer.ActualWidth, _badgeContainer.ActualHeight);
			}
			double num = 0.0 - ((Size)(ref desiredSize)).Width / 2.0;
			double num2 = 0.0 - ((Size)(ref desiredSize)).Height / 2.0;
			_badgeContainer.Margin = new Thickness(0.0);
			_badgeContainer.Margin = new Thickness(num, num2, num, num2);
			return result;
		}
	}
	internal static class DesignerConstants
	{
		public const string LibraryName = "ControlzEx";

		public const string Win32ElementWarning = "Use this element with caution and only if you know what you are doing. It's only meant to be used internally by MahApps.Metro and Fluent.Ribbon. Breaking changes might occur anytime without prior warning.";
	}
	public sealed class KeyboardNavigationEx
	{
		private static KeyboardNavigationEx _instance;

		private readonly PropertyInfo _alwaysShowFocusVisual;

		private readonly MethodInfo _showFocusVisual;

		public static readonly DependencyProperty AlwaysShowFocusVisualProperty;

		internal static KeyboardNavigationEx Instance => _instance ?? (_instance = new KeyboardNavigationEx());

		internal bool AlwaysShowFocusVisualInternal
		{
			get
			{
				return (bool)_alwaysShowFocusVisual.GetValue(null, null);
			}
			set
			{
				_alwaysShowFocusVisual.SetValue(null, value, null);
			}
		}

		static KeyboardNavigationEx()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			AlwaysShowFocusVisualProperty = DependencyProperty.RegisterAttached("AlwaysShowFocusVisual", typeof(bool), typeof(KeyboardNavigationEx), (PropertyMetadata)new FrameworkPropertyMetadata((object)false, new PropertyChangedCallback(OnAlwaysShowFocusVisualChanged)));
		}

		private KeyboardNavigationEx()
		{
			Type typeFromHandle = typeof(KeyboardNavigation);
			_alwaysShowFocusVisual = typeFromHandle.GetProperty("AlwaysShowFocusVisual", BindingFlags.Static | BindingFlags.NonPublic);
			_showFocusVisual = typeFromHandle.GetMethod("ShowFocusVisual", BindingFlags.Static | BindingFlags.NonPublic);
		}

		internal void ShowFocusVisualInternal()
		{
			_showFocusVisual.Invoke(null, null);
		}

		public static void Focus(UIElement element)
		{
			UIElement obj = element;
			if (obj == null)
			{
				return;
			}
			((DispatcherObject)obj).Dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
			{
				KeyboardNavigationEx instance = Instance;
				bool alwaysShowFocusVisualInternal = instance.AlwaysShowFocusVisualInternal;
				instance.AlwaysShowFocusVisualInternal = true;
				try
				{
					Keyboard.Focus((IInputElement)(object)element);
					instance.ShowFocusVisualInternal();
				}
				finally
				{
					instance.AlwaysShowFocusVisualInternal = alwaysShowFocusVisualInternal;
				}
			});
		}

		private static void OnAlwaysShowFocusVisualChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			UIElement val = (UIElement)(object)((dependencyObject is UIElement) ? dependencyObject : null);
			if (val != null && ((DependencyPropertyChangedEventArgs)(ref args)).NewValue != ((DependencyPropertyChangedEventArgs)(ref args)).OldValue)
			{
				val.GotFocus -= new RoutedEventHandler(FrameworkElementGotFocus);
				if ((bool)((DependencyPropertyChangedEventArgs)(ref args)).NewValue)
				{
					val.GotFocus += new RoutedEventHandler(FrameworkElementGotFocus);
				}
			}
		}

		private static void FrameworkElementGotFocus(object sender, RoutedEventArgs e)
		{
			Focus((UIElement)((sender is UIElement) ? sender : null));
		}

		[AttachedPropertyBrowsableForType(typeof(UIElement))]
		public static bool GetAlwaysShowFocusVisual(UIElement element)
		{
			return (bool)((DependencyObject)element).GetValue(AlwaysShowFocusVisualProperty);
		}

		[AttachedPropertyBrowsableForType(typeof(UIElement))]
		public static void SetAlwaysShowFocusVisual(UIElement element, bool value)
		{
			((DependencyObject)element).SetValue(AlwaysShowFocusVisualProperty, (object)value);
		}
	}
	public abstract class PackIconBase : Control
	{
		internal abstract void UpdateData();
	}
	public abstract class PackIconBase<TKind> : PackIconBase
	{
		private static Lazy<IDictionary<TKind, string>> _dataIndex;

		public static readonly DependencyProperty KindProperty = DependencyProperty.Register("Kind", typeof(TKind), typeof(PackIconBase<TKind>), new PropertyMetadata((object)default(TKind), new PropertyChangedCallback(OnKindChanged)));

		private static readonly DependencyPropertyKey DataPropertyKey = DependencyProperty.RegisterReadOnly("Data", typeof(string), typeof(PackIconBase<TKind>), new PropertyMetadata((object)""));

		public static readonly DependencyProperty DataProperty = DataPropertyKey.DependencyProperty;

		public TKind Kind
		{
			get
			{
				return (TKind)((DependencyObject)this).GetValue(KindProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(KindProperty, (object)value);
			}
		}

		[TypeConverter(typeof(GeometryConverter))]
		public string Data
		{
			get
			{
				return (string)((DependencyObject)this).GetValue(DataProperty);
			}
			private set
			{
				((DependencyObject)this).SetValue(DataPropertyKey, (object)value);
			}
		}

		protected PackIconBase(Func<IDictionary<TKind, string>> dataIndexFactory)
		{
			if (dataIndexFactory == null)
			{
				throw new ArgumentNullException("dataIndexFactory");
			}
			if (_dataIndex == null)
			{
				_dataIndex = new Lazy<IDictionary<TKind, string>>(dataIndexFactory);
			}
		}

		private static void OnKindChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
		{
			((PackIconBase<TKind>)(object)dependencyObject).UpdateData();
		}

		public override void OnApplyTemplate()
		{
			((FrameworkElement)this).OnApplyTemplate();
			UpdateData();
		}

		internal override void UpdateData()
		{
			string value = null;
			_dataIndex.Value?.TryGetValue(Kind, out value);
			Data = value;
		}
	}
	public class PopupEx : Popup
	{
		[Flags]
		internal enum SWP
		{
			ASYNCWINDOWPOS = 0x4000,
			DEFERERASE = 0x2000,
			DRAWFRAME = 0x20,
			FRAMECHANGED = 0x20,
			HIDEWINDOW = 0x80,
			NOACTIVATE = 0x10,
			NOCOPYBITS = 0x100,
			NOMOVE = 2,
			NOOWNERZORDER = 0x200,
			NOREDRAW = 8,
			NOREPOSITION = 0x200,
			NOSENDCHANGING = 0x400,
			NOSIZE = 1,
			NOZORDER = 4,
			SHOWWINDOW = 0x40,
			TOPMOST = 0x61B
		}

		internal struct POINT
		{
			public int x;

			public int y;
		}

		internal struct SIZE
		{
			public int cx;

			public int cy;
		}

		internal struct RECT
		{
			private int _left;

			private int _top;

			private int _right;

			private int _bottom;

			public int Left
			{
				get
				{
					return _left;
				}
				set
				{
					_left = value;
				}
			}

			public int Right
			{
				get
				{
					return _right;
				}
				set
				{
					_right = value;
				}
			}

			public int Top
			{
				get
				{
					return _top;
				}
				set
				{
					_top = value;
				}
			}

			public int Bottom
			{
				get
				{
					return _bottom;
				}
				set
				{
					_bottom = value;
				}
			}

			public int Width => _right - _left;

			public int Height => _bottom - _top;

			public POINT Position
			{
				get
				{
					POINT result = default(POINT);
					result.x = _left;
					result.y = _top;
					return result;
				}
			}

			public SIZE Size
			{
				get
				{
					SIZE result = default(SIZE);
					result.cx = Width;
					result.cy = Height;
					return result;
				}
			}

			public void Offset(int dx, int dy)
			{
				_left += dx;
				_top += dy;
				_right += dx;
				_bottom += dy;
			}

			public static RECT Union(RECT rect1, RECT rect2)
			{
				RECT result = default(RECT);
				result.Left = Math.Min(rect1.Left, rect2.Left);
				result.Top = Math.Min(rect1.Top, rect2.Top);
				result.Right = Math.Max(rect1.Right, rect2.Right);
				result.Bottom = Math.Max(rect1.Bottom, rect2.Bottom);
				return result;
			}

			public override bool Equals(object obj)
			{
				try
				{
					RECT rECT = (RECT)obj;
					return rECT._bottom == _bottom && rECT._left == _left && rECT._right == _right && rECT._top == _top;
				}
				catch (InvalidCastException)
				{
					return false;
				}
			}

			public override int GetHashCode()
			{
				return ((_left << 16) | LOWORD(_right)) ^ ((_top << 16) | LOWORD(_bottom));
			}
		}

		public static readonly DependencyProperty CloseOnMouseLeftButtonDownProperty = DependencyProperty.Register("CloseOnMouseLeftButtonDown", typeof(bool), typeof(PopupEx), new PropertyMetadata((object)false));

		public static readonly DependencyProperty AllowTopMostProperty = DependencyProperty.Register("AllowTopMost", typeof(bool), typeof(PopupEx), new PropertyMetadata((object)true));

		private Window hostWindow;

		private bool? appliedTopMost;

		private static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);

		private static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);

		private static readonly IntPtr HWND_TOP = new IntPtr(0);

		private static readonly IntPtr HWND_BOTTOM = new IntPtr(1);

		public bool CloseOnMouseLeftButtonDown
		{
			get
			{
				return (bool)((DependencyObject)this).GetValue(CloseOnMouseLeftButtonDownProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(CloseOnMouseLeftButtonDownProperty, (object)value);
			}
		}

		public bool AllowTopMost
		{
			get
			{
				return (bool)((DependencyObject)this).GetValue(AllowTopMostProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(AllowTopMostProperty, (object)value);
			}
		}

		public PopupEx()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			((FrameworkElement)this).Loaded += new RoutedEventHandler(PopupEx_Loaded);
			((Popup)this).Opened += PopupEx_Opened;
		}

		public void RefreshPosition()
		{
			double horizontalOffset = ((Popup)this).HorizontalOffset;
			((DependencyObject)this).SetCurrentValue(Popup.HorizontalOffsetProperty, (object)(horizontalOffset + 1.0));
			((DependencyObject)this).SetCurrentValue(Popup.HorizontalOffsetProperty, (object)horizontalOffset);
		}

		private void PopupEx_Loaded(object sender, RoutedEventArgs e)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			UIElement placementTarget = ((Popup)this).PlacementTarget;
			FrameworkElement val = (FrameworkElement)(object)((placementTarget is FrameworkElement) ? placementTarget : null);
			if (val != null)
			{
				hostWindow = Window.GetWindow((DependencyObject)(object)val);
				if (hostWindow != null)
				{
					hostWindow.LocationChanged -= hostWindow_SizeOrLocationChanged;
					hostWindow.LocationChanged += hostWindow_SizeOrLocationChanged;
					((FrameworkElement)hostWindow).SizeChanged -= new SizeChangedEventHandler(hostWindow_SizeOrLocationChanged);
					((FrameworkElement)hostWindow).SizeChanged += new SizeChangedEventHandler(hostWindow_SizeOrLocationChanged);
					val.SizeChanged -= new SizeChangedEventHandler(hostWindow_SizeOrLocationChanged);
					val.SizeChanged += new SizeChangedEventHandler(hostWindow_SizeOrLocationChanged);
					hostWindow.StateChanged -= hostWindow_StateChanged;
					hostWindow.StateChanged += hostWindow_StateChanged;
					hostWindow.Activated -= hostWindow_Activated;
					hostWindow.Activated += hostWindow_Activated;
					hostWindow.Deactivated -= hostWindow_Deactivated;
					hostWindow.Deactivated += hostWindow_Deactivated;
					((FrameworkElement)this).Unloaded -= new RoutedEventHandler(PopupEx_Unloaded);
					((FrameworkElement)this).Unloaded += new RoutedEventHandler(PopupEx_Unloaded);
				}
			}
		}

		private void PopupEx_Opened(object sender, EventArgs e)
		{
			Window obj = hostWindow;
			SetTopmostState(obj == null || obj.IsActive);
		}

		private void hostWindow_Activated(object sender, EventArgs e)
		{
			SetTopmostState(isTop: true);
		}

		private void hostWindow_Deactivated(object sender, EventArgs e)
		{
			SetTopmostState(isTop: false);
		}

		private void PopupEx_Unloaded(object sender, RoutedEventArgs e)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			UIElement placementTarget = ((Popup)this).PlacementTarget;
			FrameworkElement val = (FrameworkElement)(object)((placementTarget is FrameworkElement) ? placementTarget : null);
			if (val != null)
			{
				val.SizeChanged -= new SizeChangedEventHandler(hostWindow_SizeOrLocationChanged);
			}
			if (hostWindow != null)
			{
				hostWindow.LocationChanged -= hostWindow_SizeOrLocationChanged;
				((FrameworkElement)hostWindow).SizeChanged -= new SizeChangedEventHandler(hostWindow_SizeOrLocationChanged);
				hostWindow.StateChanged -= hostWindow_StateChanged;
				hostWindow.Activated -= hostWindow_Activated;
				hostWindow.Deactivated -= hostWindow_Deactivated;
			}
			((FrameworkElement)this).Unloaded -= new RoutedEventHandler(PopupEx_Unloaded);
			((Popup)this).Opened -= PopupEx_Opened;
			hostWindow = null;
		}

		private void hostWindow_StateChanged(object sender, EventArgs e)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			if (hostWindow != null && (int)hostWindow.WindowState != 1)
			{
				UIElement placementTarget = ((Popup)this).PlacementTarget;
				FrameworkElement val = (FrameworkElement)(object)((placementTarget is FrameworkElement) ? placementTarget : null);
				AdornedElementPlaceholder val2 = (AdornedElementPlaceholder)((val != null) ? /*isinst with value type is only supported in some contexts*/: null);
				UIElement val3 = ((val2 != null) ? val2.AdornedElement : null);
				if (val3 != null)
				{
					((DependencyObject)this).SetCurrentValue(Popup.PopupAnimationProperty, (object)(PopupAnimation)0);
					((DependencyObject)this).SetCurrentValue(Popup.IsOpenProperty, (object)false);
					object value = ((DependencyObject)val3).GetValue(Validation.ErrorTemplateProperty);
					((DependencyObject)val3).SetCurrentValue(Validation.ErrorTemplateProperty, (object)null);
					((DependencyObject)val3).SetCurrentValue(Validation.ErrorTemplateProperty, value);
				}
			}
		}

		private void hostWindow_SizeOrLocationChanged(object sender, EventArgs e)
		{
			RefreshPosition();
		}

		private void SetTopmostState(bool isTop)
		{
			isTop &= AllowTopMost;
			if ((appliedTopMost.HasValue && appliedTopMost == isTop) || ((Popup)this).Child == null)
			{
				return;
			}
			PresentationSource obj = PresentationSource.FromVisual((Visual)(object)((Popup)this).Child);
			HwndSource val = (HwndSource)(object)((obj is HwndSource) ? obj : null);
			if (val == null)
			{
				return;
			}
			IntPtr handle = val.Handle;
			if (GetWindowRect(handle, out var lpRect))
			{
				int left = lpRect.Left;
				int top = lpRect.Top;
				int width = lpRect.Width;
				int height = lpRect.Height;
				if (isTop)
				{
					SetWindowPos(handle, HWND_TOPMOST, left, top, width, height, SWP.TOPMOST);
				}
				else
				{
					SetWindowPos(handle, HWND_BOTTOM, left, top, width, height, SWP.TOPMOST);
					SetWindowPos(handle, HWND_TOP, left, top, width, height, SWP.TOPMOST);
					SetWindowPos(handle, HWND_NOTOPMOST, left, top, width, height, SWP.TOPMOST);
				}
				appliedTopMost = isTop;
			}
		}

		protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
		{
			if (CloseOnMouseLeftButtonDown)
			{
				((DependencyObject)this).SetCurrentValue(Popup.IsOpenProperty, (object)false);
			}
		}

		internal static int LOWORD(int i)
		{
			return (short)(i & 0xFFFF);
		}

		[DllImport("user32.dll", SetLastError = true)]
		[SecurityCritical]
		[return: MarshalAs(UnmanagedType.Bool)]
		private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);

		[DllImport("user32.dll", EntryPoint = "SetWindowPos", SetLastError = true)]
		[SecurityCritical]
		[return: MarshalAs(UnmanagedType.Bool)]
		private static extern bool _SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SWP uFlags);

		[SecurityCritical]
		private static bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SWP uFlags)
		{
			if (!_SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, uFlags))
			{
				return false;
			}
			return true;
		}
	}
	public sealed class PropertyChangeNotifier : DependencyObject, IDisposable
	{
		private readonly WeakReference propertySource;

		public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(PropertyChangeNotifier), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, new PropertyChangedCallback(OnValueChanged)));

		public DependencyObject PropertySource
		{
			get
			{
				try
				{
					return (DependencyObject)(propertySource.IsAlive ? /*isinst with value type is only supported in some contexts*/: null);
				}
				catch
				{
					return null;
				}
			}
		}

		[Description("Gets or sets the value of the watched property.")]
		[Category("Behavior")]
		[Bindable(true)]
		public object Value
		{
			get
			{
				return ((DependencyObject)this).GetValue(ValueProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(ValueProperty, value);
			}
		}

		public bool RaiseValueChanged { get; set; } = true;


		public event EventHandler ValueChanged;

		public PropertyChangeNotifier(DependencyObject propertySource, string path)
			: this(propertySource, new PropertyPath(path, Array.Empty<object>()))
		{
		}//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown


		public PropertyChangeNotifier(DependencyObject propertySource, DependencyProperty property)
			: this(propertySource, new PropertyPath((object)property))
		{
		}//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Expected O, but got Unknown


		public PropertyChangeNotifier(DependencyObject propertySource, PropertyPath property)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			if (propertySource == null)
			{
				throw new ArgumentNullException("propertySource");
			}
			if (property == null)
			{
				throw new ArgumentNullException("property");
			}
			this.propertySource = new WeakReference(propertySource);
			Binding val = new Binding
			{
				Path = property,
				Mode = (BindingMode)1,
				Source = propertySource
			};
			BindingOperations.SetBinding((DependencyObject)(object)this, ValueProperty, (BindingBase)(object)val);
		}

		private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			PropertyChangeNotifier propertyChangeNotifier = (PropertyChangeNotifier)(object)d;
			if (propertyChangeNotifier.RaiseValueChanged)
			{
				propertyChangeNotifier.ValueChanged?.Invoke(propertyChangeNotifier.PropertySource, EventArgs.Empty);
			}
		}

		public void Dispose()
		{
			BindingOperations.ClearBinding((DependencyObject)(object)this, ValueProperty);
		}
	}
	public static class ToolTipAssist
	{
		public static readonly DependencyProperty AutoMoveProperty = DependencyProperty.RegisterAttached("AutoMove", typeof(bool), typeof(ToolTipAssist), (PropertyMetadata)new FrameworkPropertyMetadata((object)false, new PropertyChangedCallback(OnAutoMoveChanged)));

		public static readonly DependencyProperty AutoMoveHorizontalOffsetProperty = DependencyProperty.RegisterAttached("AutoMoveHorizontalOffset", typeof(double), typeof(ToolTipAssist), (PropertyMetadata)new FrameworkPropertyMetadata((object)16.0));

		public static readonly DependencyProperty AutoMoveVerticalOffsetProperty = DependencyProperty.RegisterAttached("AutoMoveVerticalOffset", typeof(double), typeof(ToolTipAssist), (PropertyMetadata)new FrameworkPropertyMetadata((object)16.0));

		[AttachedPropertyBrowsableForType(typeof(ToolTip))]
		public static bool GetAutoMove(ToolTip element)
		{
			return (bool)((DependencyObject)element).GetValue(AutoMoveProperty);
		}

		[AttachedPropertyBrowsableForType(typeof(ToolTip))]
		public static void SetAutoMove(ToolTip element, bool value)
		{
			((DependencyObject)element).SetValue(AutoMoveProperty, (object)value);
		}

		[AttachedPropertyBrowsableForType(typeof(ToolTip))]
		public static double GetAutoMoveHorizontalOffset(ToolTip element)
		{
			return (double)((DependencyObject)element).GetValue(AutoMoveHorizontalOffsetProperty);
		}

		[AttachedPropertyBrowsableForType(typeof(ToolTip))]
		public static void SetAutoMoveHorizontalOffset(ToolTip element, double value)
		{
			((DependencyObject)element).SetValue(AutoMoveHorizontalOffsetProperty, (object)value);
		}

		[AttachedPropertyBrowsableForType(typeof(ToolTip))]
		public static double GetAutoMoveVerticalOffset(ToolTip element)
		{
			return (double)((DependencyObject)element).GetValue(AutoMoveVerticalOffsetProperty);
		}

		[AttachedPropertyBrowsableForType(typeof(ToolTip))]
		public static void SetAutoMoveVerticalOffset(ToolTip element, double value)
		{
			((DependencyObject)element).SetValue(AutoMoveVerticalOffsetProperty, (object)value);
		}

		private static void OnAutoMoveChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			ToolTip val = (ToolTip)dependencyObject;
			if (((DependencyPropertyChangedEventArgs)(ref eventArgs)).OldValue != ((DependencyPropertyChangedEventArgs)(ref eventArgs)).NewValue && ((DependencyPropertyChangedEventArgs)(ref eventArgs)).NewValue != null)
			{
				if ((bool)((DependencyPropertyChangedEventArgs)(ref eventArgs)).NewValue)
				{
					val.Opened += new RoutedEventHandler(ToolTip_Opened);
					val.Closed += new RoutedEventHandler(ToolTip_Closed);
				}
				else
				{
					val.Opened -= new RoutedEventHandler(ToolTip_Opened);
					val.Closed -= new RoutedEventHandler(ToolTip_Closed);
				}
			}
		}

		private static void ToolTip_Opened(object sender, RoutedEventArgs e)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			ToolTip val = (ToolTip)sender;
			UIElement placementTarget = val.PlacementTarget;
			FrameworkElement val2 = (FrameworkElement)(object)((placementTarget is FrameworkElement) ? placementTarget : null);
			if (val2 != null)
			{
				MoveToolTip((IInputElement)(object)val2, val);
				((UIElement)val2).MouseMove += new MouseEventHandler(ToolTipTargetPreviewMouseMove);
			}
		}

		private static void ToolTip_Closed(object sender, RoutedEventArgs e)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			ToolTip val = (ToolTip)sender;
			UIElement placementTarget = val.PlacementTarget;
			FrameworkElement val2 = (FrameworkElement)(object)((placementTarget is FrameworkElement) ? placementTarget : null);
			if (val2 != null)
			{
				((UIElement)val2).MouseMove -= new MouseEventHandler(ToolTipTargetPreviewMouseMove);
			}
		}

		private static void ToolTipTargetPreviewMouseMove(object sender, MouseEventArgs e)
		{
			FrameworkElement val = (FrameworkElement)((sender is FrameworkElement) ? sender : null);
			object obj = ((val != null) ? val.ToolTip : null);
			ToolTip toolTip = (ToolTip)((obj is ToolTip) ? obj : null);
			MoveToolTip((IInputElement)((sender is IInputElement) ? sender : null), toolTip);
		}

		private static void MoveToolTip(IInputElement target, ToolTip toolTip)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			if (toolTip == null || target == null || toolTip.PlacementTarget == null)
			{
				return;
			}
			((DependencyObject)toolTip).SetCurrentValue(ToolTip.PlacementProperty, (object)(PlacementMode)1);
			double autoMoveHorizontalOffset = GetAutoMoveHorizontalOffset(toolTip);
			double autoMoveVerticalOffset = GetAutoMoveVerticalOffset(toolTip);
			DpiScale dpi = ((Visual)(object)toolTip).GetDpi();
			double num = DpiHelper.TransformToDeviceX((Visual)(object)toolTip.PlacementTarget, autoMoveHorizontalOffset, ((DpiScale)(ref dpi)).DpiScaleX);
			double num2 = DpiHelper.TransformToDeviceY((Visual)(object)toolTip.PlacementTarget, autoMoveVerticalOffset, ((DpiScale)(ref dpi)).DpiScaleY);
			Point position = Mouse.GetPosition((IInputElement)(object)toolTip.PlacementTarget);
			double num3 = ((Point)(ref position)).X + num;
			double num4 = ((Point)(ref position)).Y + num2;
			Point val = ((Visual)toolTip.PlacementTarget).PointToScreen(new Point(0.0, 0.0));
			if (!MonitorHelper.TryGetMonitorInfoFromPoint(out var monitorInfo))
			{
				return;
			}
			int num5 = Math.Abs(monitorInfo.rcWork.Width);
			int num6 = Math.Abs(monitorInfo.rcWork.Height);
			if (num5 == 0 || num6 == 0)
			{
				Trace.TraceError("Got wrong monitor info values ({0})", monitorInfo.rcWork);
				return;
			}
			((Point)(ref val)).X = (double)(-monitorInfo.rcWork.Left) + ((Point)(ref val)).X;
			((Point)(ref val)).Y = (double)(-monitorInfo.rcWork.Top) + ((Point)(ref val)).Y;
			int num7 = (int)((Point)(ref val)).X % num5;
			int num8 = (int)((Point)(ref val)).Y % num6;
			UIElement placementTarget = toolTip.PlacementTarget;
			Size renderSize = ((UIElement)toolTip).RenderSize;
			double num9 = DpiHelper.TransformToDeviceX((Visual)(object)placementTarget, ((Size)(ref renderSize)).Width, ((DpiScale)(ref dpi)).DpiScaleX);
			double num10 = (double)num7 + num3 + num9;
			if (num10 > (double)num5)
			{
				double x = ((Point)(ref position)).X;
				renderSize = ((UIElement)toolTip).RenderSize;
				num3 = x - ((Size)(ref renderSize)).Width - 0.5 * num;
			}
			UIElement placementTarget2 = toolTip.PlacementTarget;
			renderSize = ((UIElement)toolTip).RenderSize;
			double num11 = DpiHelper.TransformToDeviceY((Visual)(object)placementTarget2, ((Size)(ref renderSize)).Height, ((DpiScale)(ref dpi)).DpiScaleY);
			double num12 = (double)num8 + num4 + num11;
			if (num12 > (double)num6)
			{
				double y = ((Point)(ref position)).Y;
				renderSize = ((UIElement)toolTip).RenderSize;
				num4 = y - ((Size)(ref renderSize)).Height - 0.5 * num2;
			}
			toolTip.HorizontalOffset = num3;
			toolTip.VerticalOffset = num4;
		}
	}
}
namespace ControlzEx.Theming
{
	public struct HSLColor
	{
		public double A { get; set; }

		public double H { get; set; }

		public double S { get; set; }

		public double L { get; set; }

		public HSLColor(Color color)
		{
			A = 0.0;
			H = 0.0;
			L = 0.0;
			S = 0.0;
			byte r = ((Color)(ref color)).R;
			byte g = ((Color)(ref color)).G;
			byte b = ((Color)(ref color)).B;
			byte a = ((Color)(ref color)).A;
			byte b2 = Math.Min(r, Math.Min(g, b));
			byte b3 = Math.Max(r, Math.Max(g, b));
			int num = b3 - b2;
			if (num == 0)
			{
				H = 0.0;
			}
			else if (r == b3)
			{
				H = 60.0 * ((double)(g - b) / (double)num % 6.0);
			}
			else if (g == b3)
			{
				H = 60.0 * ((double)(b - r) / (double)num + 2.0);
			}
			else if (b == b3)
			{
				H = 60.0 * ((double)(r - g) / (double)num + 4.0);
			}
			if (H < 0.0)
			{
				H += 360.0;
			}
			L = 0.5 * (double)(b3 + b2) / 255.0;
			if (DoubleUtilities.AreClose(L, 0.0) || DoubleUtilities.AreClose(L, 1.0))
			{
				S = 0.0;
			}
			else
			{
				S = (double)num / (255.0 * (1.0 - Math.Abs(2.0 * L - 1.0)));
			}
			A = (double)(int)a / 255.0;
		}

		public HSLColor(double a, double h, double s, double l)
		{
			A = a;
			H = h;
			S = s;
			L = l;
		}

		public Color ToColor()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			byte colorComponent = GetColorComponent(0);
			byte colorComponent2 = GetColorComponent(8);
			byte colorComponent3 = GetColorComponent(4);
			return Color.FromArgb((byte)Math.Round(A * 255.0), colorComponent, colorComponent2, colorComponent3);
		}

		public Color GetTintedColor(double tint)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			double num = L * 255.0;
			num = ((!(tint < 0.0)) ? (num * (1.0 - tint) + (255.0 - 255.0 * (1.0 - tint))) : (num * (1.0 + tint)));
			return new HSLColor(A, H, S, num / 255.0).ToColor();
		}

		public static Color GetTintedColor(Color color, double tint)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return new HSLColor(color).GetTintedColor(tint);
		}

		private byte GetColorComponent(int n)
		{
			double num = S * Math.Min(L, 1.0 - L);
			double num2 = ((double)n + H / 30.0) % 12.0;
			return (byte)Math.Round(255.0 * (L - num * Math.Max(-1.0, Math.Min(num2 - 3.0, Math.Min(9.0 - num2, 1.0)))));
		}
	}
	public class LibraryTheme
	{
		public const string LibraryThemeInstanceKey = "Theme.LibraryThemeInstance";

		public const string LibraryThemeAlternativeColorSchemeKey = "Theme.AlternativeColorScheme";

		public const string RuntimeThemeColorValuesKey = "Theme.RuntimeThemeColorValues";

		public bool IsRuntimeGenerated { get; }

		public bool IsHighContrast { get; }

		public string Name { get; }

		public string? Origin { get; }

		public string DisplayName { get; }

		public string BaseColorScheme { get; }

		public string ColorScheme { get; }

		public Color PrimaryAccentColor { get; set; }

		public Brush ShowcaseBrush { get; }

		public ResourceDictionary Resources { get; } = new ResourceDictionary();


		public string AlternativeColorScheme { get; set; }

		public Theme? ParentTheme { get; internal set; }

		public LibraryThemeProvider? LibraryThemeProvider { get; }

		public LibraryTheme(Uri resourceAddress, LibraryThemeProvider? libraryThemeProvider)
			: this(CreateResourceDictionary(resourceAddress), libraryThemeProvider)
		{
		}

		public LibraryTheme(ResourceDictionary resourceDictionary, LibraryThemeProvider? libraryThemeProvider)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			if (resourceDictionary == null)
			{
				throw new ArgumentNullException("resourceDictionary");
			}
			LibraryThemeProvider = libraryThemeProvider;
			IsRuntimeGenerated = (bool)(resourceDictionary[(object)"Theme.IsRuntimeGenerated"] ?? ((object)false));
			IsHighContrast = (bool)(resourceDictionary[(object)"Theme.IsHighContrast"] ?? ((object)false));
			Name = (string)resourceDictionary[(object)"Theme.Name"];
			Origin = (string)resourceDictionary[(object)"Theme.Origin"];
			DisplayName = (string)resourceDictionary[(object)"Theme.DisplayName"];
			BaseColorScheme = (string)resourceDictionary[(object)"Theme.BaseColorScheme"];
			ColorScheme = (string)resourceDictionary[(object)"Theme.ColorScheme"];
			AlternativeColorScheme = (string)resourceDictionary[(object)"Theme.AlternativeColorScheme"];
			PrimaryAccentColor = (resourceDictionary[(object)"Theme.PrimaryAccentColor"] as Color?) ?? throw new ArgumentException("Resource key \"Theme.PrimaryAccentColor\" is missing, is null or is not a color.");
			? val = (Brush)resourceDictionary[(object)"Theme.ShowcaseBrush"];
			if ((int)val == 0)
			{
				val = new SolidColorBrush(PrimaryAccentColor);
			}
			ShowcaseBrush = (Brush)val;
			AddResource(resourceDictionary);
			Resources[(object)"Theme.LibraryThemeInstance"] = this;
		}

		public virtual bool Matches(LibraryTheme libraryTheme)
		{
			if (BaseColorScheme == libraryTheme.BaseColorScheme && ColorScheme == libraryTheme.ColorScheme)
			{
				return IsHighContrast == libraryTheme.IsHighContrast;
			}
			return false;
		}

		public virtual bool MatchesSecondTry(LibraryTheme libraryTheme)
		{
			if (BaseColorScheme == libraryTheme.BaseColorScheme && AlternativeColorScheme == libraryTheme.ColorScheme)
			{
				return IsHighContrast == libraryTheme.IsHighContrast;
			}
			return false;
		}

		public virtual bool MatchesThirdTry(LibraryTheme libraryTheme)
		{
			if (BaseColorScheme == libraryTheme.BaseColorScheme && ((object)ShowcaseBrush).ToString() == ((object)libraryTheme.ShowcaseBrush).ToString())
			{
				return IsHighContrast == libraryTheme.IsHighContrast;
			}
			return false;
		}

		public LibraryTheme AddResource(ResourceDictionary resourceDictionary)
		{
			if (resourceDictionary == null)
			{
				throw new ArgumentNullException("resourceDictionary");
			}
			Resources.MergedDictionaries.Add(resourceDictionary);
			return this;
		}

		public override string ToString()
		{
			return $"DisplayName={DisplayName}, Name={Name}, Origin={Origin}, IsHighContrast={IsHighContrast}";
		}

		public static string? GetThemeName(ResourceDictionary resourceDictionary)
		{
			return Theme.GetThemeName(resourceDictionary);
		}

		public static bool IsThemeDictionary(ResourceDictionary resourceDictionary)
		{
			if (!Theme.IsThemeDictionary(resourceDictionary))
			{
				return ResourceDictionaryHelper.ContainsKey(resourceDictionary, "Theme.LibraryThemeInstance");
			}
			return true;
		}

		public static bool IsRuntimeGeneratedThemeDictionary(ResourceDictionary resourceDictionary)
		{
			if (!Theme.IsRuntimeGeneratedThemeDictionary(resourceDictionary))
			{
				if (ResourceDictionaryHelper.ContainsKey(resourceDictionary, "Theme.LibraryThemeInstance"))
				{
					return ((LibraryTheme)resourceDictionary[(object)"Theme.LibraryThemeInstance"]).IsRuntimeGenerated;
				}
				return false;
			}
			return true;
		}

		private static ResourceDictionary CreateResourceDictionary(Uri resourceAddress)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			if (resourceAddress == null)
			{
				throw new ArgumentNullException("resourceAddress");
			}
			return new ResourceDictionary
			{
				Source = resourceAddress
			};
		}
	}
	public abstract class LibraryThemeProvider : DependencyObject
	{
		private readonly Assembly assembly;

		private readonly string assemblyName;

		private readonly string[] resourceNames;

		public string GeneratorParametersResourceName { get; protected set; } = "GeneratorParameters.json";


		public string ThemeTemplateResourceName { get; protected set; } = "Theme.Template.xaml";


		protected LibraryThemeProvider(bool registerAtThemeManager)
		{
			assembly = ((object)this).GetType().Assembly;
			assemblyName = assembly.GetName().Name;
			resourceNames = assembly.GetManifestResourceNames();
			if (registerAtThemeManager)
			{
				ThemeManager.Current.RegisterLibraryThemeProvider(this);
			}
		}

		public abstract void FillColorSchemeValues(Dictionary<string, string> values, RuntimeThemeColorValues colorValues);

		public virtual string? GetThemeGeneratorParametersContent()
		{
			string[] array = resourceNames;
			foreach (string text in array)
			{
				if (!ResourceNamesMatch(text, GeneratorParametersResourceName))
				{
					continue;
				}
				using Stream stream = assembly.GetManifestResourceStream(text);
				if (stream == null)
				{
					continue;
				}
				using StreamReader streamReader = new StreamReader(stream);
				return streamReader.ReadToEnd();
			}
			return null;
		}

		public virtual string? GetThemeTemplateContent()
		{
			string[] array = resourceNames;
			foreach (string text in array)
			{
				if (!ResourceNamesMatch(text, ThemeTemplateResourceName))
				{
					continue;
				}
				using Stream stream = assembly.GetManifestResourceStream(text);
				if (stream == null)
				{
					continue;
				}
				using StreamReader streamReader = new StreamReader(stream);
				return streamReader.ReadToEnd();
			}
			return null;
		}

		public virtual LibraryTheme? GetLibraryTheme(DictionaryEntry dictionaryEntry)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			if (!IsPotentialThemeResourceDictionary(dictionaryEntry))
			{
				return null;
			}
			string text = dictionaryEntry.Key as string;
			if (string.IsNullOrEmpty(text))
			{
				return null;
			}
			ResourceDictionary val = new ResourceDictionary
			{
				Source = new Uri("pack://application:,,,/" + assemblyName + ";component/" + text.Replace(".baml", ".xaml"))
			};
			if (val.MergedDictionaries.Count == 0 && ThemeManager.Current.IsThemeDictionary(val))
			{
				return new LibraryTheme(val, this);
			}
			return null;
		}

		public virtual IEnumerable<LibraryTheme> GetLibraryThemes()
		{
			string[] array = resourceNames;
			foreach (string text in array)
			{
				if (!text.EndsWith(".g.resources", StringComparison.OrdinalIgnoreCase))
				{
					continue;
				}
				ManifestResourceInfo manifestResourceInfo = assembly.GetManifestResourceInfo(text);
				if (manifestResourceInfo == null || manifestResourceInfo.ResourceLocation == ResourceLocation.ContainedInAnotherAssembly)
				{
					continue;
				}
				Stream manifestResourceStream = assembly.GetManifestResourceStream(text);
				if (manifestResourceStream == null)
				{
					continue;
				}
				using ResourceReader reader = new ResourceReader(manifestResourceStream);
				foreach (DictionaryEntry item in reader.OfType<DictionaryEntry>())
				{
					LibraryTheme libraryTheme = GetLibraryTheme(item);
					if (libraryTheme != null)
					{
						yield return libraryTheme;
					}
				}
			}
		}

		public virtual LibraryTheme? ProvideMissingLibraryTheme(Theme themeToProvideNewLibraryThemeFor)
		{
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			List<LibraryTheme> list = GetLibraryThemes().ToList();
			foreach (LibraryTheme libraryTheme in themeToProvideNewLibraryThemeFor.LibraryThemes)
			{
				foreach (LibraryTheme item in list)
				{
					if (item.Matches(libraryTheme) || libraryTheme.Matches(item))
					{
						return item;
					}
				}
			}
			foreach (LibraryTheme libraryTheme2 in themeToProvideNewLibraryThemeFor.LibraryThemes)
			{
				foreach (LibraryTheme item2 in list)
				{
					if (item2.MatchesSecondTry(libraryTheme2) || libraryTheme2.MatchesSecondTry(item2))
					{
						return item2;
					}
				}
			}
			foreach (LibraryTheme libraryTheme3 in themeToProvideNewLibraryThemeFor.LibraryThemes)
			{
				foreach (LibraryTheme item3 in list)
				{
					if (item3.MatchesThirdTry(libraryTheme3) || libraryTheme3.MatchesThirdTry(item3))
					{
						return item3;
					}
				}
			}
			return RuntimeThemeGenerator.Current.GenerateRuntimeLibraryTheme(themeToProvideNewLibraryThemeFor.BaseColorScheme, themeToProvideNewLibraryThemeFor.PrimaryAccentColor, themeToProvideNewLibraryThemeFor.IsHighContrast, this);
		}

		protected virtual bool IsPotentialThemeResourceDictionary(DictionaryEntry dictionaryEntry)
		{
			if (!(dictionaryEntry.Key is string text) || text.IndexOf("/themes/", StringComparison.OrdinalIgnoreCase) == -1 || !text.EndsWith(".baml", StringComparison.OrdinalIgnoreCase) || text.EndsWith("generic.baml", StringComparison.OrdinalIgnoreCase))
			{
				return false;
			}
			return true;
		}

		protected virtual bool ResourceNamesMatch(string resourceName, string value)
		{
			if (resourceName.Equals(value, StringComparison.OrdinalIgnoreCase) || (resourceName.StartsWith(assemblyName, StringComparison.OrdinalIgnoreCase) && resourceName.EndsWith(value, StringComparison.OrdinalIgnoreCase)))
			{
				return true;
			}
			return false;
		}

		public virtual string PrepareXamlContent(RuntimeThemeGenerator runtimeThemeGenerator, string xamlContent, RuntimeThemeColorValues runtimeThemeColorValues)
		{
			xamlContent = XamlThemeHelper.FixXamlReaderXmlNsIssue(xamlContent);
			return xamlContent;
		}

		public virtual void PrepareRuntimeThemeResourceDictionary(RuntimeThemeGenerator runtimeThemeGenerator, ResourceDictionary resourceDictionary, RuntimeThemeColorValues runtimeThemeColorValues)
		{
		}

		public LibraryTheme CreateRuntimeLibraryTheme(ResourceDictionary resourceDictionary, RuntimeThemeColorValues runtimeThemeColorValues)
		{
			return new LibraryTheme(resourceDictionary, this);
		}
	}
	public class RuntimeThemeColorValues
	{
		public RuntimeThemeOptions Options { get; }

		public Color AccentColor { get; set; }

		public Color AccentBaseColor { get; set; }

		public Color PrimaryAccentColor { get; set; }

		public Color AccentColor80 { get; set; }

		public Color AccentColor60 { get; set; }

		public Color AccentColor40 { get; set; }

		public Color AccentColor20 { get; set; }

		public Color HighlightColor { get; set; }

		public Color IdealForegroundColor { get; set; }

		public RuntimeThemeColorValues(RuntimeThemeOptions options)
		{
			Options = options;
		}
	}
	public class RuntimeThemeGenerator
	{
		public static RuntimeThemeGenerator Current { get; set; }

		public RuntimeThemeGeneratorOptions Options { get; } = new RuntimeThemeGeneratorOptions();


		static RuntimeThemeGenerator()
		{
			Current = new RuntimeThemeGenerator();
		}

		public Theme? GenerateRuntimeThemeFromWindowsSettings(string baseColor, bool isHighContrast, params LibraryThemeProvider[] libraryThemeProviders)
		{
			return GenerateRuntimeThemeFromWindowsSettings(baseColor, isHighContrast, libraryThemeProviders.ToList());
		}

		public virtual Theme? GenerateRuntimeThemeFromWindowsSettings(string baseColor, bool isHighContrast, IEnumerable<LibraryThemeProvider> libraryThemeProviders)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			Color? windowsAccentColor = WindowsThemeHelper.GetWindowsAccentColor();
			if (!windowsAccentColor.HasValue)
			{
				return null;
			}
			Color value = windowsAccentColor.Value;
			return GenerateRuntimeTheme(baseColor, value, isHighContrast, libraryThemeProviders);
		}

		public Theme? GenerateRuntimeTheme(string baseColor, Color accentColor)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return GenerateRuntimeTheme(baseColor, accentColor, isHighContrast: false, ThemeManager.Current.LibraryThemeProviders.ToList());
		}

		public virtual Theme? GenerateRuntimeTheme(string baseColor, Color accentColor, bool isHighContrast)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return GenerateRuntimeTheme(baseColor, accentColor, isHighContrast, ThemeManager.Current.LibraryThemeProviders.ToList());
		}

		public Theme? GenerateRuntimeTheme(string baseColor, Color accentColor, bool isHighContrast, params LibraryThemeProvider[] libraryThemeProviders)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return GenerateRuntimeTheme(baseColor, accentColor, isHighContrast, libraryThemeProviders.ToList());
		}

		public virtual Theme? GenerateRuntimeTheme(string baseColor, Color accentColor, bool isHighContrast, IEnumerable<LibraryThemeProvider> libraryThemeProviders)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Theme theme = null;
			foreach (LibraryThemeProvider libraryThemeProvider in libraryThemeProviders)
			{
				LibraryTheme libraryTheme = GenerateRuntimeLibraryTheme(baseColor, accentColor, isHighContrast, libraryThemeProvider);
				if (libraryTheme != null)
				{
					if (theme == null)
					{
						theme = new Theme(libraryTheme);
					}
					else
					{
						theme.AddLibraryTheme(libraryTheme);
					}
				}
			}
			return theme;
		}

		public virtual LibraryTheme? GenerateRuntimeLibraryTheme(string baseColor, Color accentColor, bool isHighContrast, LibraryThemeProvider libraryThemeProvider)
		{
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			string baseColor2 = baseColor;
			string themeGeneratorParametersContent = libraryThemeProvider.GetThemeGeneratorParametersContent();
			if (string.IsNullOrEmpty(themeGeneratorParametersContent))
			{
				return null;
			}
			string themeTemplateContent = libraryThemeProvider.GetThemeTemplateContent();
			if (string.IsNullOrEmpty(themeTemplateContent))
			{
				return null;
			}
			ThemeGenerator.ThemeGeneratorParameters parametersFromString = ThemeGenerator.Current.GetParametersFromString(themeGeneratorParametersContent);
			ThemeGenerator.ThemeGeneratorBaseColorScheme baseColorScheme = parametersFromString.BaseColorSchemes.First((ThemeGenerator.ThemeGeneratorBaseColorScheme x) => x.Name == baseColor2);
			ThemeGenerator.ThemeGeneratorColorScheme themeGeneratorColorScheme = new ThemeGenerator.ThemeGeneratorColorScheme
			{
				Name = ((object)(Color)(ref accentColor)).ToString()
			};
			string themeName = baseColor2 + ".Runtime_" + themeGeneratorColorScheme.Name;
			string text = "Runtime " + themeGeneratorColorScheme.Name + " (" + baseColor2 + ")";
			if (isHighContrast)
			{
				text += " HighContrast";
			}
			Dictionary<string, string> values = themeGeneratorColorScheme.Values;
			RuntimeThemeColorValues colors = GetColors(accentColor, Options.CreateRuntimeThemeOptions(isHighContrast, parametersFromString, baseColorScheme));
			return GenerateRuntimeLibraryTheme(libraryThemeProvider, values, colors, themeTemplateContent, themeName, text, baseColorScheme, themeGeneratorColorScheme, parametersFromString);
		}

		public virtual LibraryTheme GenerateRuntimeLibraryTheme(LibraryThemeProvider libraryThemeProvider, Dictionary<string, string> values, RuntimeThemeColorValues runtimeThemeColorValues, string themeTemplateContent, string themeName, string themeDisplayName, ThemeGenerator.ThemeGeneratorBaseColorScheme baseColorScheme, ThemeGenerator.ThemeGeneratorColorScheme colorScheme, ThemeGenerator.ThemeGeneratorParameters generatorParameters)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			Color val = runtimeThemeColorValues.PrimaryAccentColor;
			values.Add("ThemeGenerator.Colors.PrimaryAccentColor", ((object)(Color)(ref val)).ToString());
			val = runtimeThemeColorValues.AccentBaseColor;
			values.Add("ThemeGenerator.Colors.AccentBaseColor", ((object)(Color)(ref val)).ToString());
			val = runtimeThemeColorValues.AccentColor80;
			values.Add("ThemeGenerator.Colors.AccentColor80", ((object)(Color)(ref val)).ToString());
			val = runtimeThemeColorValues.AccentColor60;
			values.Add("ThemeGenerator.Colors.AccentColor60", ((object)(Color)(ref val)).ToString());
			val = runtimeThemeColorValues.AccentColor40;
			values.Add("ThemeGenerator.Colors.AccentColor40", ((object)(Color)(ref val)).ToString());
			val = runtimeThemeColorValues.AccentColor20;
			values.Add("ThemeGenerator.Colors.AccentColor20", ((object)(Color)(ref val)).ToString());
			val = runtimeThemeColorValues.HighlightColor;
			values.Add("ThemeGenerator.Colors.HighlightColor", ((object)(Color)(ref val)).ToString());
			val = runtimeThemeColorValues.IdealForegroundColor;
			values.Add("ThemeGenerator.Colors.IdealForegroundColor", ((object)(Color)(ref val)).ToString());
			libraryThemeProvider.FillColorSchemeValues(values, runtimeThemeColorValues);
			string xamlContent = ThemeGenerator.Current.GenerateColorSchemeFileContent(themeTemplateContent, themeName, themeDisplayName, baseColorScheme.Name, colorScheme.Name, colorScheme.Name, runtimeThemeColorValues.Options.IsHighContrast, colorScheme.Values, baseColorScheme.Values, generatorParameters.DefaultValues);
			string text = libraryThemeProvider.PrepareXamlContent(this, xamlContent, runtimeThemeColorValues);
			ResourceDictionary val2 = (ResourceDictionary)XamlReader.Parse(text);
			val2.Add((object)"Theme.IsRuntimeGenerated", (object)true);
			val2[(object)"Theme.IsHighContrast"] = runtimeThemeColorValues.Options.IsHighContrast;
			val2[(object)"Theme.RuntimeThemeColorValues"] = runtimeThemeColorValues;
			libraryThemeProvider.PrepareRuntimeThemeResourceDictionary(this, val2, runtimeThemeColorValues);
			return libraryThemeProvider.CreateRuntimeLibraryTheme(val2, runtimeThemeColorValues);
		}

		public virtual RuntimeThemeColorValues GetColors(Color accentColor, RuntimeThemeOptions options)
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			if (options.UseHSL)
			{
				Color color = Color.FromRgb(((Color)(ref accentColor)).R, ((Color)(ref accentColor)).G, ((Color)(ref accentColor)).B);
				return new RuntimeThemeColorValues(options)
				{
					AccentColor = accentColor,
					AccentBaseColor = accentColor,
					PrimaryAccentColor = accentColor,
					AccentColor80 = HSLColor.GetTintedColor(color, 0.2),
					AccentColor60 = HSLColor.GetTintedColor(color, 0.4),
					AccentColor40 = HSLColor.GetTintedColor(color, 0.6),
					AccentColor20 = HSLColor.GetTintedColor(color, 0.8),
					HighlightColor = GetHighlightColor(color),
					IdealForegroundColor = GetIdealTextColor(color)
				};
			}
			return new RuntimeThemeColorValues(options)
			{
				AccentColor = accentColor,
				AccentBaseColor = accentColor,
				PrimaryAccentColor = accentColor,
				AccentColor80 = Color.FromArgb((byte)204, ((Color)(ref accentColor)).R, ((Color)(ref accentColor)).G, ((Color)(ref accentColor)).B),
				AccentColor60 = Color.FromArgb((byte)153, ((Color)(ref accentColor)).R, ((Color)(ref accentColor)).G, ((Color)(ref accentColor)).B),
				AccentColor40 = Color.FromArgb((byte)102, ((Color)(ref accentColor)).R, ((Color)(ref accentColor)).G, ((Color)(ref accentColor)).B),
				AccentColor20 = Color.FromArgb((byte)51, ((Color)(ref accentColor)).R, ((Color)(ref accentColor)).G, ((Color)(ref accentColor)).B),
				HighlightColor = GetHighlightColor(accentColor),
				IdealForegroundColor = GetIdealTextColor(accentColor)
			};
		}

		public static Color GetIdealTextColor(Color color)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			int num = Convert.ToInt32((double)(int)((Color)(ref color)).R * 0.299 + (double)(int)((Color)(ref color)).G * 0.587 + (double)(int)((Color)(ref color)).B * 0.114);
			return (255 - num < 105) ? Colors.Black : Colors.White;
		}

		public static Color GetHighlightColor(Color color, int highlightFactor = 7)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			return Color.FromRgb((byte)((((Color)(ref color)).R + highlightFactor > 255) ? 255u : ((uint)(((Color)(ref color)).R + highlightFactor))), (byte)((((Color)(ref color)).G + highlightFactor > 255) ? 255u : ((uint)(((Color)(ref color)).G + highlightFactor))), (byte)((((Color)(ref color)).B + highlightFactor > 255) ? 255u : ((uint)(((Color)(ref color)).B + highlightFactor))));
		}
	}
	public class RuntimeThemeGeneratorOptions
	{
		public bool UseHSL { get; set; }

		public virtual RuntimeThemeOptions CreateRuntimeThemeOptions(bool isHighContrast, ThemeGenerator.ThemeGeneratorParameters? generatorParameters, ThemeGenerator.ThemeGeneratorBaseColorScheme? baseColorScheme)
		{
			return new RuntimeThemeOptions(UseHSL, isHighContrast, generatorParameters, baseColorScheme);
		}
	}
	public class RuntimeThemeOptions
	{
		public bool UseHSL { get; }

		public bool IsHighContrast { get; }

		public ThemeGenerator.ThemeGeneratorParameters? GeneratorParameters { get; }

		public ThemeGenerator.ThemeGeneratorBaseColorScheme? BaseColorScheme { get; }

		public RuntimeThemeOptions(bool useHSL, bool isHighContrast, ThemeGenerator.ThemeGeneratorParameters? generatorParameters, ThemeGenerator.ThemeGeneratorBaseColorScheme? baseColorScheme)
		{
			UseHSL = useHSL;
			IsHighContrast = isHighContrast;
			GeneratorParameters = generatorParameters;
			BaseColorScheme = baseColorScheme;
		}
	}
	public class Theme
	{
		public const string ThemeNameKey = "Theme.Name";

		public const string ThemeOriginKey = "Theme.Origin";

		public const string ThemeDisplayNameKey = "Theme.DisplayName";

		public const string ThemeBaseColorSchemeKey = "Theme.BaseColorScheme";

		public const string ThemeColorSchemeKey = "Theme.ColorScheme";

		public const string ThemePrimaryAccentColorKey = "Theme.PrimaryAccentColor";

		public const string ThemeShowcaseBrushKey = "Theme.ShowcaseBrush";

		public const string ThemeIsRuntimeGeneratedKey = "Theme.IsRuntimeGenerated";

		public const string ThemeIsHighContrastKey = "Theme.IsHighContrast";

		public const string ThemeInstanceKey = "Theme.ThemeInstance";

		public static readonly Dictionary<Uri, bool> ThemeDictionaryCache = new Dictionary<Uri, bool>();

		public bool IsRuntimeGenerated { get; }

		public bool IsHighContrast { get; }

		public string Name { get; }

		public string DisplayName { get; }

		public string BaseColorScheme { get; }

		public Color PrimaryAccentColor { get; set; }

		public string ColorScheme { get; }

		public Brush ShowcaseBrush { get; }

		public ResourceDictionary Resources { get; } = new ResourceDictionary();


		public ReadOnlyObservableCollection<LibraryTheme> LibraryThemes { get; }

		private ObservableCollection<LibraryTheme> LibraryThemesInternal { get; } = new ObservableCollection<LibraryTheme>();


		public Theme(LibraryTheme libraryTheme)
			: this(libraryTheme.Name, libraryTheme.DisplayName, libraryTheme.BaseColorScheme, libraryTheme.ColorScheme, libraryTheme.PrimaryAccentColor, libraryTheme.ShowcaseBrush, libraryTheme.IsRuntimeGenerated, libraryTheme.IsHighContrast)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (libraryTheme == null)
			{
				throw new ArgumentNullException("libraryTheme");
			}
			AddLibraryTheme(libraryTheme);
		}

		public Theme(string name, string displayName, string baseColorScheme, string colorScheme, Color primaryAccentColor, Brush showcaseBrush, bool isRuntimeGenerated, bool isHighContrast)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			IsRuntimeGenerated = isRuntimeGenerated;
			IsHighContrast = isHighContrast;
			Name = name;
			DisplayName = displayName;
			BaseColorScheme = baseColorScheme;
			ColorScheme = colorScheme;
			PrimaryAccentColor = primaryAccentColor;
			ShowcaseBrush = showcaseBrush;
			LibraryThemes = new ReadOnlyObservableCollection<LibraryTheme>(LibraryThemesInternal);
			Resources[(object)"Theme.ThemeInstance"] = this;
		}

		public Theme EnsureAllLibraryThemeProvidersProvided()
		{
			IEnumerable<LibraryThemeProvider> enumerable = ThemeManager.Current.LibraryThemeProviders.Except<LibraryThemeProvider>(LibraryThemes.Select((LibraryTheme x) => x.LibraryThemeProvider));
			foreach (LibraryThemeProvider item in enumerable)
			{
				LibraryTheme libraryTheme = item?.ProvideMissingLibraryTheme(this);
				if (libraryTheme != null)
				{
					AddLibraryTheme(libraryTheme);
				}
			}
			return this;
		}

		public IEnumerable<ResourceDictionary> GetAllResources()
		{
			EnsureAllLibraryThemeProvidersProvided();
			foreach (LibraryTheme libraryTheme in LibraryThemes)
			{
				foreach (ResourceDictionary mergedDictionary in libraryTheme.Resources.MergedDictionaries)
				{
					yield return mergedDictionary;
				}
			}
		}

		public Theme AddLibraryTheme(LibraryTheme libraryTheme)
		{
			if (libraryTheme == null)
			{
				throw new ArgumentNullException("libraryTheme");
			}
			if (libraryTheme.ParentTheme != null)
			{
				throw new ArgumentException("The theme already has a parent.");
			}
			if (!LibraryThemesInternal.Contains(libraryTheme))
			{
				LibraryThemesInternal.Add(libraryTheme);
				libraryTheme.ParentTheme = this;
				Resources.MergedDictionaries.Add(libraryTheme.Resources);
			}
			return this;
		}

		public override string ToString()
		{
			return $"DisplayName={DisplayName}, Name={Name}, IsHighContrast={IsHighContrast}, IsRuntimeGenerated={IsRuntimeGenerated}";
		}

		public static string? GetThemeName(ResourceDictionary resourceDictionary)
		{
			if (resourceDictionary == null)
			{
				throw new ArgumentNullException("resourceDictionary");
			}
			if (!IsThemeDictionary(resourceDictionary))
			{
				return null;
			}
			return ResourceDictionaryHelper.GetValueFromKey(resourceDictionary, "Theme.Name") as string;
		}

		public static Theme? GetThemeInstance(ResourceDictionary resourceDictionary)
		{
			if (resourceDictionary == null)
			{
				throw new ArgumentNullException("resourceDictionary");
			}
			if (!IsThemeDictionary(resourceDictionary))
			{
				return null;
			}
			return ResourceDictionaryHelper.GetValueFromKey(resourceDictionary, "Theme.ThemeInstance") as Theme;
		}

		public static bool IsThemeDictionary(ResourceDictionary resourceDictionary)
		{
			if (resourceDictionary == null)
			{
				throw new ArgumentNullException("resourceDictionary");
			}
			Uri source = resourceDictionary.Source;
			if ((object)source != null && ThemeDictionaryCache.TryGetValue(source, out var value))
			{
				return value;
			}
			bool flag = ResourceDictionaryHelper.ContainsKey(resourceDictionary, "Theme.ThemeInstance") || !string.IsNullOrEmpty(ResourceDictionaryHelper.GetValueFromKey(resourceDictionary, "Theme.Name") as string);
			if ((object)source != null)
			{
				ThemeDictionaryCache[source] = flag;
			}
			return flag;
		}

		public static bool IsRuntimeGeneratedThemeDictionary(ResourceDictionary resourceDictionary)
		{
			if (IsThemeDictionary(resourceDictionary))
			{
				if (!ResourceDictionaryHelper.ContainsKey(resourceDictionary, "Theme.ThemeInstance") || !((Theme)resourceDictionary[(object)"Theme.ThemeInstance"]).IsRuntimeGenerated)
				{
					if (ResourceDictionaryHelper.ContainsKey(resourceDictionary, "Theme.IsRuntimeGenerated"))
					{
						return (bool)resourceDictionary[(object)"Theme.IsRuntimeGenerated"];
					}
					return false;
				}
				return true;
			}
			return false;
		}
	}
	public class ThemeChangedEventArgs : EventArgs
	{
		public object? Target { get; }

		public ResourceDictionary TargetResourceDictionary { get; }

		public Theme? OldTheme { get; set; }

		public Theme NewTheme { get; set; }

		public ThemeChangedEventArgs(object? target, ResourceDictionary targetResourceDictionary, Theme? oldTheme, Theme newTheme)
		{
			Target = target;
			TargetResourceDictionary = targetResourceDictionary;
			OldTheme = oldTheme;
			NewTheme = newTheme;
		}
	}
	public class ThemeGenerator
	{
		public class ThemeGeneratorParameters
		{
			public Dictionary<string, string> DefaultValues { get; set; } = new Dictionary<string, string>();


			public ThemeGeneratorBaseColorScheme[] BaseColorSchemes { get; set; } = new ThemeGeneratorBaseColorScheme[0];


			public ThemeGeneratorColorScheme[] ColorSchemes { get; set; } = new ThemeGeneratorColorScheme[0];


			public AdditionalColorSchemeVariant[] AdditionalColorSchemeVariants { get; set; } = new AdditionalColorSchemeVariant[0];

		}

		[DebuggerDisplay("{Name}")]
		public class ThemeGeneratorBaseColorScheme
		{
			public string Name { get; set; } = string.Empty;


			public Dictionary<string, string> Values { get; set; } = new Dictionary<string, string>();

		}

		[DebuggerDisplay("{Name}")]
		public class AdditionalColorSchemeVariant
		{
			public string Name { get; set; } = string.Empty;


			public Dictionary<string, string> Values { get; set; } = new Dictionary<string, string>();

		}

		[DebuggerDisplay("{Name}")]
		public class ThemeGeneratorColorScheme
		{
			public string Name { get; set; } = string.Empty;


			public string ForBaseColor { get; set; } = string.Empty;


			public string ForColorSchemeVariant { get; set; } = string.Empty;


			public bool IsHighContrast { get; set; }

			public Dictionary<string, string> Values { get; set; } = new Dictionary<string, string>();

		}

		public static ThemeGenerator Current { get; set; }

		static ThemeGenerator()
		{
			Current = new ThemeGenerator();
		}

		public virtual ThemeGeneratorParameters GetParametersFromString(string input)
		{
			return JsonSerializer.Deserialize<ThemeGeneratorParameters>(input);
		}

		public virtual string GenerateColorSchemeFileContent(string templateContent, string themeName, string themeDisplayName, string baseColorScheme, string colorScheme, string alternativeColorScheme, bool isHighContrast, params Dictionary<string, string>[] valueSources)
		{
			templateContent = templateContent.Replace("{{ThemeName}}", themeName);
			templateContent = templateContent.Replace("{{ThemeDisplayName}}", themeDisplayName);
			templateContent = templateContent.Replace("{{BaseColorScheme}}", baseColorScheme);
			templateContent = templateContent.Replace("{{ColorScheme}}", colorScheme);
			templateContent = templateContent.Replace("{{AlternativeColorScheme}}", alternativeColorScheme);
			templateContent = templateContent.Replace("{{IsHighContrast}}", isHighContrast.ToString());
			foreach (Dictionary<string, string> dictionary in valueSources)
			{
				foreach (KeyValuePair<string, string> item in dictionary)
				{
					templateContent = templateContent.Replace("{{" + item.Key + "}}", item.Value);
				}
			}
			return templateContent;
		}
	}
	public class ThemeManager
	{
		public static readonly string BaseColorLight;

		public const string BaseColorLightConst = "Light";

		public static readonly string BaseColorDark;

		public const string BaseColorDarkConst = "Dark";

		private bool isEnsuringThemesOrRegisteringProvider;

		private readonly ObservableCollection<LibraryThemeProvider> libraryThemeProvidersInternal;

		private readonly ObservableCollection<Theme> themesInternal;

		private readonly ReadOnlyObservableCollection<Theme> themes;

		private readonly ObservableCollection<string> baseColorsInternal;

		private readonly ReadOnlyObservableCollection<string> baseColors;

		private readonly ObservableCollection<string> colorSchemesInternal;

		private readonly ReadOnlyObservableCollection<string> colorSchemes;

		private ThemeSyncMode themeSyncMode;

		private bool isSyncScheduled;

		public static ThemeManager Current { get; set; }

		public ReadOnlyObservableCollection<LibraryThemeProvider> LibraryThemeProviders { get; }

		public ReadOnlyObservableCollection<Theme> Themes
		{
			get
			{
				EnsureThemes();
				return themes;
			}
		}

		public ReadOnlyObservableCollection<string> BaseColors
		{
			get
			{
				EnsureThemes();
				return baseColors;
			}
		}

		public ReadOnlyObservableCollection<string> ColorSchemes
		{
			get
			{
				EnsureThemes();
				return colorSchemes;
			}
		}

		public ThemeSyncMode ThemeSyncMode
		{
			get
			{
				return themeSyncMode;
			}
			set
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Expected O, but got Unknown
				if (value != themeSyncMode)
				{
					themeSyncMode = value;
					SystemEvents.UserPreferenceChanged -= new UserPreferenceChangedEventHandler(HandleUserPreferenceChanged);
					SystemParameters.StaticPropertyChanged -= HandleStaticPropertyChanged;
					if (themeSyncMode != 0)
					{
						SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(HandleUserPreferenceChanged);
						SystemParameters.StaticPropertyChanged += HandleStaticPropertyChanged;
					}
				}
			}
		}

		public event EventHandler<ThemeChangedEventArgs>? ThemeChanged;

		static ThemeManager()
		{
			BaseColorLight = "Light";
			BaseColorDark = "Dark";
			Current = new ThemeManager();
		}

		public ThemeManager()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			libraryThemeProvidersInternal = new ObservableCollection<LibraryThemeProvider>();
			LibraryThemeProviders = new ReadOnlyObservableCollection<LibraryThemeProvider>(libraryThemeProvidersInternal);
			themesInternal = new ObservableCollection<Theme>();
			themes = new ReadOnlyObservableCollection<Theme>(themesInternal);
			ICollectionView defaultView = CollectionViewSource.GetDefaultView((object)themes);
			((Collection<SortDescription>)(object)defaultView.SortDescriptions).Add(new SortDescription("DisplayName", ListSortDirection.Ascending));
			themesInternal.CollectionChanged += ThemesInternalCollectionChanged;
			baseColorsInternal = new ObservableCollection<string>();
			baseColors = new ReadOnlyObservableCollection<string>(baseColorsInternal);
			ICollectionView defaultView2 = CollectionViewSource.GetDefaultView((object)baseColors);
			((Collection<SortDescription>)(object)defaultView2.SortDescriptions).Add(new SortDescription(string.Empty, ListSortDirection.Ascending));
			colorSchemesInternal = new ObservableCollection<string>();
			colorSchemes = new ReadOnlyObservableCollection<string>(colorSchemesInternal);
			ICollectionView defaultView3 = CollectionViewSource.GetDefaultView((object)colorSchemes);
			((Collection<SortDescription>)(object)defaultView3.SortDescriptions).Add(new SortDescription(string.Empty, ListSortDirection.Ascending));
		}

		private void EnsureThemes()
		{
			if (themes.Count > 0 || isEnsuringThemesOrRegisteringProvider)
			{
				return;
			}
			try
			{
				isEnsuringThemesOrRegisteringProvider = true;
				foreach (LibraryThemeProvider item in libraryThemeProvidersInternal)
				{
					foreach (LibraryTheme libraryTheme in item.GetLibraryThemes())
					{
						AddLibraryTheme(libraryTheme);
					}
				}
			}
			catch (Exception innerException)
			{
				throw new InvalidOperationException("This exception happens because you are maybe running that code out of the scope of a WPF application. Most likely because you are testing your configuration inside a unit test.", innerException);
			}
			finally
			{
				isEnsuringThemesOrRegisteringProvider = false;
			}
		}

		public void RegisterLibraryThemeProvider(LibraryThemeProvider libraryThemeProvider)
		{
			LibraryThemeProvider libraryThemeProvider2 = libraryThemeProvider;
			if (libraryThemeProvider2 == null)
			{
				throw new ArgumentNullException("libraryThemeProvider");
			}
			if (libraryThemeProvidersInternal.Any((LibraryThemeProvider x) => ((object)x).GetType() == ((object)libraryThemeProvider2).GetType()))
			{
				return;
			}
			libraryThemeProvidersInternal.Add(libraryThemeProvider2);
			try
			{
				isEnsuringThemesOrRegisteringProvider = true;
				foreach (LibraryTheme libraryTheme in libraryThemeProvider2.GetLibraryThemes())
				{
					AddLibraryTheme(libraryTheme);
				}
			}
			finally
			{
				isEnsuringThemesOrRegisteringProvider = false;
			}
		}

		private void ThemesInternalCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
		{
			switch (e.Action)
			{
			case NotifyCollectionChangedAction.Add:
			{
				foreach (Theme item in e.NewItems.OfType<Theme>())
				{
					if (!baseColorsInternal.Contains(item.BaseColorScheme))
					{
						baseColorsInternal.Add(item.BaseColorScheme);
					}
					if (!colorSchemesInternal.Contains(item.ColorScheme))
					{
						colorSchemesInternal.Add(item.ColorScheme);
					}
				}
				break;
			}
			case NotifyCollectionChangedAction.Remove:
			{
				foreach (Theme oldItem in e.OldItems.OfType<Theme>())
				{
					if (!themesInternal.Any((Theme x) => x.BaseColorScheme == oldItem.BaseColorScheme))
					{
						baseColorsInternal.Remove(oldItem.BaseColorScheme);
					}
					if (!themesInternal.Any((Theme x) => x.ColorScheme == oldItem.ColorScheme))
					{
						baseColorsInternal.Remove(oldItem.ColorScheme);
					}
				}
				break;
			}
			case NotifyCollectionChangedAction.Reset:
				baseColorsInternal.Clear();
				colorSchemesInternal.Clear();
				foreach (Theme item2 in from x in themesInternal
					group x by x.BaseColorScheme into x
					select x.First())
				{
					baseColorsInternal.Add(item2.BaseColorScheme);
				}
				{
					foreach (Theme item3 in from x in themesInternal
						group x by x.ColorScheme into x
						select x.First())
					{
						colorSchemesInternal.Add(item3.ColorScheme);
					}
					break;
				}
			case NotifyCollectionChangedAction.Replace:
			case NotifyCollectionChangedAction.Move:
				break;
			}
		}

		public void ClearThemes()
		{
			themesInternal.Clear();
		}

		public Theme AddLibraryTheme(LibraryTheme libraryTheme)
		{
			Theme theme = GetTheme(libraryTheme.Name, libraryTheme.IsHighContrast);
			if (theme != null)
			{
				theme.AddLibraryTheme(libraryTheme);
				return theme;
			}
			theme = new Theme(libraryTheme);
			themesInternal.Add(theme);
			return theme;
		}

		public Theme AddTheme(Theme theme)
		{
			Theme theme2 = GetTheme(theme.Name, theme.IsHighContrast);
			if (theme2 != null)
			{
				return theme2;
			}
			themesInternal.Add(theme);
			return theme;
		}

		public Theme? GetTheme(string name, bool highContrast = false)
		{
			string name2 = name;
			if (name2 == null)
			{
				throw new ArgumentNullException("name");
			}
			return Themes.FirstOrDefault((Theme x) => x.Name.Equals(name2, StringComparison.OrdinalIgnoreCase) && x.IsHighContrast == highContrast);
		}

		public Theme? GetTheme(string baseColorScheme, string colorScheme, bool highContrast = false)
		{
			string baseColorScheme2 = baseColorScheme;
			string colorScheme2 = colorScheme;
			if (baseColorScheme2 == null)
			{
				throw new ArgumentNullException("baseColorScheme");
			}
			if (colorScheme2 == null)
			{
				throw new ArgumentNullException("colorScheme");
			}
			Theme theme = Themes.FirstOrDefault((Theme x) => x.BaseColorScheme == baseColorScheme2 && x.ColorScheme == colorScheme2 && x.IsHighContrast == highContrast);
			if (theme == null && highContrast)
			{
				theme = Themes.FirstOrDefault((Theme x) => x.BaseColorScheme == baseColorScheme2 && x.ColorScheme == "Generic" && x.IsHighContrast == highContrast) ?? Themes.FirstOrDefault((Theme x) => x.BaseColorScheme == baseColorScheme2 && x.IsHighContrast == highContrast);
			}
			return theme;
		}

		public Theme? GetTheme(ResourceDictionary resourceDictionary)
		{
			ResourceDictionary resourceDictionary2 = resourceDictionary;
			if (resourceDictionary2 == null)
			{
				throw new ArgumentNullException("resourceDictionary");
			}
			Theme themeInstance = Theme.GetThemeInstance(resourceDictionary2);
			if (themeInstance != null)
			{
				return themeInstance;
			}
			Theme theme = Themes.FirstOrDefault((Theme x) => x.Name == Theme.GetThemeName(resourceDictionary2));
			if (theme != null)
			{
				return theme;
			}
			if (IsRuntimeGeneratedThemeDictionary(resourceDictionary2))
			{
				foreach (object key in resourceDictionary2.Keys)
				{
					if ("Theme.ThemeInstance".Equals(key))
					{
						return (Theme)resourceDictionary2[key];
					}
				}
				foreach (object key2 in resourceDictionary2.Keys)
				{
					if ("Theme.LibraryThemeInstance".Equals(key2))
					{
						Theme parentTheme = ((LibraryTheme)resourceDictionary2[key2]).ParentTheme;
						if (parentTheme != null)
						{
							return parentTheme;
						}
					}
				}
				return new Theme(new LibraryTheme(resourceDictionary2, null));
			}
			return null;
		}

		public Theme? GetInverseTheme(Theme theme)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (theme == null)
			{
				throw new ArgumentNullException("theme");
			}
			if (theme.IsRuntimeGenerated)
			{
				string baseColorScheme = theme.BaseColorScheme;
				if (baseColorScheme == "Dark")
				{
					return RuntimeThemeGenerator.Current.GenerateRuntimeTheme(BaseColorLight, theme.PrimaryAccentColor, theme.IsHighContrast);
				}
				if (baseColorScheme == "Light")
				{
					return RuntimeThemeGenerator.Current.GenerateRuntimeTheme(BaseColorDark, theme.PrimaryAccentColor, theme.IsHighContrast);
				}
			}
			else
			{
				string baseColorScheme2 = theme.BaseColorScheme;
				if (baseColorScheme2 == "Dark")
				{
					return GetTheme(BaseColorLight, theme.ColorScheme, theme.IsHighContrast);
				}
				if (baseColorScheme2 == "Light")
				{
					return GetTheme(BaseColorDark, theme.ColorScheme, theme.IsHighContrast);
				}
			}
			return null;
		}

		public bool IsThemeDictionary(ResourceDictionary resourceDictionary)
		{
			return Theme.IsThemeDictionary(resourceDictionary);
		}

		public bool IsRuntimeGeneratedThemeDictionary(ResourceDictionary resourceDictionary)
		{
			return Theme.IsRuntimeGeneratedThemeDictionary(resourceDictionary);
		}

		[SecurityCritical]
		public Theme ChangeTheme(Application app, string themeName, bool highContrast = false)
		{
			if (app == null)
			{
				throw new ArgumentNullException("app");
			}
			if (string.IsNullOrEmpty(themeName))
			{
				throw new ArgumentNullException("themeName");
			}
			return ChangeTheme(app, app.Resources, GetTheme(themeName, highContrast));
		}

		[SecurityCritical]
		public Theme ChangeTheme(FrameworkElement frameworkElement, string themeName, bool highContrast = false)
		{
			if (frameworkElement == null)
			{
				throw new ArgumentNullException("frameworkElement");
			}
			if (string.IsNullOrEmpty(themeName))
			{
				throw new ArgumentNullException("themeName");
			}
			return ChangeTheme(frameworkElement, GetTheme(themeName, highContrast));
		}

		[SecurityCritical]
		public Theme ChangeTheme(Application app, Theme newTheme)
		{
			if (app == null)
			{
				throw new ArgumentNullException("app");
			}
			if (newTheme == null)
			{
				throw new ArgumentNullException("newTheme");
			}
			return ChangeTheme(app, app.Resources, newTheme);
		}

		[SecurityCritical]
		public Theme ChangeTheme(FrameworkElement frameworkElement, Theme newTheme)
		{
			if (frameworkElement == null)
			{
				throw new ArgumentNullException("frameworkEleme

JetBrains.Annotations.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("JetBrains")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Annotations to increase accuracy of ReSharper code inspections")]
[assembly: AssemblyFileVersion("2022.3.1")]
[assembly: AssemblyInformationalVersion("2022.3.1+4b7d2865cfa6e45eb03b980abc738181d9b94cfa")]
[assembly: AssemblyProduct("JetBrains .NET Platform")]
[assembly: AssemblyTitle("JetBrains Annotations")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/JetBrains/JetBrains.Annotations/")]
[assembly: AssemblyVersion("4242.42.42.42")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace JetBrains.Annotations
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.GenericParameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class CanBeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.GenericParameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Delegate)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class ItemNotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Delegate)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class ItemCanBeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Delegate)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class StringFormatMethodAttribute : Attribute
	{
		[NotNull]
		public string FormatParameterName { get; }

		public StringFormatMethodAttribute([NotNull] string formatParameterName)
		{
			FormatParameterName = formatParameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class StructuredMessageTemplateAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class ValueProviderAttribute : Attribute
	{
		[NotNull]
		public string Name { get; }

		public ValueProviderAttribute([NotNull] string name)
		{
			Name = name;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Delegate, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class ValueRangeAttribute : Attribute
	{
		public object From { get; }

		public object To { get; }

		public ValueRangeAttribute(long from, long to)
		{
			From = from;
			To = to;
		}

		public ValueRangeAttribute(ulong from, ulong to)
		{
			From = from;
			To = to;
		}

		public ValueRangeAttribute(long value)
		{
			From = (To = value);
		}

		public ValueRangeAttribute(ulong value)
		{
			From = (To = value);
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Delegate)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class NonNegativeValueAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class InvokerParameterNameAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
	{
		[CanBeNull]
		public string ParameterName { get; }

		public NotifyPropertyChangedInvocatorAttribute()
		{
		}

		public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class ContractAnnotationAttribute : Attribute
	{
		[NotNull]
		public string Contract { get; }

		public bool ForceFullStates { get; }

		public ContractAnnotationAttribute([NotNull] string contract)
			: this(contract, forceFullStates: false)
		{
		}

		public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates)
		{
			Contract = contract;
			ForceFullStates = forceFullStates;
		}
	}
	[AttributeUsage(AttributeTargets.All)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class LocalizationRequiredAttribute : Attribute
	{
		public bool Required { get; }

		public LocalizationRequiredAttribute()
			: this(required: true)
		{
		}

		public LocalizationRequiredAttribute(bool required)
		{
			Required = required;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class CannotApplyEqualityOperatorAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
	[BaseTypeRequired(typeof(Attribute))]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class BaseTypeRequiredAttribute : Attribute
	{
		[NotNull]
		public Type BaseType { get; }

		public BaseTypeRequiredAttribute([NotNull] Type baseType)
		{
			BaseType = baseType;
		}
	}
	[AttributeUsage(AttributeTargets.All)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class UsedImplicitlyAttribute : Attribute
	{
		public ImplicitUseKindFlags UseKindFlags { get; }

		public ImplicitUseTargetFlags TargetFlags { get; }

		public UsedImplicitlyAttribute()
			: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default)
		{
		}

		public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)
			: this(useKindFlags, ImplicitUseTargetFlags.Default)
		{
		}

		public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)
			: this(ImplicitUseKindFlags.Default, targetFlags)
		{
		}

		public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
		{
			UseKindFlags = useKindFlags;
			TargetFlags = targetFlags;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Parameter | AttributeTargets.GenericParameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class MeansImplicitUseAttribute : Attribute
	{
		[UsedImplicitly]
		public ImplicitUseKindFlags UseKindFlags { get; }

		[UsedImplicitly]
		public ImplicitUseTargetFlags TargetFlags { get; }

		public MeansImplicitUseAttribute()
			: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default)
		{
		}

		public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)
			: this(useKindFlags, ImplicitUseTargetFlags.Default)
		{
		}

		public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)
			: this(ImplicitUseKindFlags.Default, targetFlags)
		{
		}

		public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
		{
			UseKindFlags = useKindFlags;
			TargetFlags = targetFlags;
		}
	}
	[Flags]
	public enum ImplicitUseKindFlags
	{
		Default = 7,
		Access = 1,
		Assign = 2,
		InstantiatedWithFixedConstructorSignature = 4,
		InstantiatedNoFixedConstructorSignature = 8
	}
	[Flags]
	public enum ImplicitUseTargetFlags
	{
		Default = 1,
		Itself = 1,
		Members = 2,
		WithInheritors = 4,
		WithMembers = 3
	}
	[MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)]
	[AttributeUsage(AttributeTargets.All, Inherited = false)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class PublicAPIAttribute : Attribute
	{
		[CanBeNull]
		public string Comment { get; }

		public PublicAPIAttribute()
		{
		}

		public PublicAPIAttribute([NotNull] string comment)
		{
			Comment = comment;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class InstantHandleAttribute : Attribute
	{
		public bool RequireAwait { get; set; }
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class PureAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class MustUseReturnValueAttribute : Attribute
	{
		[CanBeNull]
		public string Justification { get; }

		public MustUseReturnValueAttribute()
		{
		}

		public MustUseReturnValueAttribute([NotNull] string justification)
		{
			Justification = justification;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RequireStaticDelegateAttribute : Attribute
	{
		public bool IsError { get; set; }
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.GenericParameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class ProvidesContextAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class PathReferenceAttribute : Attribute
	{
		[CanBeNull]
		public string BasePath { get; }

		public PathReferenceAttribute()
		{
		}

		public PathReferenceAttribute([NotNull][PathReference] string basePath)
		{
			BasePath = basePath;
		}
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class SourceTemplateAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class MacroAttribute : Attribute
	{
		[CanBeNull]
		public string Expression { get; set; }

		public int Editable { get; set; }

		[CanBeNull]
		public string Target { get; set; }
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.ReturnValue)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class CollectionAccessAttribute : Attribute
	{
		public CollectionAccessType CollectionAccessType { get; }

		public CollectionAccessAttribute(CollectionAccessType collectionAccessType)
		{
			CollectionAccessType = collectionAccessType;
		}
	}
	[Flags]
	public enum CollectionAccessType
	{
		None = 0,
		Read = 1,
		ModifyExistingContent = 2,
		UpdatedContent = 6
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AssertionMethodAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AssertionConditionAttribute : Attribute
	{
		public AssertionConditionType ConditionType { get; }

		public AssertionConditionAttribute(AssertionConditionType conditionType)
		{
			ConditionType = conditionType;
		}
	}
	public enum AssertionConditionType
	{
		IS_TRUE,
		IS_FALSE,
		IS_NULL,
		IS_NOT_NULL
	}
	[Obsolete("Use [ContractAnnotation('=> halt')] instead")]
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class TerminatesProgramAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class LinqTunnelAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class NoEnumerationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RegexPatternAttribute : Attribute
	{
	}
	public enum InjectedLanguage
	{
		CSS,
		HTML,
		JAVASCRIPT,
		JSON,
		XML
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class LanguageInjectionAttribute : Attribute
	{
		public InjectedLanguage InjectedLanguage { get; }

		[CanBeNull]
		public string InjectedLanguageName { get; }

		[CanBeNull]
		public string Prefix { get; set; }

		[CanBeNull]
		public string Suffix { get; set; }

		public LanguageInjectionAttribute(InjectedLanguage injectedLanguage)
		{
			InjectedLanguage = injectedLanguage;
		}

		public LanguageInjectionAttribute([NotNull] string injectedLanguage)
		{
			InjectedLanguageName = injectedLanguage;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class NoReorderAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class CodeTemplateAttribute : Attribute
	{
		public string SearchTemplate { get; }

		public string Message { get; set; }

		public string ReplaceTemplate { get; set; }

		public string ReplaceMessage { get; set; }

		public bool FormatAfterReplace { get; set; } = true;


		public bool MatchSimilarConstructs { get; set; }

		public bool ShortenReferences { get; set; }

		public string SuppressionKey { get; set; }

		public CodeTemplateAttribute(string searchTemplate)
		{
			SearchTemplate = searchTemplate;
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspChildControlTypeAttribute : Attribute
	{
		[NotNull]
		public string TagName { get; }

		[NotNull]
		public Type ControlType { get; }

		public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType)
		{
			TagName = tagName;
			ControlType = controlType;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspDataFieldAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspDataFieldsAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMethodPropertyAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspRequiredAttributeAttribute : Attribute
	{
		[NotNull]
		public string Attribute { get; }

		public AspRequiredAttributeAttribute([NotNull] string attribute)
		{
			Attribute = attribute;
		}
	}
	[AttributeUsage(AttributeTargets.Property)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspTypePropertyAttribute : Attribute
	{
		public bool CreateConstructorReferences { get; }

		public AspTypePropertyAttribute(bool createConstructorReferences)
		{
			CreateConstructorReferences = createConstructorReferences;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute
	{
		[NotNull]
		public string Format { get; }

		public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format)
		{
			Format = format;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute
	{
		[NotNull]
		public string Format { get; }

		public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format)
		{
			Format = format;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute
	{
		[NotNull]
		public string Format { get; }

		public AspMvcAreaViewLocationFormatAttribute([NotNull] string format)
		{
			Format = format;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcMasterLocationFormatAttribute : Attribute
	{
		[NotNull]
		public string Format { get; }

		public AspMvcMasterLocationFormatAttribute([NotNull] string format)
		{
			Format = format;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute
	{
		[NotNull]
		public string Format { get; }

		public AspMvcPartialViewLocationFormatAttribute([NotNull] string format)
		{
			Format = format;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcViewLocationFormatAttribute : Attribute
	{
		[NotNull]
		public string Format { get; }

		public AspMvcViewLocationFormatAttribute([NotNull] string format)
		{
			Format = format;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcActionAttribute : Attribute
	{
		[CanBeNull]
		public string AnonymousProperty { get; }

		public AspMvcActionAttribute()
		{
		}

		public AspMvcActionAttribute([NotNull] string anonymousProperty)
		{
			AnonymousProperty = anonymousProperty;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcAreaAttribute : Attribute
	{
		[CanBeNull]
		public string AnonymousProperty { get; }

		public AspMvcAreaAttribute()
		{
		}

		public AspMvcAreaAttribute([NotNull] string anonymousProperty)
		{
			AnonymousProperty = anonymousProperty;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcControllerAttribute : Attribute
	{
		[CanBeNull]
		public string AnonymousProperty { get; }

		public AspMvcControllerAttribute()
		{
		}

		public AspMvcControllerAttribute([NotNull] string anonymousProperty)
		{
			AnonymousProperty = anonymousProperty;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcMasterAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcModelTypeAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcPartialViewAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcSuppressViewErrorAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcDisplayTemplateAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcEditorTemplateAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcTemplateAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcViewAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcViewComponentAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcViewComponentViewAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMvcActionSelectorAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RouteTemplateAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RouteParameterConstraintAttribute : Attribute
	{
		[NotNull]
		public string ConstraintName { get; }

		[CanBeNull]
		public Type ProposedType { get; set; }

		public RouteParameterConstraintAttribute([NotNull] string constraintName)
		{
			ConstraintName = constraintName;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class UriStringAttribute : Attribute
	{
		[CanBeNull]
		public string HttpVerb { get; }

		public UriStringAttribute()
		{
		}

		public UriStringAttribute(string httpVerb)
		{
			HttpVerb = httpVerb;
		}
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspRouteConventionAttribute : Attribute
	{
		[CanBeNull]
		public string PredefinedPattern { get; }

		public AspRouteConventionAttribute()
		{
		}

		public AspRouteConventionAttribute(string predefinedPattern)
		{
			PredefinedPattern = predefinedPattern;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspDefaultRouteValuesAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspRouteValuesConstraintsAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspRouteOrderAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspRouteVerbsAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspAttributeRoutingAttribute : Attribute
	{
		public string HttpVerb { get; set; }
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMinimalApiDeclarationAttribute : Attribute
	{
		public string HttpVerb { get; set; }
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMinimalApiGroupAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class AspMinimalApiHandlerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class HtmlElementAttributesAttribute : Attribute
	{
		[CanBeNull]
		public string Name { get; }

		public HtmlElementAttributesAttribute()
		{
		}

		public HtmlElementAttributesAttribute([NotNull] string name)
		{
			Name = name;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class HtmlAttributeValueAttribute : Attribute
	{
		[NotNull]
		public string Name { get; }

		public HtmlAttributeValueAttribute([NotNull] string name)
		{
			Name = name;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RazorSectionAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RazorImportNamespaceAttribute : Attribute
	{
		[NotNull]
		public string Name { get; }

		public RazorImportNamespaceAttribute([NotNull] string name)
		{
			Name = name;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RazorInjectionAttribute : Attribute
	{
		[NotNull]
		public string Type { get; }

		[NotNull]
		public string FieldName { get; }

		public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName)
		{
			Type = type;
			FieldName = fieldName;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RazorDirectiveAttribute : Attribute
	{
		[NotNull]
		public string Directive { get; }

		public RazorDirectiveAttribute([NotNull] string directive)
		{
			Directive = directive;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RazorPageBaseTypeAttribute : Attribute
	{
		[NotNull]
		public string BaseType { get; }

		[CanBeNull]
		public string PageName { get; }

		public RazorPageBaseTypeAttribute([NotNull] string baseType)
		{
			BaseType = baseType;
		}

		public RazorPageBaseTypeAttribute([NotNull] string baseType, string pageName)
		{
			BaseType = baseType;
			PageName = pageName;
		}
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RazorHelperCommonAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RazorLayoutAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RazorWriteLiteralMethodAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RazorWriteMethodAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class RazorWriteMethodParameterAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class XamlItemsControlAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class XamlItemBindingOfItemsControlAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class XamlItemStyleOfItemsControlAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class XamlOneWayBindingModeByDefaultAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
	[Conditional("JETBRAINS_ANNOTATIONS")]
	public sealed class XamlTwoWayBindingModeByDefaultAttribute : Attribute
	{
	}
}

libc.translation.dll

Decompiled 5 months ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.Json;
using System.Xml.Linq;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Saeid Farahi Mohassel")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("7.1.0.0")]
[assembly: AssemblyInformationalVersion("7.1.0")]
[assembly: AssemblyProduct("A library to help you implement translation using json files to replace .resx files in .net standard projects")]
[assembly: AssemblyTitle("libc.translation")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/saeidjoker/libc.translation")]
[assembly: AssemblyVersion("7.1.0.0")]
namespace libc.translation;

internal class EmbeddedResource
{
	private readonly Assembly _assembly;

	public EmbeddedResource(Assembly assembly)
	{
		_assembly = assembly;
	}

	public string ReadAsString(string resourceId)
	{
		using Stream stream = _assembly.GetManifestResourceStream(resourceId);
		if (stream == null)
		{
			throw new InvalidOperationException("Could read " + resourceId + " as stream!");
		}
		using StreamReader streamReader = new StreamReader(stream);
		return streamReader.ReadToEnd();
	}

	public byte[] ReadAsBinary(string resourceId)
	{
		using Stream stream = _assembly.GetManifestResourceStream(resourceId);
		if (stream == null)
		{
			throw new InvalidOperationException("Could read " + resourceId + " as stream!");
		}
		using MemoryStream memoryStream = new MemoryStream();
		stream.CopyTo(memoryStream);
		return memoryStream.ToArray();
	}

	public void PutInFile(string resourceId, string filePath)
	{
		byte[] bytes = ReadAsBinary(resourceId);
		File.WriteAllBytes(filePath, bytes);
	}
}
public class FlatExtractingJsonLocalizationSource : ILocalizationSource
{
	private readonly PropertyCaseSensitivity _caseSensitivity;

	private readonly string _filenamePattern;

	private readonly string _path;

	private readonly ConcurrentDictionary<string, IDictionary<string, string>> _strings = new ConcurrentDictionary<string, IDictionary<string, string>>();

	public FlatExtractingJsonLocalizationSource(string path, PropertyCaseSensitivity caseSensitivity, string filenamePattern = "{0}.json")
	{
		_caseSensitivity = caseSensitivity;
		_filenamePattern = filenamePattern;
		_path = path;
	}

	public string Get(string culture, string key)
	{
		string value;
		return GetStrings(culture).TryGetValue(GetKey(key), out value) ? value : null;
	}

	public IDictionary<string, string> GetAll(string culture)
	{
		return GetStrings(culture) ?? new ConcurrentDictionary<string, string>();
	}

	private IDictionary<string, string> LoadStrings(string jsonFile)
	{
		using JsonDocument jsonDocument = JsonDocument.Parse((Stream)new FileInfo(jsonFile).OpenRead(), default(JsonDocumentOptions));
		return jsonDocument.RootElement.EnumerateObject().Aggregate(new Dictionary<string, string>(), delegate(Dictionary<string, string> acc, JsonProperty cur)
		{
			if (cur.Value.ValueKind != JsonValueKind.Object && cur.Value.ValueKind != JsonValueKind.Array)
			{
				acc[GetKey(cur.Name)] = cur.Value.ToString();
			}
			else
			{
				Dictionary<string, string> dictionary = FlattenJson(cur.Value);
				foreach (KeyValuePair<string, string> item in dictionary)
				{
					acc[GetKey(cur.Name + "." + item.Key)] = item.Value;
				}
			}
			return acc;
		});
	}

	private string GetKey(string key)
	{
		return (_caseSensitivity == PropertyCaseSensitivity.CaseInsensitive) ? key.ToLower() : key;
	}

	private static Dictionary<string, string> FlattenJson(JsonElement element, string prefix = "")
	{
		Dictionary<string, string> dictionary = new Dictionary<string, string>();
		switch (element.ValueKind)
		{
		case JsonValueKind.Object:
			foreach (JsonProperty item in element.EnumerateObject())
			{
				string prefix3 = (string.IsNullOrEmpty(prefix) ? item.Name : (prefix + "." + item.Name));
				Dictionary<string, string> dictionary3 = FlattenJson(item.Value, prefix3);
				foreach (KeyValuePair<string, string> item2 in dictionary3)
				{
					dictionary[item2.Key] = item2.Value;
				}
			}
			break;
		case JsonValueKind.Array:
		{
			for (int i = 0; i < element.GetArrayLength(); i++)
			{
				string prefix2 = (string.IsNullOrEmpty(prefix) ? $"{i}" : $"{prefix}.{i}");
				Dictionary<string, string> dictionary2 = FlattenJson(element[i], prefix2);
				foreach (KeyValuePair<string, string> item3 in dictionary2)
				{
					dictionary[item3.Key] = item3.Value;
				}
			}
			break;
		}
		default:
			dictionary[prefix] = element.ToString();
			break;
		}
		return dictionary;
	}

	private IDictionary<string, string> GetStrings(string culture)
	{
		return _strings.GetOrAdd(culture, ReadFile);
	}

	private IDictionary<string, string> ReadFile(string key)
	{
		string text = Path.Combine(_path, string.Format(_filenamePattern, key));
		IDictionary<string, string> result;
		if (File.Exists(text))
		{
			result = LoadStrings(text);
		}
		else
		{
			IDictionary<string, string> dictionary = new Dictionary<string, string>();
			result = dictionary;
		}
		return result;
	}
}
public interface ILocalizationSource
{
	string Get(string culture, string key);

	IDictionary<string, string> GetAll(string culture);
}
public interface ILocalizer
{
	ILocalizationSource Source { get; }

	string FallbackCulture { get; }

	ILocalizer WithFallbackCulture(string fallbackCulture);

	string Get(string culture, string key);

	string Get(string key);

	string GetFormat(string culture, string key, params object[] values);

	string GetFormat(string key, params object[] values);

	IDictionary<string, string> GetAll(string culture);

	IDictionary<string, string> GetAll();
}
public class JsonLocalizationSource : ILocalizationSource
{
	private class ElementWithPath
	{
		public JsonElement Element { get; }

		public string Path { get; }

		public ElementWithPath(JsonElement element, string path)
		{
			Element = element;
			Path = path;
		}
	}

	private readonly PropertyCaseSensitivity _caseSensitivity;

	private readonly JsonElement _root;

	public JsonLocalizationSource(JsonDocument jsonDocument, PropertyCaseSensitivity caseSensitivity)
	{
		_caseSensitivity = caseSensitivity;
		_root = GetRootElement(jsonDocument);
	}

	public JsonLocalizationSource(Assembly assembly, string resourceId, PropertyCaseSensitivity caseSensitivity, int jsonMaxDepth = 128)
	{
		_caseSensitivity = caseSensitivity;
		EmbeddedResource embeddedResource = new EmbeddedResource(assembly);
		string json = embeddedResource.ReadAsString(resourceId);
		_root = ToRootElement(json, jsonMaxDepth);
	}

	public JsonLocalizationSource(Stream stream, PropertyCaseSensitivity caseSensitivity, int jsonMaxDepth = 128)
	{
		_caseSensitivity = caseSensitivity;
		string json;
		using (StreamReader streamReader = new StreamReader(stream))
		{
			json = streamReader.ReadToEnd();
		}
		_root = ToRootElement(json, jsonMaxDepth);
	}

	public JsonLocalizationSource(FileInfo file, PropertyCaseSensitivity caseSensitivity, int jsonMaxDepth = 128)
		: this(file.OpenRead(), caseSensitivity, jsonMaxDepth)
	{
	}

	public string Get(string culture, string key)
	{
		if (!TryFindCultureElement(culture, out var cultureElement))
		{
			return null;
		}
		return (_caseSensitivity == PropertyCaseSensitivity.CaseInsensitive) ? GetCaseInsensitive(cultureElement, key) : GetCaseSensitive(cultureElement, key);
	}

	public IDictionary<string, string> GetAll(string culture)
	{
		if (!TryFindCultureElement(culture, out var cultureElement))
		{
			return null;
		}
		Dictionary<string, string> dictionary = new Dictionary<string, string>();
		foreach (JsonProperty item in cultureElement.EnumerateObject())
		{
			DFS(item, dictionary);
		}
		return dictionary;
	}

	private static void DFS(JsonProperty root, IDictionary<string, string> dict)
	{
		Stack<ElementWithPath> stack = new Stack<ElementWithPath>(new ElementWithPath[1]
		{
			new ElementWithPath(root.Value, root.Name)
		});
		while (stack.Count > 0)
		{
			ElementWithPath elementWithPath = stack.Pop();
			switch (elementWithPath.Element.ValueKind)
			{
			case JsonValueKind.String:
			case JsonValueKind.Number:
				dict[elementWithPath.Path] = elementWithPath.Element.GetString();
				break;
			case JsonValueKind.Object:
				foreach (JsonProperty item in elementWithPath.Element.EnumerateObject())
				{
					stack.Push(new ElementWithPath(item.Value, elementWithPath.Path + "." + item.Name));
				}
				break;
			}
		}
	}

	private static JsonElement GetRootElement(JsonDocument jsonDocument)
	{
		return jsonDocument.RootElement.Clone();
	}

	private static JsonElement ToRootElement(string json, int jsonMaxDepth)
	{
		JsonDocument jsonDocument = JsonDocument.Parse(json, new JsonDocumentOptions
		{
			AllowTrailingCommas = true,
			CommentHandling = JsonCommentHandling.Skip,
			MaxDepth = jsonMaxDepth
		});
		using (jsonDocument)
		{
			return GetRootElement(jsonDocument);
		}
	}

	private bool TryFindCultureElement(string culture, out JsonElement cultureElement)
	{
		return (_caseSensitivity != PropertyCaseSensitivity.CaseInsensitive) ? _root.TryGetProperty(culture, out cultureElement) : TryGetPropertyByKeyCaseInsensitive(_root, culture, out cultureElement);
	}

	private static string GetCaseSensitive(JsonElement cultureElement, string key)
	{
		string[] array = key.Split(new char[1] { '.' }, StringSplitOptions.RemoveEmptyEntries);
		JsonElement value = cultureElement;
		string[] array2 = array;
		foreach (string propertyName in array2)
		{
			if (!value.TryGetProperty(propertyName, out value))
			{
				return null;
			}
		}
		return value.GetString();
	}

	private static string GetCaseInsensitive(JsonElement cultureElement, string key)
	{
		string[] array = key.Split(new char[1] { '.' }, StringSplitOptions.RemoveEmptyEntries);
		JsonElement property = cultureElement;
		string[] array2 = array;
		foreach (string key2 in array2)
		{
			if (!TryGetPropertyByKeyCaseInsensitive(property, key2, out property))
			{
				return null;
			}
		}
		return property.GetString();
	}

	private static bool TryGetPropertyByKeyCaseInsensitive(JsonElement element, string key, out JsonElement property)
	{
		property = default(JsonElement);
		foreach (JsonProperty item in element.EnumerateObject())
		{
			if (item.Name.Equals(key, StringComparison.OrdinalIgnoreCase))
			{
				property = element.GetProperty(item.Name);
				return true;
			}
		}
		return false;
	}
}
public enum PropertyCaseSensitivity
{
	CaseSensitive,
	CaseInsensitive
}
public class Localizer : ILocalizer
{
	public ILocalizationSource Source { get; }

	public string FallbackCulture { get; private set; }

	public Localizer(ILocalizationSource source, string fallbackCulture = "en")
	{
		Source = source;
		FallbackCulture = fallbackCulture;
	}

	public ILocalizer WithFallbackCulture(string culture)
	{
		FallbackCulture = culture.ToLower();
		return this;
	}

	public string Get(string culture, string key)
	{
		Get(culture, key, out var value);
		return value;
	}

	public string Get(string key)
	{
		return Get(GetThreadCulture(), key);
	}

	public string GetFormat(string culture, string key, params object[] values)
	{
		string value;
		return Get(culture, key, out value) ? string.Format(value, values) : value;
	}

	public string GetFormat(string key, params object[] values)
	{
		return GetFormat(GetThreadCulture(), key, values);
	}

	public IDictionary<string, string> GetAll(string culture)
	{
		return Source.GetAll(culture) ?? Source.GetAll(FallbackCulture);
	}

	public IDictionary<string, string> GetAll()
	{
		return GetAll(GetThreadCulture());
	}

	private static string GetThreadCulture()
	{
		return CultureInfo.CurrentCulture.TwoLetterISOLanguageName.ToLower();
	}

	private bool Get(string culture, string key, out string value)
	{
		value = Source.Get(culture.ToLower(), key);
		if (value != null)
		{
			return true;
		}
		string text = Source.Get(FallbackCulture, key);
		if (text == null)
		{
			value = key;
			return false;
		}
		value = text;
		return true;
	}
}
public class ResxReader
{
	public static IDictionary<string, string> Read(FileInfo file)
	{
		Dictionary<string, string> dictionary = new Dictionary<string, string>();
		XDocument xDocument = XDocument.Load(file.FullName);
		if (xDocument.Root != null)
		{
			IEnumerable<XElement> enumerable = xDocument.Root.Elements("data");
			foreach (XElement item in enumerable)
			{
				dictionary[item.Attribute("name")?.Value ?? throw new Exception()] = item.Element("value")?.Value;
			}
		}
		return dictionary;
	}
}

MahApps.Metro.dll

Decompiled 5 months ago
#define TRACE
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Configuration;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using ControlzEx;
using ControlzEx.Behaviors;
using ControlzEx.Controls;
using ControlzEx.Native;
using ControlzEx.Standard;
using ControlzEx.Theming;
using ControlzEx.Windows.Shell;
using MahApps.Metro.Automation.Peers;
using MahApps.Metro.Behaviors;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using MahApps.Metro.Converters;
using MahApps.Metro.Lang;
using MahApps.Metro.ValueBoxes;
using Microsoft.CodeAnalysis;
using Microsoft.Xaml.Behaviors;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(/*Could not decode attribute arguments.*/)]
[assembly: NeutralResourcesLanguage("en", UltimateResourceFallbackLocation.MainAssembly)]
[assembly: XmlnsPrefix("http://metro.mahapps.com/winfx/xaml/controls", "mah")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Behaviors")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Theming")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Automation.Peers")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Accessibility")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.ValueBoxes")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Actions")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Converters")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Markup")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Controls")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Controls.Dialogs")]
[assembly: XmlnsPrefix("http://metro.mahapps.com/winfx/xaml/shared", "mah")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Behaviors")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Actions")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Converters")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Markup")]
[assembly: TargetFramework(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MahApps")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2021 .NET Foundation and Contributors. All rights reserved.")]
[assembly: AssemblyDescription("MahApps.Metro, a toolkit for creating Metro / Modern UI styled WPF applications.")]
[assembly: AssemblyFileVersion("2.4.9.2")]
[assembly: AssemblyInformationalVersion("2.4.9-rc.2+Branch.main.Sha.dd0798b60f6ecdeb776d453be3c8a7f41e3283a7.dd0798b60f6ecdeb776d453be3c8a7f41e3283a7")]
[assembly: AssemblyProduct("MahApps.Metro")]
[assembly: AssemblyTitle("MahApps.Metro")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/MahApps/MahApps.Metro.git")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
}
namespace MahApps.Metro
{
	internal class AppName
	{
		public const string MahApps = "MahApps.Metro";
	}
	[Serializable]
	public class MahAppsException : Exception
	{
		public MahAppsException()
		{
		}

		public MahAppsException(string message)
			: base(message)
		{
		}

		public MahAppsException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		protected MahAppsException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}
	}
}
namespace MahApps.Metro.ValueBoxes
{
	public static class BooleanBoxes
	{
		public static readonly object TrueBox = true;

		public static readonly object FalseBox = false;

		public static object Box(bool value)
		{
			if (!value)
			{
				return FalseBox;
			}
			return TrueBox;
		}
	}
}
namespace MahApps.Metro.Theming
{
	public class MahAppsLibraryThemeProvider : LibraryThemeProvider
	{
		public static readonly MahAppsLibraryThemeProvider DefaultInstance = new MahAppsLibraryThemeProvider();

		public MahAppsLibraryThemeProvider()
			: base(true)
		{
		}

		public override void FillColorSchemeValues(Dictionary<string, string> values, RuntimeThemeColorValues colorValues)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			Color val = colorValues.AccentBaseColor;
			values.Add("MahApps.Colors.AccentBase", ((object)(Color)(ref val)).ToString());
			val = colorValues.AccentColor80;
			values.Add("MahApps.Colors.Accent", ((object)(Color)(ref val)).ToString());
			val = colorValues.AccentColor60;
			values.Add("MahApps.Colors.Accent2", ((object)(Color)(ref val)).ToString());
			val = colorValues.AccentColor40;
			values.Add("MahApps.Colors.Accent3", ((object)(Color)(ref val)).ToString());
			val = colorValues.AccentColor20;
			values.Add("MahApps.Colors.Accent4", ((object)(Color)(ref val)).ToString());
			val = colorValues.HighlightColor;
			values.Add("MahApps.Colors.Highlight", ((object)(Color)(ref val)).ToString());
			val = colorValues.IdealForegroundColor;
			values.Add("MahApps.Colors.IdealForeground", ((object)(Color)(ref val)).ToString());
		}
	}
}
namespace MahApps.Metro.Markup
{
	[MarkupExtensionReturnType(typeof(object))]
	[Localizability(/*Could not decode attribute arguments.*/)]
	public class StaticResourceExtension : StaticResourceExtension
	{
		public StaticResourceExtension()
		{
		}

		public StaticResourceExtension(object resourceKey)
			: base(resourceKey)
		{
		}
	}
}
namespace MahApps.Metro.Lang
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class ColorNames
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("MahApps.Metro.Lang.ColorNames", typeof(ColorNames).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal ColorNames()
		{
		}
	}
}
namespace MahApps.Metro.Converters
{
	public class BackgroundToForegroundConverter : IValueConverter, IMultiValueConverter
	{
		private static BackgroundToForegroundConverter _instance;

		public static BackgroundToForegroundConverter Instance => _instance ?? (_instance = new BackgroundToForegroundConverter());

		static BackgroundToForegroundConverter()
		{
		}

		private BackgroundToForegroundConverter()
		{
		}

		private Color IdealTextColor(Color bg)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			int num = System.Convert.ToInt32((double)(int)((Color)(ref bg)).R * 0.299 + (double)(int)((Color)(ref bg)).G * 0.587 + (double)(int)((Color)(ref bg)).B * 0.114);
			return (255 - num < 86) ? Colors.Black : Colors.White;
		}

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			if (value is SolidColorBrush)
			{
				Color val = IdealTextColor(((SolidColorBrush)value).Color);
				SolidColorBrush val2 = new SolidColorBrush(val);
				((Freezable)val2).Freeze();
				return val2;
			}
			return Brushes.White;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}

		public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			Brush value = (Brush)((values.Length != 0) ? /*isinst with value type is only supported in some contexts*/: null);
			Brush val = (Brush)((values.Length > 1) ? /*isinst with value type is only supported in some contexts*/: null);
			if (val != null)
			{
				return val;
			}
			return Convert(value, targetType, parameter, culture);
		}

		public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
		{
			return targetTypes.Select((Type t) => DependencyProperty.UnsetValue).ToArray();
		}
	}
	[ValueConversion(typeof(double), typeof(double))]
	public class ClockDegreeConverter : IValueConverter
	{
		public double TotalParts { get; set; }

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value == null)
			{
				return 0;
			}
			if (value is DateTime dateTime)
			{
				return (string)parameter switch
				{
					"h" => 30.0 * dateTime.TimeOfDay.TotalHours, 
					"m" => 6.0 * dateTime.TimeOfDay.TotalMinutes, 
					"s" => 6.0 * (double)dateTime.TimeOfDay.Seconds, 
					_ => throw new ArgumentException("must be \"h\", \"m\", or \"s", "parameter"), 
				};
			}
			if (value is int)
			{
				return 360.0 / TotalParts * (double)(int)value;
			}
			return 360.0 / TotalParts * (double)value;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			throw new InvalidOperationException();
		}
	}
	public enum ColorChannelType
	{
		RMin,
		RMax,
		GMin,
		GMax,
		BMin,
		BMax,
		AMin,
		AMax
	}
	[ValueConversion(typeof(Color), typeof(Color))]
	public sealed class ColorChannelMinMaxConverter : IValueConverter
	{
		public static ColorChannelMinMaxConverter Default { get; }

		static ColorChannelMinMaxConverter()
		{
			Default = new ColorChannelMinMaxConverter();
		}

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			if (value is Color val && parameter is ColorChannelType colorChannelType)
			{
				switch (colorChannelType)
				{
				case ColorChannelType.RMin:
					return Color.FromRgb((byte)0, ((Color)(ref val)).G, ((Color)(ref val)).B);
				case ColorChannelType.RMax:
					return Color.FromRgb(byte.MaxValue, ((Color)(ref val)).G, ((Color)(ref val)).B);
				case ColorChannelType.GMin:
					return Color.FromRgb(((Color)(ref val)).R, (byte)0, ((Color)(ref val)).B);
				case ColorChannelType.GMax:
					return Color.FromRgb(((Color)(ref val)).R, byte.MaxValue, ((Color)(ref val)).B);
				case ColorChannelType.BMin:
					return Color.FromRgb(((Color)(ref val)).R, ((Color)(ref val)).G, (byte)0);
				case ColorChannelType.BMax:
					return Color.FromRgb(((Color)(ref val)).R, ((Color)(ref val)).G, byte.MaxValue);
				case ColorChannelType.AMin:
					return Color.FromArgb((byte)0, ((Color)(ref val)).R, ((Color)(ref val)).G, ((Color)(ref val)).B);
				case ColorChannelType.AMax:
					return Color.FromArgb(byte.MaxValue, ((Color)(ref val)).R, ((Color)(ref val)).G, ((Color)(ref val)).B);
				default:
					Trace.TraceWarning(string.Format("Unexpected value {0} = {1}", "parameter", colorChannelType));
					return Binding.DoNothing;
				}
			}
			return Binding.DoNothing;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			throw new NotImplementedException();
		}
	}
	[MarkupExtensionReturnType(typeof(ColorToNameConverter))]
	[ValueConversion(typeof(Color?), typeof(string))]
	public class ColorToNameConverter : MarkupMultiConverter
	{
		public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return ColorHelper.GetColorName(value as Color?, parameter as Dictionary<Color?, string>);
		}

		public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			Color? color = values?.FirstOrDefault((object x) => x?.GetType() == typeof(Color)) as Color?;
			Dictionary<Color?, string> colorNamesDictionary = values?.FirstOrDefault((object x) => x?.GetType() == typeof(Dictionary<Color?, string>)) as Dictionary<Color?, string>;
			return ColorHelper.GetColorName(color, colorNamesDictionary);
		}

		public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (value is string colorName)
			{
				Color? val = ColorHelper.ColorFromString(colorName, parameter as Dictionary<Color?, string>);
				if (!val.HasValue)
				{
					return Binding.DoNothing;
				}
				return val.GetValueOrDefault();
			}
			Trace.TraceError($"Unable to convert the provided value '{value}' to System.Windows.Media.Color");
			return Binding.DoNothing;
		}

		public override object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
		{
			throw new NotSupportedException();
		}
	}
	[ValueConversion(typeof(Color), typeof(SolidColorBrush))]
	public class ColorToSolidColorBrushConverter : IValueConverter
	{
		private static ColorToSolidColorBrushConverter defaultInstance;

		public static ColorToSolidColorBrushConverter DefaultInstance => defaultInstance ?? (defaultInstance = new ColorToSolidColorBrushConverter());

		public SolidColorBrush FallbackBrush { get; set; }

		public Color? FallbackColor { get; set; }

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			if (value is Color val)
			{
				SolidColorBrush val2 = new SolidColorBrush(val);
				((Freezable)val2).Freeze();
				return val2;
			}
			return FallbackBrush;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			SolidColorBrush val = (SolidColorBrush)((value is SolidColorBrush) ? value : null);
			return (val != null) ? new Color?(val.Color) : FallbackColor;
		}
	}
	[ValueConversion(typeof(CornerRadius), typeof(CornerRadius), ParameterType = typeof(RadiusType))]
	public class CornerRadiusBindingConverter : IValueConverter
	{
		public RadiusType IgnoreRadius { get; set; }

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			if (value is CornerRadius val)
			{
				RadiusType radiusType = IgnoreRadius;
				if (parameter is RadiusType radiusType2)
				{
					radiusType = radiusType2;
				}
				return radiusType switch
				{
					RadiusType.Left => (object)new CornerRadius(0.0, ((CornerRadius)(ref val)).TopRight, ((CornerRadius)(ref val)).BottomRight, 0.0), 
					RadiusType.Top => (object)new CornerRadius(0.0, 0.0, ((CornerRadius)(ref val)).BottomRight, ((CornerRadius)(ref val)).BottomLeft), 
					RadiusType.Right => (object)new CornerRadius(((CornerRadius)(ref val)).TopLeft, 0.0, 0.0, ((CornerRadius)(ref val)).BottomLeft), 
					RadiusType.Bottom => (object)new CornerRadius(((CornerRadius)(ref val)).TopLeft, ((CornerRadius)(ref val)).TopRight, 0.0, 0.0), 
					RadiusType.TopLeft => (object)new CornerRadius(0.0, ((CornerRadius)(ref val)).TopRight, ((CornerRadius)(ref val)).BottomRight, ((CornerRadius)(ref val)).BottomLeft), 
					RadiusType.TopRight => (object)new CornerRadius(((CornerRadius)(ref val)).TopLeft, 0.0, ((CornerRadius)(ref val)).BottomRight, ((CornerRadius)(ref val)).BottomLeft), 
					RadiusType.BottomRight => (object)new CornerRadius(((CornerRadius)(ref val)).TopLeft, ((CornerRadius)(ref val)).TopRight, 0.0, ((CornerRadius)(ref val)).BottomLeft), 
					RadiusType.BottomLeft => (object)new CornerRadius(((CornerRadius)(ref val)).TopLeft, ((CornerRadius)(ref val)).TopRight, ((CornerRadius)(ref val)).BottomRight, 0.0), 
					_ => val, 
				};
			}
			return (object)default(CornerRadius);
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	public class CornerRadiusFilterConverter : IValueConverter
	{
		public RadiusType Filter { get; set; }

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			if (value is CornerRadius val)
			{
				RadiusType radiusType = Filter;
				if (parameter is RadiusType radiusType2)
				{
					radiusType = radiusType2;
				}
				return radiusType switch
				{
					RadiusType.Left => (object)new CornerRadius(((CornerRadius)(ref val)).TopLeft, 0.0, 0.0, ((CornerRadius)(ref val)).BottomLeft), 
					RadiusType.Top => (object)new CornerRadius(((CornerRadius)(ref val)).TopLeft, ((CornerRadius)(ref val)).TopRight, 0.0, 0.0), 
					RadiusType.Right => (object)new CornerRadius(0.0, ((CornerRadius)(ref val)).TopRight, ((CornerRadius)(ref val)).BottomRight, 0.0), 
					RadiusType.Bottom => (object)new CornerRadius(0.0, 0.0, ((CornerRadius)(ref val)).BottomRight, ((CornerRadius)(ref val)).BottomLeft), 
					RadiusType.TopLeft => ((CornerRadius)(ref val)).TopLeft, 
					RadiusType.TopRight => ((CornerRadius)(ref val)).TopRight, 
					RadiusType.BottomRight => ((CornerRadius)(ref val)).BottomRight, 
					RadiusType.BottomLeft => ((CornerRadius)(ref val)).BottomLeft, 
					_ => val, 
				};
			}
			return Binding.DoNothing;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	public class FontSizeOffsetConverter : IValueConverter
	{
		private static FontSizeOffsetConverter _instance;

		public static FontSizeOffsetConverter Instance => _instance ?? (_instance = new FontSizeOffsetConverter());

		static FontSizeOffsetConverter()
		{
		}

		private FontSizeOffsetConverter()
		{
		}

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value is double && parameter is double num)
			{
				double num2 = (double)value;
				return Math.Round(num2 + num);
			}
			return value;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	[ValueConversion(typeof(object), typeof(object))]
	internal sealed class HamburgerMenuItemAccessibleConverter : IMultiValueConverter
	{
		internal static HamburgerMenuItemAccessibleConverter Default { get; } = new HamburgerMenuItemAccessibleConverter();


		public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			if (values == null)
			{
				return Binding.DoNothing;
			}
			string text = values.ElementAtOrDefault(1) as string;
			if (!string.IsNullOrEmpty(text))
			{
				return text;
			}
			string text2 = values.ElementAtOrDefault(0) as string;
			if (!string.IsNullOrEmpty(text2))
			{
				return text2;
			}
			return Binding.DoNothing;
		}

		public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
		{
			return targetTypes.Select((Type t) => Binding.DoNothing).ToArray();
		}
	}
	public enum HSVColorChannelType
	{
		SMin,
		SMax,
		VMin,
		VMax,
		SVMax
	}
	[ValueConversion(typeof(HSVColor), typeof(Color))]
	public sealed class HSVColorChannelMinMaxConverter : IValueConverter
	{
		public static HSVColorChannelMinMaxConverter Default { get; }

		static HSVColorChannelMinMaxConverter()
		{
			Default = new HSVColorChannelMinMaxConverter();
		}

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			if (value is HSVColor hSVColor && parameter is HSVColorChannelType hSVColorChannelType)
			{
				switch (hSVColorChannelType)
				{
				case HSVColorChannelType.SMin:
					return new HSVColor(hSVColor.Hue, 0.0, hSVColor.Value).ToColor();
				case HSVColorChannelType.SMax:
					return new HSVColor(hSVColor.Hue, 1.0, hSVColor.Value).ToColor();
				case HSVColorChannelType.VMin:
					return new HSVColor(hSVColor.Hue, hSVColor.Saturation, 0.0).ToColor();
				case HSVColorChannelType.VMax:
					return new HSVColor(hSVColor.Hue, hSVColor.Saturation, 1.0).ToColor();
				case HSVColorChannelType.SVMax:
					return new HSVColor(hSVColor.Hue, 1.0, 1.0).ToColor();
				default:
					Trace.TraceWarning(string.Format("Unexpected value {0} = {1}", "parameter", hSVColorChannelType));
					return Binding.DoNothing;
				}
			}
			return Binding.DoNothing;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			throw new NotImplementedException();
		}
	}
	public sealed class IsNullConverter : IValueConverter
	{
		private static IsNullConverter _instance;

		public static IsNullConverter Instance => _instance ?? (_instance = new IsNullConverter());

		static IsNullConverter()
		{
		}

		private IsNullConverter()
		{
		}

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return value == null;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return Binding.DoNothing;
		}
	}
	[MarkupExtensionReturnType(typeof(IValueConverter))]
	public abstract class MarkupConverter : MarkupExtension, IValueConverter
	{
		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return this;
		}

		protected abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture);

		protected abstract object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture);

		object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			try
			{
				return Convert(value, targetType, parameter, culture);
			}
			catch
			{
				return DependencyProperty.UnsetValue;
			}
		}

		object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			try
			{
				return ConvertBack(value, targetType, parameter, culture);
			}
			catch
			{
				return DependencyProperty.UnsetValue;
			}
		}
	}
	[MarkupExtensionReturnType(typeof(MarkupMultiConverter))]
	public abstract class MarkupMultiConverter : MarkupExtension, IValueConverter, IMultiValueConverter
	{
		public abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture);

		public abstract object Convert(object[] values, Type targetType, object parameter, CultureInfo culture);

		public abstract object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture);

		public abstract object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture);

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return this;
		}
	}
	public enum MathOperation
	{
		Add,
		Subtract,
		Multiply,
		Divide
	}
	[ValueConversion(typeof(object), typeof(object))]
	public sealed class MathConverter : IValueConverter, IMultiValueConverter
	{
		public MathOperation Operation { get; set; }

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DoConvert(value, parameter, Operation);
		}

		public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			if (values != null)
			{
				return DoConvert(values.ElementAtOrDefault(0), values.ElementAtOrDefault(1), Operation);
			}
			return Binding.DoNothing;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}

		public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
		{
			return targetTypes.Select((Type t) => DependencyProperty.UnsetValue).ToArray();
		}

		private static object DoConvert(object firstValue, object secondValue, MathOperation operation)
		{
			if (firstValue == null || secondValue == null || firstValue == DependencyProperty.UnsetValue || secondValue == DependencyProperty.UnsetValue || firstValue == DBNull.Value || secondValue == DBNull.Value)
			{
				return Binding.DoNothing;
			}
			try
			{
				double valueOrDefault = (firstValue as double?).GetValueOrDefault(System.Convert.ToDouble(firstValue, CultureInfo.InvariantCulture));
				double valueOrDefault2 = (secondValue as double?).GetValueOrDefault(System.Convert.ToDouble(secondValue, CultureInfo.InvariantCulture));
				switch (operation)
				{
				case MathOperation.Add:
					return valueOrDefault + valueOrDefault2;
				case MathOperation.Divide:
					if (valueOrDefault2 > 0.0)
					{
						return valueOrDefault / valueOrDefault2;
					}
					Trace.TraceWarning($"Second value can not be used by division, because it's '0' (value1={valueOrDefault}, value2={valueOrDefault2})");
					return Binding.DoNothing;
				case MathOperation.Multiply:
					return valueOrDefault * valueOrDefault2;
				case MathOperation.Subtract:
					return valueOrDefault - valueOrDefault2;
				default:
					return Binding.DoNothing;
				}
			}
			catch (Exception ex)
			{
				Trace.TraceError($"Error while math operation: operation={operation}, value1={firstValue}, value2={secondValue} => exception: {ex}");
				return Binding.DoNothing;
			}
		}
	}
	[MarkupExtensionReturnType(typeof(MathAddConverter))]
	public sealed class MathAddConverter : MarkupMultiConverter
	{
		private static readonly MathConverter MathConverter = new MathConverter
		{
			Operation = MathOperation.Add
		};

		public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.Convert(values, targetType, parameter, culture);
		}

		public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.Convert(value, targetType, parameter, culture);
		}

		public override object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
		{
			return MathConverter.ConvertBack(value, targetTypes, parameter, culture);
		}

		public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.ConvertBack(value, targetType, parameter, culture);
		}
	}
	[MarkupExtensionReturnType(typeof(MathSubtractConverter))]
	public sealed class MathSubtractConverter : MarkupMultiConverter
	{
		private static readonly MathConverter MathConverter = new MathConverter
		{
			Operation = MathOperation.Subtract
		};

		public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.Convert(values, targetType, parameter, culture);
		}

		public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.Convert(value, targetType, parameter, culture);
		}

		public override object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
		{
			return MathConverter.ConvertBack(value, targetTypes, parameter, culture);
		}

		public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.ConvertBack(value, targetType, parameter, culture);
		}
	}
	[MarkupExtensionReturnType(typeof(MathMultiplyConverter))]
	public sealed class MathMultiplyConverter : MarkupMultiConverter
	{
		private static readonly MathConverter MathConverter = new MathConverter
		{
			Operation = MathOperation.Multiply
		};

		public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.Convert(values, targetType, parameter, culture);
		}

		public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.Convert(value, targetType, parameter, culture);
		}

		public override object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
		{
			return MathConverter.ConvertBack(value, targetTypes, parameter, culture);
		}

		public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.ConvertBack(value, targetType, parameter, culture);
		}
	}
	[MarkupExtensionReturnType(typeof(MathDivideConverter))]
	public sealed class MathDivideConverter : MarkupMultiConverter
	{
		private static readonly MathConverter MathConverter = new MathConverter
		{
			Operation = MathOperation.Divide
		};

		public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.Convert(values, targetType, parameter, culture);
		}

		public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.Convert(value, targetType, parameter, culture);
		}

		public override object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
		{
			return MathConverter.ConvertBack(value, targetTypes, parameter, culture);
		}

		public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return MathConverter.ConvertBack(value, targetType, parameter, culture);
		}
	}
	public class MetroTabItemCloseButtonWidthConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return (double)System.Convert.ToInt32(value) * 0.5;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	public class NullToUnsetValueConverter : MarkupConverter
	{
		private static NullToUnsetValueConverter _instance;

		static NullToUnsetValueConverter()
		{
		}

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return _instance ?? (_instance = new NullToUnsetValueConverter());
		}

		protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return value ?? DependencyProperty.UnsetValue;
		}

		protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	[ValueConversion(typeof(double), typeof(GridLength))]
	public sealed class PercentageToGridLengthConverter : IValueConverter
	{
		public static PercentageToGridLengthConverter Default { get; }

		static PercentageToGridLengthConverter()
		{
			Default = new PercentageToGridLengthConverter();
		}

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (value is double num)
			{
				if (parameter as string == bool.TrueString)
				{
					num = 1.0 - num;
				}
				return (object)new GridLength(num, (GridUnitType)2);
			}
			return Binding.DoNothing;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			throw new NotImplementedException();
		}
	}
	public enum RadiusType
	{
		None,
		Left,
		Top,
		Right,
		Bottom,
		TopLeft,
		TopRight,
		BottomRight,
		BottomLeft
	}
	public sealed class ResizeModeMinMaxButtonVisibilityConverter : IMultiValueConverter
	{
		private static ResizeModeMinMaxButtonVisibilityConverter _instance;

		public static ResizeModeMinMaxButtonVisibilityConverter Instance => _instance ?? (_instance = new ResizeModeMinMaxButtonVisibilityConverter());

		static ResizeModeMinMaxButtonVisibilityConverter()
		{
		}

		private ResizeModeMinMaxButtonVisibilityConverter()
		{
		}

		public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected I4, but got Unknown
			string text = parameter as string;
			if (values != null && !string.IsNullOrEmpty(text))
			{
				bool flag = values.Length != 0 && (bool)values[0];
				bool flag2 = values.Length > 1 && (bool)values[1];
				ResizeMode val = (ResizeMode)((values.Length <= 2) ? 2 : ((int)(ResizeMode)values[2]));
				if (text == "CLOSE")
				{
					return (object)(Visibility)((flag2 || !flag) ? 2 : 0);
				}
				switch ((int)val)
				{
				case 0:
					return (object)(Visibility)2;
				case 1:
					if (text == "MIN")
					{
						return (object)(Visibility)((flag2 || !flag) ? 2 : 0);
					}
					return (object)(Visibility)2;
				default:
					return (object)(Visibility)((flag2 || !flag) ? 2 : 0);
				}
			}
			return (object)(Visibility)0;
		}

		public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
		{
			return targetTypes.Select((Type t) => DependencyProperty.UnsetValue).ToArray();
		}
	}
	[ValueConversion(typeof(double), typeof(CornerRadius))]
	[MarkupExtensionReturnType(typeof(SizeToCornerRadiusConverter))]
	public class SizeToCornerRadiusConverter : MarkupConverter
	{
		protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			return (object)((value is double num) ? new CornerRadius(num / 2.0) : default(CornerRadius));
		}

		protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return Binding.DoNothing;
		}

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return this;
		}
	}
	[ValueConversion(typeof(string), typeof(Visibility))]
	[MarkupExtensionReturnType(typeof(StringToVisibilityConverter))]
	public class StringToVisibilityConverter : MarkupExtension, IValueConverter
	{
		public Visibility FalseEquivalent { get; set; }

		public bool OppositeStringValue { get; set; }

		public StringToVisibilityConverter()
		{
			FalseEquivalent = (Visibility)2;
			OppositeStringValue = false;
		}

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return new StringToVisibilityConverter
			{
				FalseEquivalent = FalseEquivalent,
				OppositeStringValue = OppositeStringValue
			};
		}

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if ((value == null || value is string) && targetType == typeof(Visibility))
			{
				if (OppositeStringValue)
				{
					return (object)(Visibility)((!string.IsNullOrEmpty((string)value)) ? ((int)FalseEquivalent) : 0);
				}
				return (object)(Visibility)(string.IsNullOrEmpty((string)value) ? ((int)FalseEquivalent) : 0);
			}
			return value;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (value is Visibility)
			{
				if (OppositeStringValue)
				{
					if ((int)(Visibility)value != 0)
					{
						return "visible";
					}
					return string.Empty;
				}
				if ((int)(Visibility)value != 0)
				{
					return string.Empty;
				}
				return "visible";
			}
			return value;
		}
	}
	[ValueConversion(typeof(Thickness), typeof(Thickness), ParameterType = typeof(ThicknessSideType))]
	public class ThicknessBindingConverter : IValueConverter
	{
		public ThicknessSideType IgnoreThicknessSide { get; set; }

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			if (value is Thickness val)
			{
				ThicknessSideType thicknessSideType = IgnoreThicknessSide;
				if (parameter is ThicknessSideType thicknessSideType2)
				{
					thicknessSideType = thicknessSideType2;
				}
				return thicknessSideType switch
				{
					ThicknessSideType.Left => (object)new Thickness(0.0, ((Thickness)(ref val)).Top, ((Thickness)(ref val)).Right, ((Thickness)(ref val)).Bottom), 
					ThicknessSideType.Top => (object)new Thickness(((Thickness)(ref val)).Left, 0.0, ((Thickness)(ref val)).Right, ((Thickness)(ref val)).Bottom), 
					ThicknessSideType.Right => (object)new Thickness(((Thickness)(ref val)).Left, ((Thickness)(ref val)).Top, 0.0, ((Thickness)(ref val)).Bottom), 
					ThicknessSideType.Bottom => (object)new Thickness(((Thickness)(ref val)).Left, ((Thickness)(ref val)).Top, ((Thickness)(ref val)).Right, 0.0), 
					_ => val, 
				};
			}
			return (object)default(Thickness);
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	public enum ThicknessSideType
	{
		None,
		Left,
		Top,
		Right,
		Bottom
	}
	[ValueConversion(typeof(Thickness), typeof(double), ParameterType = typeof(ThicknessSideType))]
	public class ThicknessToDoubleConverter : IValueConverter
	{
		public ThicknessSideType TakeThicknessSide { get; set; }

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (value is Thickness val)
			{
				ThicknessSideType thicknessSideType = TakeThicknessSide;
				if (parameter is ThicknessSideType thicknessSideType2)
				{
					thicknessSideType = thicknessSideType2;
				}
				return thicknessSideType switch
				{
					ThicknessSideType.Left => ((Thickness)(ref val)).Left, 
					ThicknessSideType.Top => ((Thickness)(ref val)).Top, 
					ThicknessSideType.Right => ((Thickness)(ref val)).Right, 
					ThicknessSideType.Bottom => ((Thickness)(ref val)).Bottom, 
					_ => 0.0, 
				};
			}
			return 0.0;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	[ValueConversion(typeof(TimeSpan?), typeof(string))]
	internal class TimeSpanToStringConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			TimeSpan? timeSpan = value as TimeSpan?;
			if (!timeSpan.HasValue)
			{
				return null;
			}
			return DateTime.MinValue.Add(timeSpan.GetValueOrDefault()).ToString(culture.DateTimeFormat.LongTimePattern, culture);
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (DateTime.TryParseExact(value.ToString(), culture.DateTimeFormat.LongTimePattern, culture, DateTimeStyles.None, out var result))
			{
				return result.TimeOfDay;
			}
			return null;
		}
	}
	[MarkupExtensionReturnType(typeof(ToLowerConverter))]
	public class ToLowerConverter : MarkupConverter
	{
		private static ToLowerConverter _instance;

		static ToLowerConverter()
		{
		}

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return _instance ?? (_instance = new ToLowerConverter());
		}

		protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (!(value is string text))
			{
				return value;
			}
			return text.ToLower(culture);
		}

		protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return Binding.DoNothing;
		}
	}
	[MarkupExtensionReturnType(typeof(ToUpperConverter))]
	public class ToUpperConverter : MarkupConverter
	{
		private static ToUpperConverter _instance;

		static ToUpperConverter()
		{
		}

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return _instance ?? (_instance = new ToUpperConverter());
		}

		protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (!(value is string text))
			{
				return value;
			}
			return text.ToUpper(culture);
		}

		protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return Binding.DoNothing;
		}
	}
	public class TreeViewMarginConverter : IValueConverter
	{
		public double Length { get; set; }

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			TreeViewItem val = (TreeViewItem)((value is TreeViewItem) ? value : null);
			if (val == null)
			{
				return (object)new Thickness(0.0);
			}
			return (object)new Thickness(Length * (double)val.GetDepth(), 0.0, 0.0, 0.0);
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	public static class TreeViewItemExtensions
	{
		public static int GetDepth(this TreeViewItem item)
		{
			return ((DependencyObject)(object)item).GetAncestors().TakeWhile((DependencyObject e) => !(e is TreeView)).OfType<TreeViewItem>()
				.Count();
		}
	}
}
namespace MahApps.Metro.Controls
{
	[TemplatePart(Name = "PART_BadgeContainer", Type = typeof(UIElement))]
	public class Badged : BadgedEx
	{
		public static readonly DependencyProperty BadgeChangedStoryboardProperty;

		public Storyboard BadgeChangedStoryboard
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Storyboard)((DependencyObject)this).GetValue(BadgeChangedStoryboardProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BadgeChangedStoryboardProperty, (object)value);
			}
		}

		static Badged()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			BadgeChangedStoryboardProperty = DependencyProperty.Register("BadgeChangedStoryboard", typeof(Storyboard), typeof(Badged), new PropertyMetadata((object)null));
			FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(Badged), (PropertyMetadata)new FrameworkPropertyMetadata((object)typeof(Badged)));
		}

		public override void OnApplyTemplate()
		{
			((BadgedEx)this).BadgeChanged -= OnBadgeChanged;
			((BadgedEx)this).OnApplyTemplate();
			((BadgedEx)this).BadgeChanged += OnBadgeChanged;
		}

		private void OnBadgeChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
		{
			Storyboard badgeChangedStoryboard = BadgeChangedStoryboard;
			if (base._badgeContainer != null && badgeChangedStoryboard != null)
			{
				try
				{
					base._badgeContainer.BeginStoryboard(badgeChangedStoryboard);
				}
				catch (Exception innerException)
				{
					throw new MahAppsException("Uups, it seems like there is something wrong with the given Storyboard.", innerException);
				}
			}
		}
	}
	public enum ButtonsAlignment
	{
		Left,
		Right,
		Opposite
	}
	public sealed class ClipBorder : Decorator
	{
		private struct BorderInfo
		{
			internal readonly double LeftTop;

			internal readonly double TopLeft;

			internal readonly double TopRight;

			internal readonly double RightTop;

			internal readonly double RightBottom;

			internal readonly double BottomRight;

			internal readonly double BottomLeft;

			internal readonly double LeftBottom;

			internal BorderInfo(CornerRadius corners, Thickness borders, Thickness padding, bool isOuterBorder)
			{
				double num = 0.5 * ((Thickness)(ref borders)).Left + ((Thickness)(ref padding)).Left;
				double num2 = 0.5 * ((Thickness)(ref borders)).Top + ((Thickness)(ref padding)).Top;
				double num3 = 0.5 * ((Thickness)(ref borders)).Right + ((Thickness)(ref padding)).Right;
				double num4 = 0.5 * ((Thickness)(ref borders)).Bottom + ((Thickness)(ref padding)).Bottom;
				if (isOuterBorder)
				{
					if (((CornerRadius)(ref corners)).TopLeft.IsZero())
					{
						LeftTop = (TopLeft = 0.0);
					}
					else
					{
						LeftTop = ((CornerRadius)(ref corners)).TopLeft + num;
						TopLeft = ((CornerRadius)(ref corners)).TopLeft + num2;
					}
					if (((CornerRadius)(ref corners)).TopRight.IsZero())
					{
						TopRight = (RightTop = 0.0);
					}
					else
					{
						TopRight = ((CornerRadius)(ref corners)).TopRight + num2;
						RightTop = ((CornerRadius)(ref corners)).TopRight + num3;
					}
					if (((CornerRadius)(ref corners)).BottomRight.IsZero())
					{
						RightBottom = (BottomRight = 0.0);
					}
					else
					{
						RightBottom = ((CornerRadius)(ref corners)).BottomRight + num3;
						BottomRight = ((CornerRadius)(ref corners)).BottomRight + num4;
					}
					if (((CornerRadius)(ref corners)).BottomLeft.IsZero())
					{
						BottomLeft = (LeftBottom = 0.0);
						return;
					}
					BottomLeft = ((CornerRadius)(ref corners)).BottomLeft + num4;
					LeftBottom = ((CornerRadius)(ref corners)).BottomLeft + num;
				}
				else
				{
					LeftTop = Math.Max(0.0, ((CornerRadius)(ref corners)).TopLeft - num);
					TopLeft = Math.Max(0.0, ((CornerRadius)(ref corners)).TopLeft - num2);
					TopRight = Math.Max(0.0, ((CornerRadius)(ref corners)).TopRight - num2);
					RightTop = Math.Max(0.0, ((CornerRadius)(ref corners)).TopRight - num3);
					RightBottom = Math.Max(0.0, ((CornerRadius)(ref corners)).BottomRight - num3);
					BottomRight = Math.Max(0.0, ((CornerRadius)(ref corners)).BottomRight - num4);
					BottomLeft = Math.Max(0.0, ((CornerRadius)(ref corners)).BottomLeft - num4);
					LeftBottom = Math.Max(0.0, ((CornerRadius)(ref corners)).BottomLeft - num);
				}
			}
		}

		private StreamGeometry _backgroundGeometryCache;

		private StreamGeometry _borderGeometryCache;

		public static readonly DependencyProperty BorderThicknessProperty = DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(ClipBorder), (PropertyMetadata)new FrameworkPropertyMetadata((object)default(Thickness), (FrameworkPropertyMetadataOptions)17), new ValidateValueCallback(OnValidateThickness));

		public static readonly DependencyProperty PaddingProperty = DependencyProperty.Register("Padding", typeof(Thickness), typeof(ClipBorder), (PropertyMetadata)new FrameworkPropertyMetadata((object)default(Thickness), (FrameworkPropertyMetadataOptions)17), new ValidateValueCallback(OnValidateThickness));

		public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(ClipBorder), (PropertyMetadata)new FrameworkPropertyMetadata((object)default(CornerRadius), (FrameworkPropertyMetadataOptions)17), new ValidateValueCallback(OnValidateCornerRadius));

		public static readonly DependencyProperty BorderBrushProperty = DependencyProperty.Register("BorderBrush", typeof(Brush), typeof(ClipBorder), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)2064));

		public static readonly DependencyProperty BackgroundProperty = DependencyProperty.Register("Background", typeof(Brush), typeof(ClipBorder), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)2064));

		public static readonly DependencyProperty OptimizeClipRenderingProperty = DependencyProperty.Register("OptimizeClipRendering", typeof(bool), typeof(ClipBorder), (PropertyMetadata)new FrameworkPropertyMetadata(BooleanBoxes.FalseBox, (FrameworkPropertyMetadataOptions)16));

		public Thickness BorderThickness
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return (Thickness)((DependencyObject)this).GetValue(BorderThicknessProperty);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((DependencyObject)this).SetValue(BorderThicknessProperty, (object)value);
			}
		}

		public Thickness Padding
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return (Thickness)((DependencyObject)this).GetValue(PaddingProperty);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((DependencyObject)this).SetValue(PaddingProperty, (object)value);
			}
		}

		public CornerRadius CornerRadius
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return (CornerRadius)((DependencyObject)this).GetValue(CornerRadiusProperty);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((DependencyObject)this).SetValue(CornerRadiusProperty, (object)value);
			}
		}

		public Brush BorderBrush
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Brush)((DependencyObject)this).GetValue(BorderBrushProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BorderBrushProperty, (object)value);
			}
		}

		public Brush Background
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Brush)((DependencyObject)this).GetValue(BackgroundProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(BackgroundProperty, (object)value);
			}
		}

		public bool OptimizeClipRendering
		{
			get
			{
				return (bool)((DependencyObject)this).GetValue(OptimizeClipRenderingProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(OptimizeClipRenderingProperty, BooleanBoxes.Box(value));
			}
		}

		private static bool OnValidateThickness(object value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Thickness thick = (Thickness)value;
			return thick.IsValid(allowNegative: false, allowNaN: false, allowPositiveInfinity: false, allowNegativeInfinity: false);
		}

		private static bool OnValidateCornerRadius(object value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			CornerRadius corner = (CornerRadius)value;
			return corner.IsValid(allowNegative: false, allowNaN: false, allowPositiveInfinity: false, allowNegativeInfinity: false);
		}

		protected override Size MeasureOverride(Size constraint)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			UIElement child = ((Decorator)this).Child;
			Size result = default(Size);
			Thickness borderThickness = BorderThickness;
			Size val = borderThickness.CollapseThickness();
			Size val2 = Padding.CollapseThickness();
			if (child != null)
			{
				Size val3 = default(Size);
				((Size)(ref val3))..ctor(((Size)(ref val)).Width + ((Size)(ref val2)).Width, ((Size)(ref val)).Height + ((Size)(ref val2)).Height);
				Size val4 = default(Size);
				((Size)(ref val4))..ctor(Math.Max(0.0, ((Size)(ref constraint)).Width - ((Size)(ref val3)).Width), Math.Max(0.0, ((Size)(ref constraint)).Height - ((Size)(ref val3)).Height));
				child.Measure(val4);
				Size desiredSize = child.DesiredSize;
				((Size)(ref result)).Width = ((Size)(ref desiredSize)).Width + ((Size)(ref val3)).Width;
				((Size)(ref result)).Height = ((Size)(ref desiredSize)).Height + ((Size)(ref val3)).Height;
			}
			else
			{
				((Size)(ref result))..ctor(((Size)(ref val)).Width + ((Size)(ref val2)).Width, ((Size)(ref val)).Height + ((Size)(ref val2)).Height);
			}
			return result;
		}

		protected override Size ArrangeOverride(Size finalSize)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Expected O, but got Unknown
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			Thickness borderThickness = BorderThickness;
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(finalSize);
			Rect rect2 = rect.Deflate(borderThickness);
			CornerRadius cornerRadius = CornerRadius;
			Thickness padding = Padding;
			Rect val = rect2.Deflate(padding);
			if (!((Rect)(ref rect)).Width.IsZero() && !((Rect)(ref rect)).Height.IsZero())
			{
				BorderInfo borderInfo = new BorderInfo(cornerRadius, borderThickness, default(Thickness), isOuterBorder: true);
				StreamGeometry val2 = new StreamGeometry();
				StreamGeometryContext val3 = val2.Open();
				try
				{
					GenerateGeometry(val3, rect, borderInfo);
				}
				finally
				{
					((IDisposable)val3)?.Dispose();
				}
				((Freezable)val2).Freeze();
				_borderGeometryCache = val2;
			}
			else
			{
				_borderGeometryCache = null;
			}
			if (!((Rect)(ref rect2)).Width.IsZero() && !((Rect)(ref rect2)).Height.IsZero())
			{
				BorderInfo borderInfo2 = new BorderInfo(cornerRadius, borderThickness, default(Thickness), isOuterBorder: false);
				StreamGeometry val4 = new StreamGeometry();
				StreamGeometryContext val5 = val4.Open();
				try
				{
					GenerateGeometry(val5, rect2, borderInfo2);
				}
				finally
				{
					((IDisposable)val5)?.Dispose();
				}
				((Freezable)val4).Freeze();
				_backgroundGeometryCache = val4;
			}
			else
			{
				_backgroundGeometryCache = null;
			}
			UIElement child = ((Decorator)this).Child;
			if (child != null)
			{
				child.Arrange(val);
				StreamGeometry val6 = new StreamGeometry();
				BorderInfo borderInfo3 = new BorderInfo(cornerRadius, borderThickness, padding, isOuterBorder: false);
				StreamGeometryContext val7 = val6.Open();
				try
				{
					GenerateGeometry(val7, new Rect(0.0, 0.0, ((Rect)(ref val)).Width, ((Rect)(ref val)).Height), borderInfo3);
				}
				finally
				{
					((IDisposable)val7)?.Dispose();
				}
				((Freezable)val6).Freeze();
				child.Clip = (Geometry)(object)val6;
			}
			return finalSize;
		}

		protected override void OnRender(DrawingContext dc)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			Thickness borderThickness = BorderThickness;
			Brush borderBrush = BorderBrush;
			Brush background = Background;
			StreamGeometry borderGeometryCache = _borderGeometryCache;
			StreamGeometry backgroundGeometryCache = _backgroundGeometryCache;
			if (OptimizeClipRendering)
			{
				dc.DrawGeometry(borderBrush, (Pen)null, (Geometry)(object)borderGeometryCache);
				return;
			}
			if (borderBrush != null && !borderThickness.IsZero() && background != null)
			{
				if (borderBrush.IsEqualTo(background))
				{
					dc.DrawGeometry(borderBrush, (Pen)null, (Geometry)(object)borderGeometryCache);
				}
				else if (borderBrush.IsOpaqueSolidColorBrush() && background.IsOpaqueSolidColorBrush())
				{
					dc.DrawGeometry(borderBrush, (Pen)null, (Geometry)(object)borderGeometryCache);
					dc.DrawGeometry(background, (Pen)null, (Geometry)(object)backgroundGeometryCache);
				}
				else if (borderBrush.IsOpaqueSolidColorBrush())
				{
					if (borderGeometryCache != null && backgroundGeometryCache != null)
					{
						PathGeometry outlinedPathGeometry = ((Geometry)borderGeometryCache).GetOutlinedPathGeometry();
						PathGeometry outlinedPathGeometry2 = ((Geometry)backgroundGeometryCache).GetOutlinedPathGeometry();
						PathGeometry val = Geometry.Combine((Geometry)(object)outlinedPathGeometry, (Geometry)(object)outlinedPathGeometry2, (GeometryCombineMode)3, (Transform)null);
						dc.DrawGeometry(background, (Pen)null, (Geometry)(object)borderGeometryCache);
						dc.DrawGeometry(borderBrush, (Pen)null, (Geometry)(object)val);
					}
				}
				else if (borderGeometryCache != null && backgroundGeometryCache != null)
				{
					PathGeometry outlinedPathGeometry3 = ((Geometry)borderGeometryCache).GetOutlinedPathGeometry();
					PathGeometry outlinedPathGeometry4 = ((Geometry)backgroundGeometryCache).GetOutlinedPathGeometry();
					PathGeometry val2 = Geometry.Combine((Geometry)(object)outlinedPathGeometry3, (Geometry)(object)outlinedPathGeometry4, (GeometryCombineMode)3, (Transform)null);
					dc.DrawGeometry(borderBrush, (Pen)null, (Geometry)(object)val2);
					dc.DrawGeometry(background, (Pen)null, (Geometry)(object)backgroundGeometryCache);
				}
				return;
			}
			if (borderBrush != null && !borderThickness.IsZero())
			{
				if (borderGeometryCache != null && backgroundGeometryCache != null)
				{
					PathGeometry outlinedPathGeometry5 = ((Geometry)borderGeometryCache).GetOutlinedPathGeometry();
					PathGeometry outlinedPathGeometry6 = ((Geometry)backgroundGeometryCache).GetOutlinedPathGeometry();
					PathGeometry val3 = Geometry.Combine((Geometry)(object)outlinedPathGeometry5, (Geometry)(object)outlinedPathGeometry6, (GeometryCombineMode)3, (Transform)null);
					dc.DrawGeometry(borderBrush, (Pen)null, (Geometry)(object)val3);
				}
				else
				{
					dc.DrawGeometry(borderBrush, (Pen)null, (Geometry)(object)borderGeometryCache);
				}
			}
			if (background != null)
			{
				dc.DrawGeometry(background, (Pen)null, (Geometry)(object)backgroundGeometryCache);
			}
		}

		private static void GenerateGeometry(StreamGeometryContext ctx, Rect rect, BorderInfo borderInfo)
		{
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			Point val = default(Point);
			((Point)(ref val))..ctor(borderInfo.LeftTop, 0.0);
			Point val2 = default(Point);
			((Point)(ref val2))..ctor(((Rect)(ref rect)).Width - borderInfo.RightTop, 0.0);
			Point val3 = default(Point);
			((Point)(ref val3))..ctor(((Rect)(ref rect)).Width, borderInfo.TopRight);
			Point val4 = default(Point);
			((Point)(ref val4))..ctor(((Rect)(ref rect)).Width, ((Rect)(ref rect)).Height - borderInfo.BottomRight);
			Point val5 = default(Point);
			((Point)(ref val5))..ctor(((Rect)(ref rect)).Width - borderInfo.RightBottom, ((Rect)(ref rect)).Height);
			Point val6 = default(Point);
			((Point)(ref val6))..ctor(borderInfo.LeftBottom, ((Rect)(ref rect)).Height);
			Point val7 = default(Point);
			((Point)(ref val7))..ctor(0.0, ((Rect)(ref rect)).Height - borderInfo.BottomLeft);
			Point val8 = default(Point);
			((Point)(ref val8))..ctor(0.0, borderInfo.TopLeft);
			if (((Point)(ref val)).X > ((Point)(ref val2)).X)
			{
				double x = (((Point)(ref val)).X = borderInfo.LeftTop / (borderInfo.LeftTop + borderInfo.RightTop) * ((Rect)(ref rect)).Width);
				((Point)(ref val2)).X = x;
			}
			if (((Point)(ref val3)).Y > ((Point)(ref val4)).Y)
			{
				double y = (((Point)(ref val3)).Y = borderInfo.TopRight / (borderInfo.TopRight + borderInfo.BottomRight) * ((Rect)(ref rect)).Height);
				((Point)(ref val4)).Y = y;
			}
			if (((Point)(ref val6)).X > ((Point)(ref val5)).X)
			{
				double x2 = (((Point)(ref val5)).X = borderInfo.LeftBottom / (borderInfo.LeftBottom + borderInfo.RightBottom) * ((Rect)(ref rect)).Width);
				((Point)(ref val6)).X = x2;
			}
			if (((Point)(ref val8)).Y > ((Point)(ref val7)).Y)
			{
				double y2 = (((Point)(ref val7)).Y = borderInfo.TopLeft / (borderInfo.TopLeft + borderInfo.BottomLeft) * ((Rect)(ref rect)).Height);
				((Point)(ref val8)).Y = y2;
			}
			Point val9 = ((Rect)(ref rect)).TopLeft;
			double x3 = ((Point)(ref val9)).X;
			val9 = ((Rect)(ref rect)).TopLeft;
			double y3 = ((Point)(ref val9)).Y;
			Vector val10 = default(Vector);
			((Vector)(ref val10))..ctor(x3, y3);
			val += val10;
			val2 += val10;
			val3 += val10;
			val4 += val10;
			val5 += val10;
			val6 += val10;
			val7 += val10;
			val8 += val10;
			ctx.BeginFigure(val, true, true);
			ctx.LineTo(val2, true, false);
			val9 = ((Rect)(ref rect)).TopRight;
			double num5 = ((Point)(ref val9)).X - ((Point)(ref val2)).X;
			double y4 = ((Point)(ref val3)).Y;
			val9 = ((Rect)(ref rect)).TopRight;
			double num6 = y4 - ((Point)(ref val9)).Y;
			if (!num5.IsZero() || !num6.IsZero())
			{
				ctx.ArcTo(val3, new Size(num5, num6), 0.0, false, (SweepDirection)1, true, false);
			}
			ctx.LineTo(val4, true, false);
			val9 = ((Rect)(ref rect)).BottomRight;
			num5 = ((Point)(ref val9)).X - ((Point)(ref val5)).X;
			val9 = ((Rect)(ref rect)).BottomRight;
			num6 = ((Point)(ref val9)).Y - ((Point)(ref val4)).Y;
			if (!num5.IsZero() || !num6.IsZero())
			{
				ctx.ArcTo(val5, new Size(num5, num6), 0.0, false, (SweepDirection)1, true, false);
			}
			ctx.LineTo(val6, true, false);
			double x4 = ((Point)(ref val6)).X;
			val9 = ((Rect)(ref rect)).BottomLeft;
			num5 = x4 - ((Point)(ref val9)).X;
			val9 = ((Rect)(ref rect)).BottomLeft;
			num6 = ((Point)(ref val9)).Y - ((Point)(ref val7)).Y;
			if (!num5.IsZero() || !num6.IsZero())
			{
				ctx.ArcTo(val7, new Size(num5, num6), 0.0, false, (SweepDirection)1, true, false);
			}
			ctx.LineTo(val8, true, false);
			double x5 = ((Point)(ref val)).X;
			val9 = ((Rect)(ref rect)).TopLeft;
			num5 = x5 - ((Point)(ref val9)).X;
			double y5 = ((Point)(ref val8)).Y;
			val9 = ((Rect)(ref rect)).TopLeft;
			num6 = y5 - ((Point)(ref val9)).Y;
			if (!num5.IsZero() || !num6.IsZero())
			{
				ctx.ArcTo(val, new Size(num5, num6), 0.0, false, (SweepDirection)1, true, false);
			}
		}
	}
	public static class Utils
	{
		[StructLayout(LayoutKind.Explicit)]
		private struct NanUnion
		{
			[FieldOffset(0)]
			internal double DoubleValue;

			[FieldOffset(0)]
			internal ulong UintValue;
		}

		internal const double DBL_EPSILON = 2.220446049250313E-16;

		internal const float FLT_MIN = 1.1754944E-38f;

		public static bool IsCloseTo(this double value1, double value2)
		{
			if (value1 == value2)
			{
				return true;
			}
			double num = (Math.Abs(value1) + Math.Abs(value2) + 10.0) * 2.220446049250313E-16;
			double num2 = value1 - value2;
			if (0.0 - num < num2)
			{
				return num > num2;
			}
			return false;
		}

		public static bool IsLessThan(double value1, double value2)
		{
			if (value1 < value2)
			{
				return !value1.IsCloseTo(value2);
			}
			return false;
		}

		public static bool IsGreaterThan(this double value1, double value2)
		{
			if (value1 > value2)
			{
				return !value1.IsCloseTo(value2);
			}
			return false;
		}

		public static bool IsOne(this double value)
		{
			return Math.Abs(value - 1.0) < 2.220446049250313E-15;
		}

		public static bool IsZero(this double value)
		{
			return Math.Abs(value) < 2.220446049250313E-15;
		}

		public static bool IsCloseTo(this Point point1, Point point2)
		{
			if (((Point)(ref point1)).X.IsCloseTo(((Point)(ref point2)).X))
			{
				return ((Point)(ref point1)).Y.IsCloseTo(((Point)(ref point2)).Y);
			}
			return false;
		}

		public static bool IsCloseTo(this Size size1, Size size2)
		{
			if (((Size)(ref size1)).Width.IsCloseTo(((Size)(ref size2)).Width))
			{
				return ((Size)(ref size1)).Height.IsCloseTo(((Size)(ref size2)).Height);
			}
			return false;
		}

		public static bool IsCloseTo(this Vector vector1, Vector vector2)
		{
			if (((Vector)(ref vector1)).X.IsCloseTo(((Vector)(ref vector2)).X))
			{
				return ((Vector)(ref vector1)).Y.IsCloseTo(((Vector)(ref vector2)).Y);
			}
			return false;
		}

		public static bool IsCloseTo(this Rect rect1, Rect rect2)
		{
			if (((Rect)(ref rect1)).IsEmpty)
			{
				return ((Rect)(ref rect2)).IsEmpty;
			}
			if (!((Rect)(ref rect2)).IsEmpty && ((Rect)(ref rect1)).X.IsCloseTo(((Rect)(ref rect2)).X) && ((Rect)(ref rect1)).Y.IsCloseTo(((Rect)(ref rect2)).Y) && ((Rect)(ref rect1)).Height.IsCloseTo(((Rect)(ref rect2)).Height))
			{
				return ((Rect)(ref rect1)).Width.IsCloseTo(((Rect)(ref rect2)).Width);
			}
			return false;
		}

		public static bool IsNaN(double value)
		{
			NanUnion nanUnion = default(NanUnion);
			nanUnion.DoubleValue = value;
			NanUnion nanUnion2 = nanUnion;
			ulong num = nanUnion2.UintValue & 0xFFF0000000000000uL;
			ulong num2 = nanUnion2.UintValue & 0xFFFFFFFFFFFFFuL;
			if (num == 9218868437227405312L || num == 18442240474082181120uL)
			{
				return num2 != 0;
			}
			return false;
		}

		public static double RoundLayoutValue(double value, double dpiScale)
		{
			double num;
			if (!dpiScale.IsCloseTo(1.0))
			{
				num = Math.Round(value * dpiScale) / dpiScale;
				if (IsNaN(num) || double.IsInfinity(num) || num.IsCloseTo(double.MaxValue))
				{
					num = value;
				}
			}
			else
			{
				num = Math.Round(value);
			}
			return num;
		}

		public static bool IsValid(this Thickness thick, bool allowNegative, bool allowNaN, bool allowPositiveInfinity, bool allowNegativeInfinity)
		{
			if (!allowNegative && (((Thickness)(ref thick)).Left < 0.0 || ((Thickness)(ref thick)).Right < 0.0 || ((Thickness)(ref thick)).Top < 0.0 || ((Thickness)(ref thick)).Bottom < 0.0))
			{
				return false;
			}
			if (!allowNaN && (IsNaN(((Thickness)(ref thick)).Left) || IsNaN(((Thickness)(ref thick)).Right) || IsNaN(((Thickness)(ref thick)).Top) || IsNaN(((Thickness)(ref thick)).Bottom)))
			{
				return false;
			}
			if (!allowPositiveInfinity && (double.IsPositiveInfinity(((Thickness)(ref thick)).Left) || double.IsPositiveInfinity(((Thickness)(ref thick)).Right) || double.IsPositiveInfinity(((Thickness)(ref thick)).Top) || double.IsPositiveInfinity(((Thickness)(ref thick)).Bottom)))
			{
				return false;
			}
			if (!allowNegativeInfinity && (double.IsNegativeInfinity(((Thickness)(ref thick)).Left) || double.IsNegativeInfinity(((Thickness)(ref thick)).Right) || double.IsNegativeInfinity(((Thickness)(ref thick)).Top) || double.IsNegativeInfinity(((Thickness)(ref thick)).Bottom)))
			{
				return false;
			}
			return true;
		}

		public static Size CollapseThickness(this Thickness thick)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			return new Size(((Thickness)(ref thick)).Left + ((Thickness)(ref thick)).Right, ((Thickness)(ref thick)).Top + ((Thickness)(ref thick)).Bottom);
		}

		public static bool IsZero(this Thickness thick)
		{
			if (((Thickness)(ref thick)).Left.IsZero() && ((Thickness)(ref thick)).Top.IsZero() && ((Thickness)(ref thick)).Right.IsZero())
			{
				return ((Thickness)(ref thick)).Bottom.IsZero();
			}
			return false;
		}

		public static bool IsUniform(this Thickness thick)
		{
			if (((Thickness)(ref thick)).Left.IsCloseTo(((Thickness)(ref thick)).Top) && ((Thickness)(ref thick)).Left.IsCloseTo(((Thickness)(ref thick)).Right))
			{
				return ((Thickness)(ref thick)).Left.IsCloseTo(((Thickness)(ref thick)).Bottom);
			}
			return false;
		}

		public static bool IsValid(this CornerRadius corner, bool allowNegative, bool allowNaN, bool allowPositiveInfinity, bool allowNegativeInfinity)
		{
			if (!allowNegative && (((CornerRadius)(ref corner)).TopLeft < 0.0 || ((CornerRadius)(ref corner)).TopRight < 0.0 || ((CornerRadius)(ref corner)).BottomLeft < 0.0 || ((CornerRadius)(ref corner)).BottomRight < 0.0))
			{
				return false;
			}
			if (!allowNaN && (IsNaN(((CornerRadius)(ref corner)).TopLeft) || IsNaN(((CornerRadius)(ref corner)).TopRight) || IsNaN(((CornerRadius)(ref corner)).BottomLeft) || IsNaN(((CornerRadius)(ref corner)).BottomRight)))
			{
				return false;
			}
			if (!allowPositiveInfinity && (double.IsPositiveInfinity(((CornerRadius)(ref corner)).TopLeft) || double.IsPositiveInfinity(((CornerRadius)(ref corner)).TopRight) || double.IsPositiveInfinity(((CornerRadius)(ref corner)).BottomLeft) || double.IsPositiveInfinity(((CornerRadius)(ref corner)).BottomRight)))
			{
				return false;
			}
			if (!allowNegativeInfinity && (double.IsNegativeInfinity(((CornerRadius)(ref corner)).TopLeft) || double.IsNegativeInfinity(((CornerRadius)(ref corner)).TopRight) || double.IsNegativeInfinity(((CornerRadius)(ref corner)).BottomLeft) || double.IsNegativeInfinity(((CornerRadius)(ref corner)).BottomRight)))
			{
				return false;
			}
			return true;
		}

		public static bool IsZero(this CornerRadius corner)
		{
			if (((CornerRadius)(ref corner)).TopLeft.IsZero() && ((CornerRadius)(ref corner)).TopRight.IsZero() && ((CornerRadius)(ref corner)).BottomRight.IsZero())
			{
				return ((CornerRadius)(ref corner)).BottomLeft.IsZero();
			}
			return false;
		}

		public static bool IsUniform(this CornerRadius corner)
		{
			double topLeft = ((CornerRadius)(ref corner)).TopLeft;
			if (topLeft.IsCloseTo(((CornerRadius)(ref corner)).TopRight) && topLeft.IsCloseTo(((CornerRadius)(ref corner)).BottomLeft))
			{
				return topLeft.IsCloseTo(((CornerRadius)(ref corner)).BottomRight);
			}
			return false;
		}

		public static Rect Deflate(this Rect rect, Thickness thick)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			return new Rect(((Rect)(ref rect)).Left + ((Thickness)(ref thick)).Left, ((Rect)(ref rect)).Top + ((Thickness)(ref thick)).Top, Math.Max(0.0, ((Rect)(ref rect)).Width - ((Thickness)(ref thick)).Left - ((Thickness)(ref thick)).Right), Math.Max(0.0, ((Rect)(ref rect)).Height - ((Thickness)(ref thick)).Top - ((Thickness)(ref thick)).Bottom));
		}

		public static Rect Inflate(this Rect rect, Thickness thick)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			return new Rect(((Rect)(ref rect)).Left - ((Thickness)(ref thick)).Left, ((Rect)(ref rect)).Top - ((Thickness)(ref thick)).Top, Math.Max(0.0, ((Rect)(ref rect)).Width + ((Thickness)(ref thick)).Left + ((Thickness)(ref thick)).Right), Math.Max(0.0, ((Rect)(ref rect)).Height + ((Thickness)(ref thick)).Top + ((Thickness)(ref thick)).Bottom));
		}

		public static bool IsOpaqueSolidColorBrush(this Brush brush)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			Brush obj = ((brush is SolidColorBrush) ? brush : null);
			byte? obj2;
			if (obj == null)
			{
				obj2 = null;
			}
			else
			{
				Color color = ((SolidColorBrush)obj).Color;
				obj2 = ((Color)(ref color)).A;
			}
			return obj2 == byte.MaxValue;
		}

		public static bool IsEqualTo(this Brush brush, Brush otherBrush)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			if (((object)brush).GetType() != ((object)otherBrush).GetType())
			{
				return false;
			}
			if (brush == otherBrush)
			{
				return true;
			}
			SolidColorBrush val = (SolidColorBrush)(object)((brush is SolidColorBrush) ? brush : null);
			SolidColorBrush val2 = (SolidColorBrush)(object)((otherBrush is SolidColorBrush) ? otherBrush : null);
			if (val != null && val2 != null)
			{
				if (val.Color == val2.Color)
				{
					return ((Brush)val).Opacity.IsCloseTo(((Brush)val2).Opacity);
				}
				return false;
			}
			LinearGradientBrush val3 = (LinearGradientBrush)(object)((brush is LinearGradientBrush) ? brush : null);
			LinearGradientBrush val4 = (LinearGradientBrush)(object)((otherBrush is LinearGradientBrush) ? otherBrush : null);
			if (val3 != null && val4 != null)
			{
				bool flag = ((GradientBrush)val3).ColorInterpolationMode == ((GradientBrush)val4).ColorInterpolationMode && val3.EndPoint == val4.EndPoint && ((GradientBrush)val3).MappingMode == ((GradientBrush)val4).MappingMode && ((Brush)val3).Opacity.IsCloseTo(((Brush)val4).Opacity) && val3.StartPoint == val4.StartPoint && ((GradientBrush)val3).SpreadMethod == ((GradientBrush)val4).SpreadMethod && ((GradientBrush)val3).GradientStops.Count == ((GradientBrush)val4).GradientStops.Count;
				if (!flag)
				{
					return false;
				}
				for (int i = 0; i < ((GradientBrush)val3).GradientStops.Count; i++)
				{
					flag = ((GradientBrush)val3).GradientStops[i].Color == ((GradientBrush)val4).GradientStops[i].Color && ((GradientBrush)val3).GradientStops[i].Offset.IsCloseTo(((GradientBrush)val4).GradientStops[i].Offset);
					if (!flag)
					{
						break;
					}
				}
				return flag;
			}
			RadialGradientBrush val5 = (RadialGradientBrush)(object)((brush is RadialGradientBrush) ? brush : null);
			RadialGradientBrush val6 = (RadialGradientBrush)(object)((otherBrush is RadialGradientBrush) ? otherBrush : null);
			if (val5 != null && val6 != null)
			{
				bool flag2 = ((GradientBrush)val5).ColorInterpolationMode == ((GradientBrush)val6).ColorInterpolationMode && val5.GradientOrigin == val6.GradientOrigin && ((GradientBrush)val5).MappingMode == ((GradientBrush)val6).MappingMode && ((Brush)val5).Opacity.IsCloseTo(((Brush)val6).Opacity) && val5.RadiusX.IsCloseTo(val6.RadiusX) && val5.RadiusY.IsCloseTo(val6.RadiusY) && ((GradientBrush)val5).SpreadMethod == ((GradientBrush)val6).SpreadMethod && ((GradientBrush)val5).GradientStops.Count == ((GradientBrush)val6).GradientStops.Count;
				if (!flag2)
				{
					return false;
				}
				for (int j = 0; j < ((GradientBrush)val5).GradientStops.Count; j++)
				{
					flag2 = ((GradientBrush)val5).GradientStops[j].Color == ((GradientBrush)val6).GradientStops[j].Color && ((GradientBrush)val5).GradientStops[j].Offset.IsCloseTo(((GradientBrush)val6).GradientStops[j].Offset);
					if (!flag2)
					{
						break;
					}
				}
				return flag2;
			}
			ImageBrush val7 = (ImageBrush)(object)((brush is ImageBrush) ? brush : null);
			ImageBrush val8 = (ImageBrush)(object)((otherBrush is ImageBrush) ? otherBrush : null);
			if (val7 != null && val8 != null)
			{
				return ((TileBrush)val7).AlignmentX == ((TileBrush)val8).AlignmentX && ((TileBrush)val7).AlignmentY == ((TileBrush)val8).AlignmentY && ((Brush)val7).Opacity.IsCloseTo(((Brush)val8).Opacity) && ((TileBrush)val7).Stretch == ((TileBrush)val8).Stretch && ((TileBrush)val7).TileMode == ((TileBrush)val8).TileMode && ((TileBrush)val7).Viewbox == ((TileBrush)val8).Viewbox && ((TileBrush)val7).ViewboxUnits == ((TileBrush)val8).ViewboxUnits && ((TileBrush)val7).Viewport == ((TileBrush)val8).Viewport && ((TileBrush)val7).ViewportUnits == ((TileBrush)val8).ViewportUnits && val7.ImageSource == val8.ImageSource;
			}
			return false;
		}
	}
	public class ClosingWindowEventHandlerArgs : EventArgs
	{
		public bool Cancelled { get; set; }
	}
	public enum AddToRecentColorsTrigger
	{
		Never,
		ColorPickerClosed,
		SelectedColorChanged
	}
	public static class BuildInColorPalettes
	{
		public static readonly DependencyProperty MaximumRecentColorsCountProperty = DependencyProperty.RegisterAttached("MaximumRecentColorsCount", typeof(int), typeof(BuildInColorPalettes), new PropertyMetadata((object)10));

		public static Color[] StandardColorsPalette { get; } = (Color[])(object)new Color[19]
		{
			Colors.Transparent,
			Colors.White,
			Colors.LightGray,
			Colors.Gray,
			Colors.Black,
			Colors.DarkRed,
			Colors.Red,
			Colors.Orange,
			Colors.Brown,
			Colors.Yellow,
			Colors.LimeGreen,
			Colors.Green,
			Colors.DarkTurquoise,
			Colors.Aqua,
			Colors.Navy,
			Colors.Blue,
			Colors.Indigo,
			Colors.Purple,
			Colors.Fuchsia
		};


		public static ObservableCollection<Color> WpfColorsPalette { get; } = new ObservableCollection<Color>(from c in (from x in typeof(Colors).GetProperties()
				where x.PropertyType == typeof(Color)
				select x).Select((Func<PropertyInfo, Color>)((PropertyInfo x) => (Color)x.GetValue(null)))
			orderby new HSVColor(c).Hue, new HSVColor(c).Saturation, new HSVColor(c).Value descending
			select c);


		public static ObservableCollection<Color?> RecentColors { get; } = new ObservableCollection<Color?>();


		public static void AddColorToRecentColors(Color? color, IEnumerable recentColors, int maxCount)
		{
			if (!(recentColors is ObservableCollection<Color?> observableCollection))
			{
				return;
			}
			int num = observableCollection.IndexOf(color);
			if (num > 0)
			{
				observableCollection.Move(num, 0);
			}
			else if (num < 0)
			{
				if (observableCollection.Count >= maxCount)
				{
					observableCollection.RemoveAt(maxCount - 1);
				}
				observableCollection.Insert(0, color);
			}
		}

		[AttachedPropertyBrowsableForType(typeof(ColorPickerBase))]
		public static int GetMaximumRecentColorsCount(DependencyObject obj)
		{
			return (int)obj.GetValue(MaximumRecentColorsCountProperty);
		}

		[AttachedPropertyBrowsableForType(typeof(ColorPickerBase))]
		public static void SetMaximumRecentColorsCount(DependencyObject obj, int value)
		{
			obj.SetValue(MaximumRecentColorsCountProperty, (object)value);
		}
	}
	[TemplatePart(Name = "PART_SaturationValueBox", Type = typeof(Control))]
	[TemplatePart(Name = "PART_ColorEyeDropper", Type = typeof(ColorEyeDropper))]
	public class ColorCanvas : ColorPickerBase
	{
		private FrameworkElement saturationValueBox;

		static ColorCanvas()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(ColorCanvas), (PropertyMetadata)new FrameworkPropertyMetadata((object)typeof(ColorCanvas)));
		}

		private void PART_SaturationValueBox_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			((UIElement)saturationValueBox).ReleaseMouseCapture();
			((UIElement)saturationValueBox).MouseMove -= new MouseEventHandler(PART_SaturationValueBox_MouseMove);
		}

		private void PART_SaturationValueBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			Mouse.Capture((IInputElement)(object)saturationValueBox);
			((UIElement)saturationValueBox).MouseMove += new MouseEventHandler(PART_SaturationValueBox_MouseMove);
			UpdateValues(((MouseEventArgs)e).GetPosition((IInputElement)(object)saturationValueBox));
		}

		private void PART_SaturationValueBox_MouseMove(object sender, MouseEventArgs e)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if ((int)e.LeftButton == 1)
			{
				UpdateValues(e.GetPosition((IInputElement)(object)saturationValueBox));
			}
		}

		private void UpdateValues(Point position)
		{
			if (!(saturationValueBox.ActualWidth < 1.0) && !(saturationValueBox.ActualHeight < 1.0))
			{
				double num = ((Point)(ref position)).X / saturationValueBox.ActualWidth;
				double num2 = 1.0 - ((Point)(ref position)).Y / saturationValueBox.ActualHeight;
				if (num > 1.0)
				{
					num = 1.0;
				}
				if (num2 > 1.0)
				{
					num2 = 1.0;
				}
				if (num < 0.0)
				{
					num = 0.0;
				}
				if (num2 < 0.0)
				{
					num2 = 0.0;
				}
				((DependencyObject)this).SetCurrentValue(ColorPickerBase.SaturationProperty, (object)num);
				((DependencyObject)this).SetCurrentValue(ColorPickerBase.ValueProperty, (object)num2);
			}
		}

		public override void OnApplyTemplate()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			((FrameworkElement)this).OnApplyTemplate();
			saturationValueBox = (FrameworkElement)((FrameworkElement)this).GetTemplateChild("PART_SaturationValueBox");
			if (saturationValueBox != null)
			{
				((UIElement)saturationValueBox).MouseLeftButtonDown += new MouseButtonEventHandler(PART_SaturationValueBox_MouseLeftButtonDown);
				((UIElement)saturationValueBox).MouseLeftButtonUp += new MouseButtonEventHandler(PART_SaturationValueBox_MouseLeftButtonUp);
			}
		}
	}
	public class ColorEyeDropper : Button
	{
		private DispatcherOperation currentTask;

		internal ColorEyePreviewData previewData = new ColorEyePreviewData();

		private ToolTip previewToolTip;

		public static readonly DependencyProperty SelectedColorProperty;

		public static readonly DependencyProperty PreviewImageOuterPixelCountProperty;

		public static readonly DependencyProperty EyeDropperCursorProperty;

		public static readonly DependencyProperty PreviewContentTemplateProperty;

		public static readonly RoutedEvent SelectedColorChangedEvent;

		public Color? SelectedColor
		{
			get
			{
				return (Color?)((DependencyObject)this).GetValue(SelectedColorProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(SelectedColorProperty, (object)value);
			}
		}

		public int PreviewImageOuterPixelCount
		{
			get
			{
				return (int)((DependencyObject)this).GetValue(PreviewImageOuterPixelCountProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(PreviewImageOuterPixelCountProperty, (object)value);
			}
		}

		public Cursor EyeDropperCursor
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unk

MahApps.Metro.IconPacks.Core.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: ThemeInfo(/*Could not decode attribute arguments.*/)]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/iconpacks", "MahApps.Metro.IconPacks")]
[assembly: ComVisible(false)]
[assembly: TargetFramework(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MahApps")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2016 - 2021 MahApps.Metro")]
[assembly: AssemblyDescription("IconPacks for stylish awesome WPF and UWP applications.")]
[assembly: AssemblyFileVersion("4.11.0.12")]
[assembly: AssemblyInformationalVersion("4.11.0-rc.12+Branch.main.Sha.2b994c02248a64ba00462f72102652c559c163a8.2b994c02248a64ba00462f72102652c559c163a8")]
[assembly: AssemblyProduct("MahApps.Metro.IconPacks")]
[assembly: AssemblyTitle("MahApps.Metro.IconPacks.Core")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/MahApps/MahApps.Metro.IconPacks.git")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: AssemblyVersion("4.0.0.0")]
namespace MahApps.Metro.IconPacks
{
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	public sealed class MetaDataAttribute : Attribute
	{
		public string Name { get; }

		public string ProjectUrl { get; }

		public string LicenseUrl { get; }

		public MetaDataAttribute()
		{
		}

		public MetaDataAttribute(string name, string projectUrl, string licenseUrl)
		{
			Name = name;
			ProjectUrl = projectUrl;
			LicenseUrl = licenseUrl;
		}
	}
	public abstract class PackIconBase : Control
	{
		protected internal abstract void SetKind<TKind>(TKind iconKind);

		protected abstract void UpdateData();
	}
	public abstract class PackIconControlBase : PackIconBase
	{
		private static readonly DependencyPropertyKey DataPropertyKey;

		public static readonly DependencyProperty DataProperty;

		public static readonly DependencyProperty FlipProperty;

		public static readonly DependencyProperty RotationAngleProperty;

		public static readonly DependencyProperty SpinProperty;

		private Storyboard spinningStoryboard;

		private FrameworkElement _innerGrid;

		public static readonly DependencyProperty SpinDurationProperty;

		public static readonly DependencyProperty SpinEasingFunctionProperty;

		public static readonly DependencyProperty SpinAutoReverseProperty;

		[TypeConverter(typeof(GeometryConverter))]
		public string Data
		{
			get
			{
				return (string)((DependencyObject)this).GetValue(DataProperty);
			}
			protected set
			{
				((DependencyObject)this).SetValue(DataPropertyKey, (object)value);
			}
		}

		public PackIconFlipOrientation Flip
		{
			get
			{
				return (PackIconFlipOrientation)((DependencyObject)this).GetValue(FlipProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(FlipProperty, (object)value);
			}
		}

		public double RotationAngle
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(RotationAngleProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(RotationAngleProperty, (object)value);
			}
		}

		public bool Spin
		{
			get
			{
				return (bool)((DependencyObject)this).GetValue(SpinProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(SpinProperty, (object)value);
			}
		}

		private FrameworkElement InnerGrid => _innerGrid ?? (_innerGrid = (FrameworkElement)/*isinst with value type is only supported in some contexts*/);

		public double SpinDuration
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(SpinDurationProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(SpinDurationProperty, (object)value);
			}
		}

		public IEasingFunction SpinEasingFunction
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (IEasingFunction)((DependencyObject)this).GetValue(SpinEasingFunctionProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(SpinEasingFunctionProperty, (object)value);
			}
		}

		public bool SpinAutoReverse
		{
			get
			{
				return (bool)((DependencyObject)this).GetValue(SpinAutoReverseProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(SpinAutoReverseProperty, (object)value);
			}
		}

		static PackIconControlBase()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_00ed: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Expected O, but got Unknown
			//IL_013b: Expected O, but got Unknown
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Expected O, but got Unknown
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Expected O, but got Unknown
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Expected O, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Expected O, but got Unknown
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Expected O, but got Unknown
			DataPropertyKey = DependencyProperty.RegisterReadOnly("Data", typeof(string), typeof(PackIconControlBase), new PropertyMetadata((object)""));
			DataProperty = DataPropertyKey.DependencyProperty;
			FlipProperty = DependencyProperty.Register("Flip", typeof(PackIconFlipOrientation), typeof(PackIconControlBase), new PropertyMetadata((object)PackIconFlipOrientation.Normal));
			RotationAngleProperty = DependencyProperty.Register("RotationAngle", typeof(double), typeof(PackIconControlBase), new PropertyMetadata((object)0.0, (PropertyChangedCallback)null, (CoerceValueCallback)delegate(DependencyObject dependencyObject, object value)
			{
				double num = (double)value;
				return (!(num < 0.0)) ? ((!(num > 360.0)) ? value : ((object)360.0)) : ((object)0.0);
			}));
			SpinProperty = DependencyProperty.Register("Spin", typeof(bool), typeof(PackIconControlBase), new PropertyMetadata((object)false, new PropertyChangedCallback(SpinPropertyChangedCallback), new CoerceValueCallback(SpinPropertyCoerceValueCallback)));
			SpinDurationProperty = DependencyProperty.Register("SpinDuration", typeof(double), typeof(PackIconControlBase), new PropertyMetadata((object)1.0, new PropertyChangedCallback(SpinDurationPropertyChangedCallback), new CoerceValueCallback(SpinDurationCoerceValueCallback)));
			SpinEasingFunctionProperty = DependencyProperty.Register("SpinEasingFunction", typeof(IEasingFunction), typeof(PackIconControlBase), new PropertyMetadata((object)null, new PropertyChangedCallback(SpinEasingFunctionPropertyChangedCallback)));
			SpinAutoReverseProperty = DependencyProperty.Register("SpinAutoReverse", typeof(bool), typeof(PackIconControlBase), new PropertyMetadata((object)false, new PropertyChangedCallback(SpinAutoReversePropertyChangedCallback)));
			UIElement.OpacityProperty.OverrideMetadata(typeof(PackIconControlBase), (PropertyMetadata)new UIPropertyMetadata((object)1.0, (PropertyChangedCallback)delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
			{
				d.CoerceValue(SpinProperty);
			}));
			UIElement.VisibilityProperty.OverrideMetadata(typeof(PackIconControlBase), (PropertyMetadata)new UIPropertyMetadata((object)(Visibility)0, (PropertyChangedCallback)delegate(DependencyObject d, DependencyPropertyChangedEventArgs e)
			{
				d.CoerceValue(SpinProperty);
			}));
		}

		public override void OnApplyTemplate()
		{
			((FrameworkElement)this).OnApplyTemplate();
			UpdateData();
			((DependencyObject)this).CoerceValue(SpinProperty);
			if (Spin)
			{
				StopSpinAnimation();
				BeginSpinAnimation();
			}
		}

		private static object SpinPropertyCoerceValueCallback(DependencyObject dependencyObject, object value)
		{
			if (dependencyObject is PackIconControlBase packIconControlBase && (!((UIElement)packIconControlBase).IsVisible || ((UIElement)packIconControlBase).Opacity <= 0.0 || packIconControlBase.SpinDuration <= 0.0))
			{
				return false;
			}
			return value;
		}

		private static void SpinPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
		{
			if (dependencyObject is PackIconControlBase packIconControlBase && ((DependencyPropertyChangedEventArgs)(ref e)).OldValue != ((DependencyPropertyChangedEventArgs)(ref e)).NewValue && ((DependencyPropertyChangedEventArgs)(ref e)).NewValue is bool)
			{
				packIconControlBase.ToggleSpinAnimation((bool)((DependencyPropertyChangedEventArgs)(ref e)).NewValue);
			}
		}

		private void ToggleSpinAnimation(bool spin)
		{
			if (spin)
			{
				BeginSpinAnimation();
			}
			else
			{
				StopSpinAnimation();
			}
		}

		private void BeginSpinAnimation()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			FrameworkElement innerGrid = InnerGrid;
			if (innerGrid != null)
			{
				Transform renderTransform = ((UIElement)innerGrid).RenderTransform;
				TransformGroup val = (TransformGroup)(((object)((renderTransform is TransformGroup) ? renderTransform : null)) ?? ((object)new TransformGroup()));
				RotateTransform val2 = ((IEnumerable)val.Children).OfType<RotateTransform>().LastOrDefault();
				if (val2 != null)
				{
					val2.Angle = 0.0;
				}
				else
				{
					val.Children.Add((Transform)new RotateTransform());
					((UIElement)innerGrid).RenderTransform = (Transform)(object)val;
				}
				DoubleAnimation val3 = new DoubleAnimation
				{
					From = 0.0,
					To = 360.0,
					AutoReverse = SpinAutoReverse,
					EasingFunction = SpinEasingFunction,
					RepeatBehavior = RepeatBehavior.Forever,
					Duration = new Duration(TimeSpan.FromSeconds(SpinDuration))
				};
				Storyboard val4 = new Storyboard();
				((TimelineGroup)val4).Children.Add((Timeline)(object)val3);
				Storyboard.SetTarget((DependencyObject)(object)val3, (DependencyObject)(object)innerGrid);
				Storyboard.SetTargetProperty((DependencyObject)(object)val3, new PropertyPath($"(0).(1)[{val.Children.Count - 1}].(2)", new object[3]
				{
					UIElement.RenderTransformProperty,
					TransformGroup.ChildrenProperty,
					RotateTransform.AngleProperty
				}));
				spinningStoryboard = val4;
				val4.Begin();
			}
		}

		private void StopSpinAnimation()
		{
			Storyboard val = spinningStoryboard;
			if (val != null)
			{
				val.Stop();
			}
			spinningStoryboard = null;
		}

		private static void SpinDurationPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
		{
			if (dependencyObject is PackIconControlBase packIconControlBase && ((DependencyPropertyChangedEventArgs)(ref e)).OldValue != ((DependencyPropertyChangedEventArgs)(ref e)).NewValue && packIconControlBase.Spin && ((DependencyPropertyChangedEventArgs)(ref e)).NewValue is double)
			{
				packIconControlBase.StopSpinAnimation();
				packIconControlBase.BeginSpinAnimation();
			}
		}

		private static object SpinDurationCoerceValueCallback(DependencyObject dependencyObject, object value)
		{
			double num = (double)value;
			if (!(num < 0.0))
			{
				return value;
			}
			return 0.0;
		}

		private static void SpinEasingFunctionPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
		{
			if (dependencyObject is PackIconControlBase packIconControlBase && ((DependencyPropertyChangedEventArgs)(ref e)).OldValue != ((DependencyPropertyChangedEventArgs)(ref e)).NewValue && packIconControlBase.Spin)
			{
				packIconControlBase.StopSpinAnimation();
				packIconControlBase.BeginSpinAnimation();
			}
		}

		private static void SpinAutoReversePropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
		{
			if (dependencyObject is PackIconControlBase packIconControlBase && ((DependencyPropertyChangedEventArgs)(ref e)).OldValue != ((DependencyPropertyChangedEventArgs)(ref e)).NewValue && packIconControlBase.Spin && ((DependencyPropertyChangedEventArgs)(ref e)).NewValue is bool)
			{
				packIconControlBase.StopSpinAnimation();
				packIconControlBase.BeginSpinAnimation();
			}
		}
	}
	public interface IPackIconExtension
	{
		double Width { get; set; }

		double Height { get; set; }

		PackIconFlipOrientation Flip { get; set; }

		double RotationAngle { get; set; }

		bool Spin { get; set; }

		bool SpinAutoReverse { get; set; }

		IEasingFunction SpinEasingFunction { get; set; }

		double SpinDuration { get; set; }
	}
	public static class PackIconExtensionHelper
	{
		public static PackIconControlBase GetPackIcon<TPack, TKind>(this IPackIconExtension packIconExtension, TKind kind) where TPack : PackIconControlBase, new()
		{
			TPack val = new TPack();
			val.SetKind(kind);
			if (((BasePackIconExtension)packIconExtension).IsFieldChanged(BasePackIconExtension.ChangedFieldFlags.Width))
			{
				((FrameworkElement)val).Width = packIconExtension.Width;
			}
			if (((BasePackIconExtension)packIconExtension).IsFieldChanged(BasePackIconExtension.ChangedFieldFlags.Height))
			{
				((FrameworkElement)val).Height = packIconExtension.Height;
			}
			if (((BasePackIconExtension)packIconExtension).IsFieldChanged(BasePackIconExtension.ChangedFieldFlags.Flip))
			{
				val.Flip = packIconExtension.Flip;
			}
			if (((BasePackIconExtension)packIconExtension).IsFieldChanged(BasePackIconExtension.ChangedFieldFlags.RotationAngle))
			{
				val.RotationAngle = packIconExtension.RotationAngle;
			}
			if (((BasePackIconExtension)packIconExtension).IsFieldChanged(BasePackIconExtension.ChangedFieldFlags.Spin))
			{
				val.Spin = packIconExtension.Spin;
			}
			if (((BasePackIconExtension)packIconExtension).IsFieldChanged(BasePackIconExtension.ChangedFieldFlags.SpinAutoReverse))
			{
				val.SpinAutoReverse = packIconExtension.SpinAutoReverse;
			}
			if (((BasePackIconExtension)packIconExtension).IsFieldChanged(BasePackIconExtension.ChangedFieldFlags.SpinEasingFunction))
			{
				val.SpinEasingFunction = packIconExtension.SpinEasingFunction;
			}
			if (((BasePackIconExtension)packIconExtension).IsFieldChanged(BasePackIconExtension.ChangedFieldFlags.SpinDuration))
			{
				val.SpinDuration = packIconExtension.SpinDuration;
			}
			return val;
		}
	}
	[MarkupExtensionReturnType(typeof(PackIconBase))]
	public abstract class BasePackIconExtension : MarkupExtension, IPackIconExtension
	{
		[Flags]
		internal enum ChangedFieldFlags : ushort
		{
			Width = 1,
			Height = 2,
			Flip = 4,
			RotationAngle = 8,
			Spin = 0x10,
			SpinAutoReverse = 0x20,
			SpinEasingFunction = 0x40,
			SpinDuration = 0x80
		}

		private double _width = 16.0;

		private double _height = 16.0;

		private PackIconFlipOrientation _flip;

		private double _rotationAngle;

		private bool _spin;

		private bool _spinAutoReverse;

		private IEasingFunction _spinEasingFunction;

		private double _spinDuration = 1.0;

		internal ChangedFieldFlags changedField;

		public double Width
		{
			get
			{
				return _width;
			}
			set
			{
				if (!object.Equals(_width, value))
				{
					_width = value;
					WriteFieldChangedFlag(ChangedFieldFlags.Width, set: true);
				}
			}
		}

		public double Height
		{
			get
			{
				return _height;
			}
			set
			{
				if (!object.Equals(_height, value))
				{
					_height = value;
					WriteFieldChangedFlag(ChangedFieldFlags.Height, set: true);
				}
			}
		}

		public PackIconFlipOrientation Flip
		{
			get
			{
				return _flip;
			}
			set
			{
				if (!object.Equals(_flip, value))
				{
					_flip = value;
					WriteFieldChangedFlag(ChangedFieldFlags.Flip, set: true);
				}
			}
		}

		public double RotationAngle
		{
			get
			{
				return _rotationAngle;
			}
			set
			{
				if (!object.Equals(_rotationAngle, value))
				{
					_rotationAngle = value;
					WriteFieldChangedFlag(ChangedFieldFlags.RotationAngle, set: true);
				}
			}
		}

		public bool Spin
		{
			get
			{
				return _spin;
			}
			set
			{
				if (!object.Equals(_spin, value))
				{
					_spin = value;
					WriteFieldChangedFlag(ChangedFieldFlags.Spin, set: true);
				}
			}
		}

		public bool SpinAutoReverse
		{
			get
			{
				return _spinAutoReverse;
			}
			set
			{
				if (!object.Equals(_spinAutoReverse, value))
				{
					_spinAutoReverse = value;
					WriteFieldChangedFlag(ChangedFieldFlags.SpinAutoReverse, set: true);
				}
			}
		}

		public IEasingFunction SpinEasingFunction
		{
			get
			{
				return _spinEasingFunction;
			}
			set
			{
				if (!object.Equals(_spinEasingFunction, value))
				{
					_spinEasingFunction = value;
					WriteFieldChangedFlag(ChangedFieldFlags.SpinEasingFunction, set: true);
				}
			}
		}

		public double SpinDuration
		{
			get
			{
				return _spinDuration;
			}
			set
			{
				if (!object.Equals(_spinDuration, value))
				{
					_spinDuration = value;
					WriteFieldChangedFlag(ChangedFieldFlags.SpinDuration, set: true);
				}
			}
		}

		internal bool IsFieldChanged(ChangedFieldFlags reqFlag)
		{
			return (changedField & reqFlag) != 0;
		}

		internal void WriteFieldChangedFlag(ChangedFieldFlags reqFlag, bool set)
		{
			if (set)
			{
				changedField |= reqFlag;
			}
			else
			{
				changedField &= (ChangedFieldFlags)(ushort)(~(int)reqFlag);
			}
		}
	}
	public enum PackIconFlipOrientation
	{
		Normal,
		Horizontal,
		Vertical,
		Both
	}
	[MarkupExtensionReturnType(typeof(ImageSource))]
	public abstract class BasePackIconImageExtension : MarkupExtension
	{
		public Brush Brush { get; set; } = (Brush)(object)Brushes.Black;


		public PackIconFlipOrientation Flip { get; set; }

		public double RotationAngle { get; set; }

		protected abstract string GetPathData(object iconKind);

		protected virtual ScaleTransform GetScaleTransform(object iconKind)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			return new ScaleTransform(1.0, 1.0);
		}

		protected Transform GetTransformGroup(object iconKind)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			TransformGroup val = new TransformGroup();
			val.Children.Add((Transform)(object)GetScaleTransform(iconKind));
			val.Children.Add((Transform)new ScaleTransform((double)((Flip != PackIconFlipOrientation.Horizontal && Flip != PackIconFlipOrientation.Both) ? 1 : (-1)), (double)((Flip != PackIconFlipOrientation.Vertical && Flip != PackIconFlipOrientation.Both) ? 1 : (-1))));
			val.Children.Add((Transform)new RotateTransform(RotationAngle));
			return (Transform)(object)val;
		}

		protected virtual DrawingGroup GetDrawingGroup(object iconKind, Brush foregroundBrush, string path)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			GeometryDrawing val = new GeometryDrawing
			{
				Geometry = Geometry.Parse(path),
				Brush = foregroundBrush
			};
			DrawingGroup val2 = new DrawingGroup();
			val2.Children.Add((Drawing)(object)val);
			val2.Transform = GetTransformGroup(iconKind);
			return val2;
		}

		protected ImageSource CreateImageSource(object iconKind, Brush foregroundBrush)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			string pathData = GetPathData(iconKind);
			if (string.IsNullOrEmpty(pathData))
			{
				return null;
			}
			DrawingImage val = new DrawingImage((Drawing)(object)GetDrawingGroup(iconKind, foregroundBrush, pathData));
			((Freezable)val).Freeze();
			return (ImageSource)(object)val;
		}
	}
}
namespace MahApps.Metro.IconPacks.Converter
{
	public class DataTypeValueConverter : MarkupConverter
	{
		private static DataTypeValueConverter _instance;

		static DataTypeValueConverter()
		{
		}

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return _instance ?? (_instance = new DataTypeValueConverter());
		}

		protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return value?.GetType();
		}

		protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	[MarkupExtensionReturnType(typeof(FlipToScaleXValueConverter))]
	public class FlipToScaleXValueConverter : MarkupConverter
	{
		private static FlipToScaleXValueConverter _instance;

		public static FlipToScaleXValueConverter Instance { get; }

		static FlipToScaleXValueConverter()
		{
			Instance = _instance ?? (_instance = new FlipToScaleXValueConverter());
		}

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return Instance;
		}

		protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value is PackIconFlipOrientation packIconFlipOrientation)
			{
				int num = ((packIconFlipOrientation != PackIconFlipOrientation.Horizontal && packIconFlipOrientation != PackIconFlipOrientation.Both) ? 1 : (-1));
				return num;
			}
			return 1;
		}

		protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	[MarkupExtensionReturnType(typeof(FlipToScaleYValueConverter))]
	public class FlipToScaleYValueConverter : MarkupConverter
	{
		private static FlipToScaleYValueConverter _instance;

		public static FlipToScaleYValueConverter Instance { get; }

		static FlipToScaleYValueConverter()
		{
			Instance = _instance ?? (_instance = new FlipToScaleYValueConverter());
		}

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return Instance;
		}

		protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value is PackIconFlipOrientation packIconFlipOrientation)
			{
				int num = ((packIconFlipOrientation != PackIconFlipOrientation.Vertical && packIconFlipOrientation != PackIconFlipOrientation.Both) ? 1 : (-1));
				return num;
			}
			return 1;
		}

		protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	[MarkupExtensionReturnType(typeof(IValueConverter))]
	public abstract class MarkupConverter : MarkupExtension, IValueConverter
	{
		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return this;
		}

		protected abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture);

		protected abstract object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture);

		object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			try
			{
				return Convert(value, targetType, parameter, culture);
			}
			catch
			{
				return DependencyProperty.UnsetValue;
			}
		}

		object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			try
			{
				return ConvertBack(value, targetType, parameter, culture);
			}
			catch
			{
				return DependencyProperty.UnsetValue;
			}
		}
	}
	public class NullToUnsetValueConverter : MarkupConverter
	{
		private static NullToUnsetValueConverter _instance;

		static NullToUnsetValueConverter()
		{
		}

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return _instance ?? (_instance = new NullToUnsetValueConverter());
		}

		protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return value ?? DependencyProperty.UnsetValue;
		}

		protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
	public abstract class PackIconKindToImageConverterBase : MarkupConverter
	{
		public Brush Brush { get; set; } = (Brush)(object)Brushes.Black;


		public PackIconFlipOrientation Flip { get; set; }

		public double RotationAngle { get; set; }

		protected abstract string GetPathData(object iconKind);

		protected virtual ScaleTransform GetScaleTransform(object iconKind)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			return new ScaleTransform(1.0, 1.0);
		}

		protected Transform GetTransformGroup(object iconKind)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			TransformGroup val = new TransformGroup();
			val.Children.Add((Transform)(object)GetScaleTransform(iconKind));
			val.Children.Add((Transform)new ScaleTransform((double)((Flip != PackIconFlipOrientation.Horizontal && Flip != PackIconFlipOrientation.Both) ? 1 : (-1)), (double)((Flip != PackIconFlipOrientation.Vertical && Flip != PackIconFlipOrientation.Both) ? 1 : (-1))));
			val.Children.Add((Transform)new RotateTransform(RotationAngle));
			return (Transform)(object)val;
		}

		protected virtual DrawingGroup GetDrawingGroup(object iconKind, Brush foregroundBrush, string path)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			GeometryDrawing val = new GeometryDrawing
			{
				Geometry = Geometry.Parse(path),
				Brush = foregroundBrush
			};
			DrawingGroup val2 = new DrawingGroup();
			val2.Children.Add((Drawing)(object)val);
			val2.Transform = GetTransformGroup(iconKind);
			return val2;
		}

		protected ImageSource CreateImageSource(object iconKind, Brush foregroundBrush)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			string pathData = GetPathData(iconKind);
			if (string.IsNullOrEmpty(pathData))
			{
				return null;
			}
			DrawingImage val = new DrawingImage((Drawing)(object)GetDrawingGroup(iconKind, foregroundBrush, pathData));
			((Freezable)val).Freeze();
			return (ImageSource)(object)val;
		}

		protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (!(value is Enum))
			{
				return DependencyProperty.UnsetValue;
			}
			ImageSource val = CreateImageSource(value, (Brush)(((parameter is Brush) ? parameter : null) ?? ((object)Brush) ?? ((object)Brushes.Black)));
			return val ?? DependencyProperty.UnsetValue;
		}

		protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return DependencyProperty.UnsetValue;
		}
	}
}

MahApps.Metro.IconPacks.FontAwesome.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Windows;
using System.Windows.Markup;
using System.Windows.Media;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: ThemeInfo(/*Could not decode attribute arguments.*/)]
[assembly: XmlnsPrefix("http://metro.mahapps.com/winfx/xaml/iconpacks", "iconPacks")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/iconpacks", "MahApps.Metro.IconPacks")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/iconpacks", "MahApps.Metro.IconPacks.Converter")]
[assembly: ComVisible(false)]
[assembly: TargetFramework(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MahApps")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2016 - 2021 MahApps.Metro")]
[assembly: AssemblyDescription("IconPacks for stylish awesome WPF and UWP applications.")]
[assembly: AssemblyFileVersion("4.11.0.12")]
[assembly: AssemblyInformationalVersion("4.11.0-rc.12+Branch.main.Sha.2b994c02248a64ba00462f72102652c559c163a8")]
[assembly: AssemblyProduct("MahApps.Metro.IconPacks")]
[assembly: AssemblyTitle("MahApps.Metro.IconPacks.FontAwesome")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/MahApps/MahApps.Metro.IconPacks.git")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: AssemblyVersion("4.0.0.0")]
namespace MahApps.Metro.IconPacks
{
	[MetaData("Font Awesome Free", "https://fontawesome.com/", "https://fontawesome.com/license/free")]
	public class PackIconFontAwesome : PackIconControlBase
	{
		public static readonly DependencyProperty KindProperty;

		public PackIconFontAwesomeKind Kind
		{
			get
			{
				return (PackIconFontAwesomeKind)((DependencyObject)this).GetValue(KindProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(KindProperty, (object)value);
			}
		}

		private static void KindPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
		{
			if (((DependencyPropertyChangedEventArgs)(ref e)).NewValue != ((DependencyPropertyChangedEventArgs)(ref e)).OldValue)
			{
				((PackIconBase)(PackIconFontAwesome)(object)dependencyObject).UpdateData();
			}
		}

		static PackIconFontAwesome()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			KindProperty = DependencyProperty.Register("Kind", typeof(PackIconFontAwesomeKind), typeof(PackIconFontAwesome), new PropertyMetadata((object)PackIconFontAwesomeKind.None, new PropertyChangedCallback(KindPropertyChangedCallback)));
			FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(PackIconFontAwesome), (PropertyMetadata)new FrameworkPropertyMetadata((object)typeof(PackIconFontAwesome)));
		}

		protected override void SetKind<TKind>(TKind iconKind)
		{
			((DependencyObject)this).SetCurrentValue(KindProperty, (object)iconKind);
		}

		protected override void UpdateData()
		{
			if (Kind != 0)
			{
				string value = null;
				PackIconFontAwesomeDataFactory.DataIndex.Value?.TryGetValue(Kind, out value);
				((PackIconControlBase)this).Data = value;
			}
			else
			{
				((PackIconControlBase)this).Data = null;
			}
		}
	}
	public static class PackIconFontAwesomeDataFactory
	{
		public static Lazy<IDictionary<PackIconFontAwesomeKind, string>> DataIndex { get; }

		static PackIconFontAwesomeDataFactory()
		{
			if (DataIndex == null)
			{
				DataIndex = new Lazy<IDictionary<PackIconFontAwesomeKind, string>>(Create);
			}
		}

		public static IDictionary<PackIconFontAwesomeKind, string> Create()
		{
			return new Dictionary<PackIconFontAwesomeKind, string>
			{
				{
					PackIconFontAwesomeKind.None,
					""
				},
				{
					PackIconFontAwesomeKind._500pxBrands,
					"M103.3 344.3c-6.5-14.2-6.9-18.3 7.4-23.1 25.6-8 8 9.2 43.2 49.2h.3v-93.9c1.2-50.2 44-92.2 97.7-92.2 53.9 0 97.7 43.5 97.7 96.8 0 63.4-60.8 113.2-128.5 93.3-10.5-4.2-2.1-31.7 8.5-28.6 53 0 89.4-10.1 89.4-64.4 0-61-77.1-89.6-116.9-44.6-23.5 26.4-17.6 42.1-17.6 157.6 50.7 31 118.3 22 160.4-20.1 24.8-24.8 38.5-58 38.5-93 0-35.2-13.8-68.2-38.8-93.3-24.8-24.8-57.8-38.5-93.3-38.5s-68.8 13.8-93.5 38.5c-.3.3-16 16.5-21.2 23.9l-.5.6c-3.3 4.7-6.3 9.1-20.1 6.1-6.9-1.7-14.3-5.8-14.3-11.8V20c0-5 3.9-10.5 10.5-10.5h241.3c8.3 0 8.3 11.6 8.3 15.1 0 3.9 0 15.1-8.3 15.1H130.3v132.9h.3c104.2-109.8 282.8-36 282.8 108.9 0 178.1-244.8 220.3-310.1 62.8zm63.3-260.8c-.5 4.2 4.6 24.5 14.6 20.6C306 56.6 384 144.5 390.6 144.5c4.8 0 22.8-15.3 14.3-22.8-93.2-89-234.5-57-238.3-38.2zM393 414.7C283 524.6 94 475.5 61 310.5c0-12.2-30.4-7.4-28.9 3.3 24 173.4 246 256.9 381.6 121.3 6.9-7.8-12.6-28.4-20.7-20.4zM213.6 306.6c0 4 4.3 7.3 5.5 8.5 3 3 6.1 4.4 8.5 4.4 3.8 0 2.6.2 22.3-19.5 19.6 19.3 19.1 19.5 22.3 19.5 5.4 0 18.5-10.4 10.7-18.2L265.6 284l18.2-18.2c6.3-6.8-10.1-21.8-16.2-15.7L249.7 268c-18.6-18.8-18.4-19.5-21.5-19.5-5 0-18 11.7-12.4 17.3L234 284c-18.1 17.9-20.4 19.2-20.4 22.6z"
				},
				{
					PackIconFontAwesomeKind.AccessibleIconBrands,
					"M423.9 255.8L411 413.1c-3.3 40.7-63.9 35.1-60.6-4.9l10-122.5-41.1 2.3c10.1 20.7 15.8 43.9 15.8 68.5 0 41.2-16.1 78.7-42.3 106.5l-39.3-39.3c57.9-63.7 13.1-167.2-74-167.2-25.9 0-49.5 9.9-67.2 26L73 243.2c22-20.7 50.1-35.1 81.4-40.2l75.3-85.7-42.6-24.8-51.6 46c-30 26.8-70.6-18.5-40.5-45.4l68-60.7c9.8-8.8 24.1-10.2 35.5-3.6 0 0 139.3 80.9 139.5 81.1 16.2 10.1 20.7 36 6.1 52.6L285.7 229l106.1-5.9c18.5-1.1 33.6 14.4 32.1 32.7zm-64.9-154c28.1 0 50.9-22.8 50.9-50.9C409.9 22.8 387.1 0 359 0c-28.1 0-50.9 22.8-50.9 50.9 0 28.1 22.8 50.9 50.9 50.9zM179.6 456.5c-80.6 0-127.4-90.6-82.7-156.1l-39.7-39.7C36.4 287 24 320.3 24 356.4c0 130.7 150.7 201.4 251.4 122.5l-39.7-39.7c-16 10.9-35.3 17.3-56.1 17.3z"
				},
				{
					PackIconFontAwesomeKind.AccusoftBrands,
					"M322.1 252v-1l-51.2-65.8s-12 1.6-25 15.1c-9 9.3-242.1 239.1-243.4 240.9-7 10 1.6 6.8 15.7 1.7.8 0 114.5-36.6 114.5-36.6.5-.6-.1-.1.6-.6-.4-5.1-.8-26.2-1-27.7-.6-5.2 2.2-6.9 7-8.9l92.6-33.8c.6-.8 88.5-81.7 90.2-83.3zm160.1 120.1c13.3 16.1 20.7 13.3 30.8 9.3 3.2-1.2 115.4-47.6 117.8-48.9 8-4.3-1.7-16.7-7.2-23.4-2.1-2.5-205.1-245.6-207.2-248.3-9.7-12.2-14.3-12.9-38.4-12.8-10.2 0-106.8.5-116.5.6-19.2.1-32.9-.3-19.2 16.9C250 75 476.5 365.2 482.2 372.1zm152.7 1.6c-2.3-.3-24.6-4.7-38-7.2 0 0-115 50.4-117.5 51.6-16 7.3-26.9-3.2-36.7-14.6l-57.1-74c-5.4-.9-60.4-9.6-65.3-9.3-3.1.2-9.6.8-14.4 2.9-4.9 2.1-145.2 52.8-150.2 54.7-5.1 2-11.4 3.6-11.1 7.6.2 2.5 2 2.6 4.6 3.5 2.7.8 300.9 67.6 308 69.1 15.6 3.3 38.5 10.5 53.6 1.7 2.1-1.2 123.8-76.4 125.8-77.8 5.4-4 4.3-6.8-1.7-8.2z"
				},
				{
					PackIconFontAwesomeKind.AcquisitionsIncorporatedBrands,
					"M357.45 468.2c-1.2-7.7-1.3-7.6-9.6-7.6-99.8.2-111.8-2.4-112.7-2.6-12.3-1.7-20.6-10.5-21-23.1-.1-1.6-.2-71.6-1-129.1-.1-4.7 1.6-6.4 5.9-7.5 12.5-3 24.9-6.1 37.3-9.7 4.3-1.3 6.8-.2 8.4 3.5 4.5 10.3 8.8 20.6 13.2 30.9 1.6 3.7.1 4.4-3.4 4.4-10-.2-20-.1-30.4-.1v27h116c-1.4-9.5-2.7-18.1-4-27.5-7 0-13.8.4-20.4-.1-22.6-1.6-18.3-4.4-84-158.6-8.8-20.1-27.9-62.1-36.5-89.2-4.4-14 5.5-25.4 18.9-26.6 18.6-1.7 37.5-1.6 56.2-2 20.6-.4 41.2-.4 61.8-.5 3.1 0 4-1.4 4.3-4.3 1.2-9.8 2.7-19.5 4-29.2.8-5.3 1.6-10.7 2.4-16.1L23.75 0c-3.6 0-5.3 1.1-4.6 5.3 2.2 13.2-.8.8 6.4 45.3 63.4 0 71.8.9 101.8.5 12.3-.2 37 3.5 37.7 22.1.4 11.4-1.1 11.3-32.6 87.4-53.8 129.8-50.7 120.3-67.3 161-1.7 4.1-3.6 5.2-7.6 5.2-8.5-.2-17-.3-25.4.1-1.9.1-5.2 1.8-5.5 3.2-1.5 8.1-2.2 16.3-3.2 24.9h114.3v-27.6c-6.9 0-33.5.4-35.3-2.9 5.3-12.3 10.4-24.4 15.7-36.7 16.3 4 31.9 7.8 47.6 11.7 3.4.9 4.6 3 4.6 6.8-.1 42.9.1 85.9.2 128.8 0 10.2-5.5 19.1-14.9 23.1-6.5 2.7-3.3 3.4-121.4 2.4-5.3 0-7.1 2-7.6 6.8-1.5 12.9-2.9 25.9-5 38.8-.8 5 1.3 5.7 5.3 5.7 183.2.6-30.7 0 337.1 0-2.5-15-4.4-29.4-6.6-43.7zm-174.9-205.7c-13.3-4.2-26.6-8.2-39.9-12.5a44.53 44.53 0 0 1-5.8-2.9c17.2-44.3 34.2-88.1 51.3-132.1 7.5 2.4 7.9-.8 9.4 0 9.3 22.5 18.1 60.1 27 82.8 6.6 16.7 13 33.5 19.7 50.9a35.78 35.78 0 0 1-3.9 2.1c-13.1 3.9-26.4 7.5-39.4 11.7a27.66 27.66 0 0 1-18.4 0z"
				},
				{
					PackIconFontAwesomeKind.AddressBookRegular,
					"M436 160c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20V48c0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h320c26.5 0 48-21.5 48-48v-48h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20zm-68 304H48V48h320v416zM208 256c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm-89.6 128h179.2c12.4 0 22.4-8.6 22.4-19.2v-19.2c0-31.8-30.1-57.6-67.2-57.6-10.8 0-18.7 8-44.8 8-26.9 0-33.4-8-44.8-8-37.1 0-67.2 25.8-67.2 57.6v19.2c0 10.6 10 19.2 22.4 19.2z"
				},
				{
					PackIconFontAwesomeKind.AddressBookSolid,
					"M436 160c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20V48c0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h320c26.5 0 48-21.5 48-48v-48h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20zm-228-32c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm112 236.8c0 10.6-10 19.2-22.4 19.2H118.4C106 384 96 375.4 96 364.8v-19.2c0-31.8 30.1-57.6 67.2-57.6h5c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h5c37.1 0 67.2 25.8 67.2 57.6v19.2z"
				},
				{
					PackIconFontAwesomeKind.AddressCardRegular,
					"M528 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm0 400H48V80h480v352zM208 256c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm-89.6 128h179.2c12.4 0 22.4-8.6 22.4-19.2v-19.2c0-31.8-30.1-57.6-67.2-57.6-10.8 0-18.7 8-44.8 8-26.9 0-33.4-8-44.8-8-37.1 0-67.2 25.8-67.2 57.6v19.2c0 10.6 10 19.2 22.4 19.2zM360 320h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8zm0-64h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8zm0-64h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8z"
				},
				{
					PackIconFontAwesomeKind.AddressCardSolid,
					"M528 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-352 96c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm112 236.8c0 10.6-10 19.2-22.4 19.2H86.4C74 384 64 375.4 64 364.8v-19.2c0-31.8 30.1-57.6 67.2-57.6h5c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h5c37.1 0 67.2 25.8 67.2 57.6v19.2zM512 312c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16zm0-64c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16zm0-64c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16z"
				},
				{
					PackIconFontAwesomeKind.AdjustSolid,
					"M8 256c0 136.966 111.033 248 248 248s248-111.034 248-248S392.966 8 256 8 8 119.033 8 256zm248 184V72c101.705 0 184 82.311 184 184 0 101.705-82.311 184-184 184z"
				},
				{
					PackIconFontAwesomeKind.AdnBrands,
					"M248 167.5l64.9 98.8H183.1l64.9-98.8zM496 256c0 136.9-111.1 248-248 248S0 392.9 0 256 111.1 8 248 8s248 111.1 248 248zm-99.8 82.7L248 115.5 99.8 338.7h30.4l33.6-51.7h168.6l33.6 51.7h30.2z"
				},
				{
					PackIconFontAwesomeKind.AdSolid,
					"M157.52 272h36.96L176 218.78 157.52 272zM352 256c-13.23 0-24 10.77-24 24s10.77 24 24 24 24-10.77 24-24-10.77-24-24-24zM464 64H48C21.5 64 0 85.5 0 112v288c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM250.58 352h-16.94c-6.81 0-12.88-4.32-15.12-10.75L211.15 320h-70.29l-7.38 21.25A16 16 0 0 1 118.36 352h-16.94c-11.01 0-18.73-10.85-15.12-21.25L140 176.12A23.995 23.995 0 0 1 162.67 160h26.66A23.99 23.99 0 0 1 212 176.13l53.69 154.62c3.61 10.4-4.11 21.25-15.11 21.25zM424 336c0 8.84-7.16 16-16 16h-16c-4.85 0-9.04-2.27-11.98-5.68-8.62 3.66-18.09 5.68-28.02 5.68-39.7 0-72-32.3-72-72s32.3-72 72-72c8.46 0 16.46 1.73 24 4.42V176c0-8.84 7.16-16 16-16h16c8.84 0 16 7.16 16 16v160z"
				},
				{
					PackIconFontAwesomeKind.AdversalBrands,
					"M482.1 32H28.7C5.8 32 0 37.9 0 60.9v390.2C0 474.4 5.8 480 28.7 480h453.4c24.4 0 29.9-5.2 29.9-29.7V62.2c0-24.6-5.4-30.2-29.9-30.2zM178.4 220.3c-27.5-20.2-72.1-8.7-84.2 23.4-4.3 11.1-9.3 9.5-17.5 8.3-9.7-1.5-17.2-3.2-22.5-5.5-28.8-11.4 8.6-55.3 24.9-64.3 41.1-21.4 83.4-22.2 125.3-4.8 40.9 16.8 34.5 59.2 34.5 128.5 2.7 25.8-4.3 58.3 9.3 88.8 1.9 4.4.4 7.9-2.7 10.7-8.4 6.7-39.3 2.2-46.6-7.4-1.9-2.2-1.8-3.6-3.9-6.2-3.6-3.9-7.3-2.2-11.9 1-57.4 36.4-140.3 21.4-147-43.3-3.1-29.3 12.4-57.1 39.6-71 38.2-19.5 112.2-11.8 114-30.9 1.1-10.2-1.9-20.1-11.3-27.3zm286.7 222c0 15.1-11.1 9.9-17.8 9.9H52.4c-7.4 0-18.2 4.8-17.8-10.7.4-13.9 10.5-9.1 17.1-9.1 132.3-.4 264.5-.4 396.8 0 6.8 0 16.6-4.4 16.6 9.9zm3.8-340.5v291c0 5.7-.7 13.9-8.1 13.9-12.4-.4-27.5 7.1-36.1-5.6-5.8-8.7-7.8-4-12.4-1.2-53.4 29.7-128.1 7.1-144.4-85.2-6.1-33.4-.7-67.1 15.7-100 11.8-23.9 56.9-76.1 136.1-30.5v-71c0-26.2-.1-26.2 26-26.2 3.1 0 6.6.4 9.7 0 10.1-.8 13.6 4.4 13.6 14.3-.1.2-.1.3-.1.5zm-51.5 232.3c-19.5 47.6-72.9 43.3-90 5.2-15.1-33.3-15.5-68.2.4-101.5 16.3-34.1 59.7-35.7 81.5-4.8 20.6 28.8 14.9 84.6 8.1 101.1zm-294.8 35.3c-7.5-1.3-33-3.3-33.7-27.8-.4-13.9 7.8-23 19.8-25.8 24.4-5.9 49.3-9.9 73.7-14.7 8.9-2 7.4 4.4 7.8 9.5 1.4 33-26.1 59.2-67.6 58.8z"
				},
				{
					PackIconFontAwesomeKind.AffiliatethemeBrands,
					"M159.7 237.4C108.4 308.3 43.1 348.2 14 326.6-15.2 304.9 2.8 230 54.2 159.1c51.3-70.9 116.6-110.8 145.7-89.2 29.1 21.6 11.1 96.6-40.2 167.5zm351.2-57.3C437.1 303.5 319 367.8 246.4 323.7c-25-15.2-41.3-41.2-49-73.8-33.6 64.8-92.8 113.8-164.1 133.2 49.8 59.3 124.1 96.9 207 96.9 150 0 271.6-123.1 271.6-274.9.1-8.5-.3-16.8-1-25z"
				},
				{
					PackIconFontAwesomeKind.AirbnbBrands,
					"M224 373.12c-25.24-31.67-40.08-59.43-45-83.18-22.55-88 112.61-88 90.06 0-5.45 24.25-20.29 52-45 83.18zm138.15 73.23c-42.06 18.31-83.67-10.88-119.3-50.47 103.9-130.07 46.11-200-18.85-200-54.92 0-85.16 46.51-73.28 100.5 6.93 29.19 25.23 62.39 54.43 99.5-32.53 36.05-60.55 52.69-85.15 54.92-50 7.43-89.11-41.06-71.3-91.09 15.1-39.16 111.72-231.18 115.87-241.56 15.75-30.07 25.56-57.4 59.38-57.4 32.34 0 43.4 25.94 60.37 59.87 36 70.62 89.35 177.48 114.84 239.09 13.17 33.07-1.37 71.29-37.01 86.64zm47-136.12C280.27 35.93 273.13 32 224 32c-45.52 0-64.87 31.67-84.66 72.79C33.18 317.1 22.89 347.19 22 349.81-3.22 419.14 48.74 480 111.63 480c21.71 0 60.61-6.06 112.37-62.4 58.68 63.78 101.26 62.4 112.37 62.4 62.89.05 114.85-60.86 89.61-130.19.02-3.89-16.82-38.9-16.82-39.58z"
				},
				{
					PackIconFontAwesomeKind.AirFreshenerSolid,
					"M224 160H96C43 160 0 203 0 256V480C0 497.625 14.375 512 32 512H288C305.625 512 320 497.625 320 480V256C320 203 277 160 224 160ZM160 416C115.875 416 80 380.125 80 336S115.875 256 160 256S240 291.875 240 336S204.125 416 160 416ZM224 32C224 14.375 209.625 0 192 0H128C110.375 0 96 14.375 96 32V128H224V32ZM381.781 51.578C383 50.969 384 49.359 384 48C384 46.625 383 45.031 381.781 44.422L352 32L339.562 2.219C338.969 1 337.375 0 336 0S333.031 1 332.406 2.219L320 32L290.219 44.422C289 45.031 288 46.625 288 48C288 49.359 289 50.969 290.219 51.578L320 64L332.406 93.781C333.031 95 334.625 96 336 96S338.969 95 339.562 93.781L352 64L381.781 51.578ZM448 64L460.406 93.781C461.031 95 462.625 96 464 96S466.969 95 467.562 93.781L480 64L509.781 51.578C511 50.969 512 49.359 512 48C512 46.625 511 45.031 509.781 44.422L480 32L467.562 2.219C466.969 1 465.375 0 464 0S461.031 1 460.406 2.219L448 32L418.219 44.422C417 45.031 416 46.625 416 48C416 49.359 417 50.969 418.219 51.578L448 64ZM480 224L467.562 194.219C466.969 193 465.375 192 464 192S461.031 193 460.406 194.219L448 224L418.219 236.422C417 237.031 416 238.625 416 240C416 241.359 417 242.969 418.219 243.578L448 256L460.406 285.781C461.031 287 462.625 288 464 288S466.969 287 467.562 285.781L480 256L509.781 243.578C511 242.969 512 241.359 512 240C512 238.625 511 237.031 509.781 236.422L480 224ZM445.781 147.578C447 146.969 448 145.359 448 144C448 142.625 447 141.031 445.781 140.422L416 128L403.562 98.219C402.969 97 401.375 96 400 96S397.031 97 396.406 98.219L384 128L354.219 140.422C353 141.031 352 142.625 352 144C352 145.359 353 146.969 354.219 147.578L384 160L396.406 189.781C397.031 191 398.625 192 400 192S402.969 191 403.562 189.781L416 160L445.781 147.578Z"
				},
				{
					PackIconFontAwesomeKind.AlgoliaBrands,
					"M229.3 182.6c-49.3 0-89.2 39.9-89.2 89.2 0 49.3 39.9 89.2 89.2 89.2s89.2-39.9 89.2-89.2c0-49.3-40-89.2-89.2-89.2zm62.7 56.6l-58.9 30.6c-1.8.9-3.8-.4-3.8-2.3V201c0-1.5 1.3-2.7 2.7-2.6 26.2 1 48.9 15.7 61.1 37.1.7 1.3.2 3-1.1 3.7zM389.1 32H58.9C26.4 32 0 58.4 0 90.9V421c0 32.6 26.4 59 58.9 59H389c32.6 0 58.9-26.4 58.9-58.9V90.9C448 58.4 421.6 32 389.1 32zm-202.6 84.7c0-10.8 8.7-19.5 19.5-19.5h45.3c10.8 0 19.5 8.7 19.5 19.5v15.4c0 1.8-1.7 3-3.3 2.5-12.3-3.4-25.1-5.1-38.1-5.1-13.5 0-26.7 1.8-39.4 5.5-1.7.5-3.4-.8-3.4-2.5v-15.8zm-84.4 37l9.2-9.2c7.6-7.6 19.9-7.6 27.5 0l7.7 7.7c1.1 1.1 1 3-.3 4-6.2 4.5-12.1 9.4-17.6 14.9-5.4 5.4-10.4 11.3-14.8 17.4-1 1.3-2.9 1.5-4 .3l-7.7-7.7c-7.6-7.5-7.6-19.8 0-27.4zm127.2 244.8c-70 0-126.6-56.7-126.6-126.6s56.7-126.6 126.6-126.6c70 0 126.6 56.6 126.6 126.6 0 69.8-56.7 126.6-126.6 126.6z"
				},
				{
					PackIconFontAwesomeKind.AlignCenterSolid,
					"M432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM108.1 96h231.81A12.09 12.09 0 0 0 352 83.9V44.09A12.09 12.09 0 0 0 339.91 32H108.1A12.09 12.09 0 0 0 96 44.09V83.9A12.1 12.1 0 0 0 108.1 96zm231.81 256A12.09 12.09 0 0 0 352 339.9v-39.81A12.09 12.09 0 0 0 339.91 288H108.1A12.09 12.09 0 0 0 96 300.09v39.81a12.1 12.1 0 0 0 12.1 12.1z"
				},
				{
					PackIconFontAwesomeKind.AlignJustifySolid,
					"M432 416H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-128H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-128H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-128H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"
				},
				{
					PackIconFontAwesomeKind.AlignLeftSolid,
					"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"
				},
				{
					PackIconFontAwesomeKind.AlignRightSolid,
					"M16 224h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm416 192H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm3.17-384H172.83A12.82 12.82 0 0 0 160 44.83v38.34A12.82 12.82 0 0 0 172.83 96h262.34A12.82 12.82 0 0 0 448 83.17V44.83A12.82 12.82 0 0 0 435.17 32zm0 256H172.83A12.82 12.82 0 0 0 160 300.83v38.34A12.82 12.82 0 0 0 172.83 352h262.34A12.82 12.82 0 0 0 448 339.17v-38.34A12.82 12.82 0 0 0 435.17 288z"
				},
				{
					PackIconFontAwesomeKind.AlipayBrands,
					"M377.74 32H70.26C31.41 32 0 63.41 0 102.26v307.48C0 448.59 31.41 480 70.26 480h307.48c38.52 0 69.76-31.08 70.26-69.6-45.96-25.62-110.59-60.34-171.6-88.44-32.07 43.97-84.14 81-148.62 81-70.59 0-93.73-45.3-97.04-76.37-3.97-39.01 14.88-81.5 99.52-81.5 35.38 0 79.35 10.25 127.13 24.96 16.53-30.09 26.45-60.34 26.45-60.34h-178.2v-16.7h92.08v-31.24H88.28v-19.01h109.44V92.34h50.92v50.42h109.44v19.01H248.63v31.24h88.77s-15.21 46.62-38.35 90.92c48.93 16.7 100.01 36.04 148.62 52.74V102.26C447.83 63.57 416.43 32 377.74 32zM47.28 322.95c.99 20.17 10.25 53.73 69.93 53.73 52.07 0 92.58-39.68 117.87-72.9-44.63-18.68-84.48-31.41-109.44-31.41-67.45 0-79.35 33.06-78.36 50.58z"
				},
				{
					PackIconFontAwesomeKind.AllergiesSolid,
					"M416 112c-17.6 0-32 14.4-32 32v72c0 4.4-3.6 8-8 8h-16c-4.4 0-8-3.6-8-8V64c0-17.6-14.4-32-32-32s-32 14.4-32 32v152c0 4.4-3.6 8-8 8h-16c-4.4 0-8-3.6-8-8V32c0-17.6-14.4-32-32-32s-32 14.4-32 32v184c0 4.4-3.6 8-8 8h-16c-4.4 0-8-3.6-8-8V64c0-17.6-14.4-32-32-32S96 46.4 96 64v241l-23.6-32.5c-13-17.9-38-21.8-55.9-8.8s-21.8 38-8.8 55.9l125.6 172.7c9 12.4 23.5 19.8 38.8 19.8h197.6c22.3 0 41.6-15.3 46.7-37l26.5-112.7c3.2-13.7 4.9-28.3 5.1-42.3V144c0-17.6-14.4-32-32-32zM176 416c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zm0-96c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zm64 128c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zm0-96c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zm64 32c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zm32 64c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zm32-128c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16z"
				},
				{
					PackIconFontAwesomeKind.AmazonBrands,
					"M257.2 162.7c-48.7 1.8-169.5 15.5-169.5 117.5 0 109.5 138.3 114 183.5 43.2 6.5 10.2 35.4 37.5 45.3 46.8l56.8-56S341 288.9 341 261.4V114.3C341 89 316.5 32 228.7 32 140.7 32 94 87 94 136.3l73.5 6.8c16.3-49.5 54.2-49.5 54.2-49.5 40.7-.1 35.5 29.8 35.5 69.1zm0 86.8c0 80-84.2 68-84.2 17.2 0-47.2 50.5-56.7 84.2-57.8v40.6zm136 163.5c-7.7 10-70 67-174.5 67S34.2 408.5 9.7 379c-6.8-7.7 1-11.3 5.5-8.3C88.5 415.2 203 488.5 387.7 401c7.5-3.7 13.3 2 5.5 12zm39.8 2.2c-6.5 15.8-16 26.8-21.2 31-5.5 4.5-9.5 2.7-6.5-3.8s19.3-46.5 12.7-55c-6.5-8.3-37-4.3-48-3.2-10.8 1-13 2-14-.3-2.3-5.7 21.7-15.5 37.5-17.5 15.7-1.8 41-.8 46 5.7 3.7 5.1 0 27.1-6.5 43.1z"
				},
				{
					PackIconFontAwesomeKind.AmazonPayBrands,
					"M14 325.3c2.3-4.2 5.2-4.9 9.7-2.5 10.4 5.6 20.6 11.4 31.2 16.7a595.88 595.88 0 0 0 127.4 46.3 616.61 616.61 0 0 0 63.2 11.8 603.33 603.33 0 0 0 95 5.2c17.4-.4 34.8-1.8 52.1-3.8a603.66 603.66 0 0 0 163.3-42.8c2.9-1.2 5.9-2 9.1-1.2 6.7 1.8 9 9 4.1 13.9a70 70 0 0 1-9.6 7.4c-30.7 21.1-64.2 36.4-99.6 47.9a473.31 473.31 0 0 1-75.1 17.6 431 431 0 0 1-53.2 4.8 21.3 21.3 0 0 0-2.5.3H308a21.3 21.3 0 0 0-2.5-.3c-3.6-.2-7.2-.3-10.7-.4a426.3 426.3 0 0 1-50.4-5.3A448.4 448.4 0 0 1 164 420a443.33 443.33 0 0 1-145.6-87c-1.8-1.6-3-3.8-4.4-5.7zM172 65.1l-4.3.6a80.92 80.92 0 0 0-38 15.1c-2.4 1.7-4.6 3.5-7.1 5.4a4.29 4.29 0 0 1-.4-1.4c-.4-2.7-.8-5.5-1.3-8.2-.7-4.6-3-6.6-7.6-6.6h-11.5c-6.9 0-8.2 1.3-8.2 8.2v209.3c0 1 0 2 .1 3 .2 3 2 4.9 4.9 5 7 .1 14.1.1 21.1 0 2.9 0 4.7-2 5-5 .1-1 .1-2 .1-3v-72.4c1.1.9 1.7 1.4 2.2 1.9 17.9 14.9 38.5 19.8 61 15.4 20.4-4 34.6-16.5 43.8-34.9 7-13.9 9.9-28.7 10.3-44.1.5-17.1-1.2-33.9-8.1-49.8-8.5-19.6-22.6-32.5-43.9-36.9-3.2-.7-6.5-1-9.8-1.5-2.8-.1-5.5-.1-8.3-.1zM124.6 107a3.48 3.48 0 0 1 1.7-3.3c13.7-9.5 28.8-14.5 45.6-13.2 14.9 1.1 27.1 8.4 33.5 25.9 3.9 10.7 4.9 21.8 4.9 33 0 10.4-.8 20.6-4 30.6-6.8 21.3-22.4 29.4-42.6 28.5-14-.6-26.2-6-37.4-13.9a3.57 3.57 0 0 1-1.7-3.3c.1-14.1 0-28.1 0-42.2s.1-28 0-42.1zm205.7-41.9c-1 .1-2 .3-2.9.4a148 148 0 0 0-28.9 4.1c-6.1 1.6-12 3.8-17.9 5.8-3.6 1.2-5.4 3.8-5.3 7.7.1 3.3-.1 6.6 0 9.9.1 4.8 2.1 6.1 6.8 4.9 7.8-2 15.6-4.2 23.5-5.7 12.3-2.3 24.7-3.3 37.2-1.4 6.5 1 12.6 2.9 16.8 8.4 3.7 4.8 5.1 10.5 5.3 16.4.3 8.3.2 16.6.3 24.9a7.84 7.84 0 0 1-.2 1.4c-.5-.1-.9 0-1.3-.1a180.56 180.56 0 0 0-32-4.9c-11.3-.6-22.5.1-33.3 3.9-12.9 4.5-23.3 12.3-29.4 24.9-4.7 9.8-5.4 20.2-3.9 30.7 2 14 9 24.8 21.4 31.7 11.9 6.6 24.8 7.4 37.9 5.4 15.1-2.3 28.5-8.7 40.3-18.4a7.36 7.36 0 0 1 1.6-1.1c.6 3.8 1.1 7.4 1.8 11 .6 3.1 2.5 5.1 5.4 5.2 5.4.1 10.9.1 16.3 0a4.84 4.84 0 0 0 4.8-4.7 26.2 26.2 0 0 0 .1-2.8v-106a80 80 0 0 0-.9-12.9c-1.9-12.9-7.4-23.5-19-30.4-6.7-4-14.1-6-21.8-7.1-3.6-.5-7.2-.8-10.8-1.3-3.9.1-7.9.1-11.9.1zm35 127.7a3.33 3.33 0 0 1-1.5 3c-11.2 8.1-23.5 13.5-37.4 14.9-5.7.6-11.4.4-16.8-1.8a20.08 20.08 0 0 1-12.4-13.3 32.9 32.9 0 0 1-.1-19.4c2.5-8.3 8.4-13 16.4-15.6a61.33 61.33 0 0 1 24.8-2.2c8.4.7 16.6 2.3 25 3.4 1.6.2 2.1 1 2.1 2.6-.1 4.8 0 9.5 0 14.3s-.2 9.4-.1 14.1zm259.9 129.4c-1-5-4.8-6.9-9.1-8.3a88.42 88.42 0 0 0-21-3.9 147.32 147.32 0 0 0-39.2 1.9c-14.3 2.7-27.9 7.3-40 15.6a13.75 13.75 0 0 0-3.7 3.5 5.11 5.11 0 0 0-.5 4c.4 1.5 2.1 1.9 3.6 1.8a16.2 16.2 0 0 0 2.2-.1c7.8-.8 15.5-1.7 23.3-2.5 11.4-1.1 22.9-1.8 34.3-.9a71.64 71.64 0 0 1 14.4 2.7c5.1 1.4 7.4 5.2 7.6 10.4.4 8-1.4 15.7-3.5 23.3-4.1 15.4-10 30.3-15.8 45.1a17.6 17.6 0 0 0-1 3c-.5 2.9 1.2 4.8 4.1 4.1a10.56 10.56 0 0 0 4.8-2.5 145.91 145.91 0 0 0 12.7-13.4c12.8-16.4 20.3-35.3 24.7-55.6.8-3.6 1.4-7.3 2.1-10.9v-17.3zM493.1 199q-19.35-53.55-38.7-107.2c-2-5.7-4.2-11.3-6.3-16.9-1.1-2.9-3.2-4.8-6.4-4.8-7.6-.1-15.2-.2-22.9-.1-2.5 0-3.7 2-3.2 4.5a43.1 43.1 0 0 0 1.9 6.1q29.4 72.75 59.1 145.5c1.7 4.1 2.1 7.6.2 11.8-3.3 7.3-5.9 15-9.3 22.3-3 6.5-8 11.4-15.2 13.3a42.13 42.13 0 0 1-15.4 1.1c-2.5-.2-5-.8-7.5-1-3.4-.2-5.1 1.3-5.2 4.8q-.15 5 0 9.9c.1 5.5 2 8 7.4 8.9a108.18 108.18 0 0 0 16.9 2c17.1.4 30.7-6.5 39.5-21.4a131.63 131.63 0 0 0 9.2-18.4q35.55-89.7 70.6-179.6a26.62 26.62 0 0 0 1.6-5.5c.4-2.8-.9-4.4-3.7-4.4-6.6-.1-13.3 0-19.9 0a7.54 7.54 0 0 0-7.7 5.2c-.5 1.4-1.1 2.7-1.6 4.1l-34.8 100c-2.5 7.2-5.1 14.5-7.7 22.2-.4-1.1-.6-1.7-.9-2.4z"
				},
				{
					PackIconFontAwesomeKind.AmbulanceSolid,
					"M624 352h-16V243.9c0-12.7-5.1-24.9-14.1-33.9L494 110.1c-9-9-21.2-14.1-33.9-14.1H416V48c0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48v320c0 26.5 21.5 48 48 48h16c0 53 43 96 96 96s96-43 96-96h128c0 53 43 96 96 96s96-43 96-96h48c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zM160 464c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm144-248c0 4.4-3.6 8-8 8h-56v56c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-56h-56c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h56v-56c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v56h56c4.4 0 8 3.6 8 8v48zm176 248c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm80-208H416V144h44.1l99.9 99.9V256z"
				},
				{
					PackIconFontAwesomeKind.AmericanSignLanguageInterpretingSolid,
					"M290.547 189.039c-20.295-10.149-44.147-11.199-64.739-3.89 42.606 0 71.208 20.475 85.578 50.576 8.576 17.899-5.148 38.071-23.617 38.071 18.429 0 32.211 20.136 23.617 38.071-14.725 30.846-46.123 50.854-80.298 50.854-.557 0-94.471-8.615-94.471-8.615l-66.406 33.347c-9.384 4.693-19.815.379-23.895-7.781L1.86 290.747c-4.167-8.615-1.111-18.897 6.946-23.621l58.072-33.069L108 159.861c6.39-57.245 34.731-109.767 79.743-146.726 11.391-9.448 28.341-7.781 37.51 3.613 9.446 11.394 7.78 28.067-3.612 37.516-12.503 10.559-23.618 22.509-32.509 35.57 21.672-14.729 46.679-24.732 74.186-28.067 14.725-1.945 28.063 8.336 29.73 23.065 1.945 14.728-8.336 28.067-23.062 29.734-16.116 1.945-31.12 7.503-44.178 15.284 26.114-5.713 58.712-3.138 88.079 11.115 13.336 6.669 18.893 22.509 12.224 35.848-6.389 13.06-22.504 18.617-35.564 12.226zm-27.229 69.472c-6.112-12.505-18.338-20.286-32.231-20.286a35.46 35.46 0 0 0-35.565 35.57c0 21.428 17.808 35.57 35.565 35.57 13.893 0 26.119-7.781 32.231-20.286 4.446-9.449 13.614-15.006 23.339-15.284-9.725-.277-18.893-5.835-23.339-15.284zm374.821-37.237c4.168 8.615 1.111 18.897-6.946 23.621l-58.071 33.069L532 352.16c-6.39 57.245-34.731 109.767-79.743 146.726-10.932 9.112-27.799 8.144-37.51-3.613-9.446-11.394-7.78-28.067 3.613-37.516 12.503-10.559 23.617-22.509 32.508-35.57-21.672 14.729-46.679 24.732-74.186 28.067-10.021 2.506-27.552-5.643-29.73-23.065-1.945-14.728 8.336-28.067 23.062-29.734 16.116-1.946 31.12-7.503 44.178-15.284-26.114 5.713-58.712 3.138-88.079-11.115-13.336-6.669-18.893-22.509-12.224-35.848 6.389-13.061 22.505-18.619 35.565-12.227 20.295 10.149 44.147 11.199 64.739 3.89-42.606 0-71.208-20.475-85.578-50.576-8.576-17.899 5.148-38.071 23.617-38.071-18.429 0-32.211-20.136-23.617-38.071 14.033-29.396 44.039-50.887 81.966-50.854l92.803 8.615 66.406-33.347c9.408-4.704 19.828-.354 23.894 7.781l44.455 88.926zm-229.227-18.618c-13.893 0-26.119 7.781-32.231 20.286-4.446 9.449-13.614 15.006-23.339 15.284 9.725.278 18.893 5.836 23.339 15.284 6.112 12.505 18.338 20.286 32.231 20.286a35.46 35.46 0 0 0 35.565-35.57c0-21.429-17.808-35.57-35.565-35.57z"
				},
				{
					PackIconFontAwesomeKind.AmiliaBrands,
					"M240.1 32c-61.9 0-131.5 16.9-184.2 55.4-5.1 3.1-9.1 9.2-7.2 19.4 1.1 5.1 5.1 27.4 10.2 39.6 4.1 10.2 14.2 10.2 20.3 6.1 32.5-22.3 96.5-47.7 152.3-47.7 57.9 0 58.9 28.4 58.9 73.1v38.5C203 227.7 78.2 251 46.7 264.2 11.2 280.5 16.3 357.7 16.3 376s15.2 104 124.9 104c47.8 0 113.7-20.7 153.3-42.1v25.4c0 3 2.1 8.2 6.1 9.1 3.1 1 50.7 2 59.9 2s62.5.3 66.5-.7c4.1-1 5.1-6.1 5.1-9.1V168c-.1-80.3-57.9-136-192-136zm50.2 348c-21.4 13.2-48.7 24.4-79.1 24.4-52.8 0-58.9-33.5-59-44.7 0-12.2-3-42.7 18.3-52.9 24.3-13.2 75.1-29.4 119.8-33.5z"
				},
				{
					PackIconFontAwesomeKind.AnchorSolid,
					"M12.971 352h32.394C67.172 454.735 181.944 512 288 512c106.229 0 220.853-57.38 242.635-160h32.394c10.691 0 16.045-12.926 8.485-20.485l-67.029-67.029c-4.686-4.686-12.284-4.686-16.971 0l-67.029 67.029c-7.56 7.56-2.206 20.485 8.485 20.485h35.146c-20.29 54.317-84.963 86.588-144.117 94.015V256h52c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12h-52v-5.47c37.281-13.178 63.995-48.725 64-90.518C384.005 43.772 341.605.738 289.37.01 235.723-.739 192 42.525 192 96c0 41.798 26.716 77.35 64 90.53V192h-52c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h52v190.015c-58.936-7.399-123.82-39.679-144.117-94.015h35.146c10.691 0 16.045-12.926 8.485-20.485l-67.029-67.029c-4.686-4.686-12.284-4.686-16.971 0L4.485 331.515C-3.074 339.074 2.28 352 12.971 352zM288 64c17.645 0 32 14.355 32 32s-14.355 32-32 32-32-14.355-32-32 14.355-32 32-32z"
				},
				{
					PackIconFontAwesomeKind.AndroidBrands,
					"M420.55,301.93a24,24,0,1,1,24-24,24,24,0,0,1-24,24m-265.1,0a24,24,0,1,1,24-24,24,24,0,0,1-24,24m273.7-144.48,47.94-83a10,10,0,1,0-17.27-10h0l-48.54,84.07a301.25,301.25,0,0,0-246.56,0L116.18,64.45a10,10,0,1,0-17.27,10h0l47.94,83C64.53,202.22,8.24,285.55,0,384H576c-8.24-98.45-64.54-181.78-146.85-226.55"
				},
				{
					PackIconFontAwesomeKind.AngellistBrands,
					"M347.1 215.4c11.7-32.6 45.4-126.9 45.4-157.1 0-26.6-15.7-48.9-43.7-48.9-44.6 0-84.6 131.7-97.1 163.1C242 144 196.6 0 156.6 0c-31.1 0-45.7 22.9-45.7 51.7 0 35.3 34.2 126.8 46.6 162-6.3-2.3-13.1-4.3-20-4.3-23.4 0-48.3 29.1-48.3 52.6 0 8.9 4.9 21.4 8 29.7-36.9 10-51.1 34.6-51.1 71.7C46 435.6 114.4 512 210.6 512c118 0 191.4-88.6 191.4-202.9 0-43.1-6.9-82-54.9-93.7zM311.7 108c4-12.3 21.1-64.3 37.1-64.3 8.6 0 10.9 8.9 10.9 16 0 19.1-38.6 124.6-47.1 148l-34-6 33.1-93.7zM142.3 48.3c0-11.9 14.5-45.7 46.3 47.1l34.6 100.3c-15.6-1.3-27.7-3-35.4 1.4-10.9-28.8-45.5-119.7-45.5-148.8zM140 244c29.3 0 67.1 94.6 67.1 107.4 0 5.1-4.9 11.4-10.6 11.4-20.9 0-76.9-76.9-76.9-97.7.1-7.7 12.7-21.1 20.4-21.1zm184.3 186.3c-29.1 32-66.3 48.6-109.7 48.6-59.4 0-106.3-32.6-128.9-88.3-17.1-43.4 3.8-68.3 20.6-68.3 11.4 0 54.3 60.3 54.3 73.1 0 4.9-7.7 8.3-11.7 8.3-16.1 0-22.4-15.5-51.1-51.4-29.7 29.7 20.5 86.9 58.3 86.9 26.1 0 43.1-24.2 38-42 3.7 0 8.3.3 11.7-.6 1.1 27.1 9.1 59.4 41.7 61.7 0-.9 2-7.1 2-7.4 0-17.4-10.6-32.6-10.6-50.3 0-28.3 21.7-55.7 43.7-71.7 8-6 17.7-9.7 27.1-13.1 9.7-3.7 20-8 27.4-15.4-1.1-11.2-5.7-21.1-16.9-21.1-27.7 0-120.6 4-120.6-39.7 0-6.7.1-13.1 17.4-13.1 32.3 0 114.3 8 138.3 29.1 18.1 16.1 24.3 113.2-31 174.7zm-98.6-126c9.7 3.1 19.7 4 29.7 6-7.4 5.4-14 12-20.3 19.1-2.8-8.5-6.2-16.8-9.4-25.1z"
				},
				{
					PackIconFontAwesomeKind.AngleDoubleDownSolid,
					"M143 256.3L7 120.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0L313 86.3c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.4 9.5-24.6 9.5-34 .1zm34 192l136-136c9.4-9.4 9.4-24.6 0-33.9l-22.6-22.6c-9.4-9.4-24.6-9.4-33.9 0L160 352.1l-96.4-96.4c-9.4-9.4-24.6-9.4-33.9 0L7 278.3c-9.4 9.4-9.4 24.6 0 33.9l136 136c9.4 9.5 24.6 9.5 34 .1z"
				},
				{
					PackIconFontAwesomeKind.AngleDoubleLeftSolid,
					"M223.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L319.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L393.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34zm-192 34l136 136c9.4 9.4 24.6 9.4 33.9 0l22.6-22.6c9.4-9.4 9.4-24.6 0-33.9L127.9 256l96.4-96.4c9.4-9.4 9.4-24.6 0-33.9L201.7 103c-9.4-9.4-24.6-9.4-33.9 0l-136 136c-9.5 9.4-9.5 24.6-.1 34z"
				},
				{
					PackIconFontAwesomeKind.AngleDoubleRightSolid,
					"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34zm192-34l-136-136c-9.4-9.4-24.6-9.4-33.9 0l-22.6 22.6c-9.4 9.4-9.4 24.6 0 33.9l96.4 96.4-96.4 96.4c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l136-136c9.4-9.2 9.4-24.4 0-33.8z"
				},
				{
					PackIconFontAwesomeKind.AngleDoubleUpSolid,
					"M177 255.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 351.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 425.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1zm-34-192L7 199.7c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l96.4-96.4 96.4 96.4c9.4 9.4 24.6 9.4 33.9 0l22.6-22.6c9.4-9.4 9.4-24.6 0-33.9l-136-136c-9.2-9.4-24.4-9.4-33.8 0z"
				},
				{
					PackIconFontAwesomeKind.AngleDownSolid,
					"M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"
				},
				{
					PackIconFontAwesomeKind.AngleLeftSolid,
					"M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"
				},
				{
					PackIconFontAwesomeKind.AngleRightSolid,
					"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"
				},
				{
					PackIconFontAwesomeKind.AngleUpSolid,
					"M177 159.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 255.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 329.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1z"
				},
				{
					PackIconFontAwesomeKind.AngrycreativeBrands,
					"M640 238.2l-3.2 28.2-34.5 2.3-2 18.1 34.5-2.3-3.2 28.2-34.4 2.2-2.3 20.1 34.4-2.2-3 26.1-64.7 4.1 12.7-113.2L527 365.2l-31.9 2-23.8-117.8 30.3-2 13.6 79.4 31.7-82.4 93.1-6.2zM426.8 371.5l28.3-1.8L468 249.6l-28.4 1.9-12.8 120zM162 388.1l-19.4-36-3.5 37.4-28.2 1.7 2.7-29.1c-11 18-32 34.3-56.9 35.8C23.9 399.9-3 377 .3 339.7c2.6-29.3 26.7-62.8 67.5-65.4 37.7-2.4 47.6 23.2 51.3 28.8l2.8-30.8 38.9-2.5c20.1-1.3 38.7 3.7 42.5 23.7l2.6-26.6 64.8-4.2-2.7 27.9-36.4 2.4-1.7 17.9 36.4-2.3-2.7 27.9-36.4 2.3-1.9 19.9 36.3-2.3-2.1 20.8 55-117.2 23.8-1.6L370.4 369l8.9-85.6-22.3 1.4 2.9-27.9 75-4.9-3 28-24.3 1.6-9.7 91.9-58 3.7-4.3-15.6-39.4 2.5-8 16.3-126.2 7.7zm-44.3-70.2l-26.4 1.7C84.6 307.2 76.9 303 65 303.8c-19 1.2-33.3 17.5-34.6 33.3-1.4 16 7.3 32.5 28.7 31.2 12.8-.8 21.3-8.6 28.9-18.9l27-1.7 2.7-29.8zm56.1-7.7c1.2-12.9-7.6-13.6-26.1-12.4l-2.7 28.5c14.2-.9 27.5-2.1 28.8-16.1zm21.1 70.8l5.8-60c-5 13.5-14.7 21.1-27.9 26.6l22.1 33.4zm135.4-45l-7.9-37.8-15.8 39.3 23.7-1.5zm-170.1-74.6l-4.3-17.5-39.6 2.6-8.1 18.2-31.9 2.1 57-121.9 23.9-1.6 30.7 102 9.9-104.7 27-1.8 37.8 63.6 6.5-66.6 28.5-1.9-4 41.2c7.4-13.5 22.9-44.7 63.6-47.5 40.5-2.8 52.4 29.3 53.4 30.3l3.3-32 39.3-2.7c12.7-.9 27.8.3 36.3 9.7l-4.4-11.9 32.2-2.2 12.9 43.2 23-45.7 31-2.2-43.6 78.4-4.8 44.3-28.4 1.9 4.8-44.3-15.8-43c1 22.3-9.2 40.1-32 49.6l25.2 38.8-36.4 2.4-19.2-36.8-4 38.3-28.4 1.9 3.3-31.5c-6.7 9.3-19.7 35.4-59.6 38-26.2 1.7-45.6-10.3-55.4-39.2l-4 40.3-25 1.6-37.6-63.3-6.3 66.2-56.8 3.7zm276.6-82.1c10.2-.7 17.5-2.1 21.6-4.3 4.5-2.4 7-6.4 7.6-12.1.6-5.3-.6-8.8-3.4-10.4-3.6-2.1-10.6-2.8-22.9-2l-2.9 28.8zM327.7 214c5.6 5.9 12.7 8.5 21.3 7.9 4.7-.3 9.1-1.8 13.3-4.1 5.5-3 10.6-8 15.1-14.3l-34.2 2.3 2.4-23.9 63.1-4.3 1.2-12-31.2 2.1c-4.1-3.7-7.8-6.6-11.1-8.1-4-1.7-8.1-2.8-12.2-2.5-8 .5-15.3 3.6-22 9.2-7.7 6.4-12 14.5-12.9 24.4-1.1 9.6 1.4 17.3 7.2 23.3zm-201.3 8.2l23.8-1.6-8.3-37.6-15.5 39.2z"
				},
				{
					PackIconFontAwesomeKind.AngryRegular,
					"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm0-144c-33.6 0-65.2 14.8-86.8 40.6-8.5 10.2-7.1 25.3 3.1 33.8s25.3 7.2 33.8-3c24.8-29.7 75-29.7 99.8 0 8.1 9.7 23.2 11.9 33.8 3 10.2-8.5 11.5-23.6 3.1-33.8-21.6-25.8-53.2-40.6-86.8-40.6zm-48-72c10.3 0 19.9-6.7 23-17.1 3.8-12.7-3.4-26.1-16.1-29.9l-80-24c-12.8-3.9-26.1 3.4-29.9 16.1-3.8 12.7 3.4 26.1 16.1 29.9l28.2 8.5c-3.1 4.9-5.3 10.4-5.3 16.6 0 17.7 14.3 32 32 32s32-14.4 32-32.1zm199-54.9c-3.8-12.7-17.1-19.9-29.9-16.1l-80 24c-12.7 3.8-19.9 17.2-16.1 29.9 3.1 10.4 12.7 17.1 23 17.1 0 17.7 14.3 32 32 32s32-14.3 32-32c0-6.2-2.2-11.7-5.3-16.6l28.2-8.5c12.7-3.7 19.9-17.1 16.1-29.8z"
				},
				{
					PackIconFontAwesomeKind.AngrySolid,
					"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zM136 240c0-9.3 4.1-17.5 10.5-23.4l-31-9.3c-8.5-2.5-13.3-11.5-10.7-19.9 2.5-8.5 11.4-13.2 19.9-10.7l80 24c8.5 2.5 13.3 11.5 10.7 19.9-2.1 6.9-8.4 11.4-15.3 11.4-.5 0-1.1-.2-1.7-.2.7 2.7 1.7 5.3 1.7 8.2 0 17.7-14.3 32-32 32S136 257.7 136 240zm168 154.2c-27.8-33.4-84.2-33.4-112.1 0-13.5 16.3-38.2-4.2-24.6-20.5 20-24 49.4-37.8 80.6-37.8s60.6 13.8 80.6 37.8c13.8 16.5-11.1 36.6-24.5 20.5zm76.6-186.9l-31 9.3c6.3 5.8 10.5 14.1 10.5 23.4 0 17.7-14.3 32-32 32s-32-14.3-32-32c0-2.9.9-5.6 1.7-8.2-.6.1-1.1.2-1.7.2-6.9 0-13.2-4.5-15.3-11.4-2.5-8.5 2.3-17.4 10.7-19.9l80-24c8.4-2.5 17.4 2.3 19.9 10.7 2.5 8.5-2.3 17.4-10.8 19.9z"
				},
				{
					PackIconFontAwesomeKind.AngularBrands,
					"M185.7 268.1h76.2l-38.1-91.6-38.1 91.6zM223.8 32L16 106.4l31.8 275.7 176 97.9 176-97.9 31.8-275.7zM354 373.8h-48.6l-26.2-65.4H168.6l-26.2 65.4H93.7L223.8 81.5z"
				},
				{
					PackIconFontAwesomeKind.AnkhSolid,
					"M296 256h-44.62C272.46 222.01 288 181.65 288 144 288 55.63 230.69 0 160 0S32 55.63 32 144c0 37.65 15.54 78.01 36.62 112H24c-13.25 0-24 10.74-24 24v32c0 13.25 10.75 24 24 24h96v152c0 13.25 10.75 24 24 24h32c13.25 0 24-10.75 24-24V336h96c13.25 0 24-10.75 24-24v-32c0-13.26-10.75-24-24-24zM160 80c29.61 0 48 24.52 48 64 0 34.66-27.14 78.14-48 100.87-20.86-22.72-48-66.21-48-100.87 0-39.48 18.39-64 48-64z"
				},
				{
					PackIconFontAwesomeKind.ApperBrands,
					"M42.1 239.1c22.2 0 29 2.8 33.5 14.6h.8v-22.9c0-11.3-4.8-15.4-17.9-15.4-11.3 0-14.4 2.5-15.1 12.8H4.8c.3-13.9 1.5-19.1 5.8-24.4C17.9 195 29.5 192 56.7 192c33 0 47.1 5 53.9 18.9 2 4.3 4 15.6 4 23.7v76.3H76.3l1.3-19.1h-1c-5.3 15.6-13.6 20.4-35.5 20.4-30.3 0-41.1-10.1-41.1-37.3 0-25.2 12.3-35.8 42.1-35.8zm17.1 48.1c13.1 0 16.9-3 16.9-13.4 0-9.1-4.3-11.6-19.6-11.6-13.1 0-17.9 3-17.9 12.1-.1 10.4 3.7 12.9 20.6 12.9zm77.8-94.9h38.3l-1.5 20.6h.8c9.1-17.1 15.9-20.9 37.5-20.9 14.4 0 24.7 3 31.5 9.1 9.8 8.6 12.8 20.4 12.8 48.1 0 30-3 43.1-12.1 52.9-6.8 7.3-16.4 10.1-33.2 10.1-20.4 0-29.2-5.5-33.8-21.2h-.8v70.3H137v-169zm80.9 60.7c0-27.5-3.3-32.5-20.7-32.5-16.9 0-20.7 5-20.7 28.7 0 28 3.5 33.5 21.2 33.5 16.4 0 20.2-5.6 20.2-29.7zm57.9-60.7h38.3l-1.5 20.6h.8c9.1-17.1 15.9-20.9 37.5-20.9 14.4 0 24.7 3 31.5 9.1 9.8 8.6 12.8 20.4 12.8 48.1 0 30-3 43.1-12.1 52.9-6.8 7.3-16.4 10.1-33.3 10.1-20.4 0-29.2-5.5-33.8-21.2h-.8v70.3h-39.5v-169zm80.9 60.7c0-27.5-3.3-32.5-20.7-32.5-16.9 0-20.7 5-20.7 28.7 0 28 3.5 33.5 21.2 33.5 16.4 0 20.2-5.6 20.2-29.7zm53.8-3.8c0-25.4 3.3-37.8 12.3-45.8 8.8-8.1 22.2-11.3 45.1-11.3 42.8 0 55.7 12.8 55.7 55.7v11.1h-75.3c-.3 2-.3 4-.3 4.8 0 16.9 4.5 21.9 20.1 21.9 13.9 0 17.9-3 17.9-13.9h37.5v2.3c0 9.8-2.5 18.9-6.8 24.7-7.3 9.8-19.6 13.6-44.3 13.6-27.5 0-41.6-3.3-50.6-12.3-8.5-8.5-11.3-21.3-11.3-50.8zm76.4-11.6c-.3-1.8-.3-3.3-.3-3.8 0-12.3-3.3-14.6-19.6-14.6-14.4 0-17.1 3-18.1 15.1l-.3 3.3h38.3zm55.6-45.3h38.3l-1.8 19.9h.7c6.8-14.9 14.4-20.2 29.7-20.2 10.8 0 19.1 3.3 23.4 9.3 5.3 7.3 6.8 14.4 6.8 34 0 1.5 0 5 .2 9.3h-35c.3-1.8.3-3.3.3-4 0-15.4-2-19.4-10.3-19.4-6.3 0-10.8 3.3-13.1 9.3-1 3-1 4.3-1 12.3v68h-38.3V192.3z"
				},
				{
					PackIconFontAwesomeKind.AppleAltSolid,
					"M350.85 129c25.97 4.67 47.27 18.67 63.92 42 14.65 20.67 24.64 46.67 29.96 78 4.67 28.67 4.32 57.33-1 86-7.99 47.33-23.97 87-47.94 119-28.64 38.67-64.59 58-107.87 58-10.66 0-22.3-3.33-34.96-10-8.66-5.33-18.31-8-28.97-8s-20.3 2.67-28.97 8c-12.66 6.67-24.3 10-34.96 10-43.28 0-79.23-19.33-107.87-58-23.97-32-39.95-71.67-47.94-119-5.32-28.67-5.67-57.33-1-86 5.32-31.33 15.31-57.33 29.96-78 16.65-23.33 37.95-37.33 63.92-42 15.98-2.67 37.95-.33 65.92 7 23.97 6.67 44.28 14.67 60.93 24 16.65-9.33 36.96-17.33 60.93-24 27.98-7.33 49.96-9.67 65.94-7zm-54.94-41c-9.32 8.67-21.65 15-36.96 19-10.66 3.33-22.3 5-34.96 5l-14.98-1c-1.33-9.33-1.33-20 0-32 2.67-24 10.32-42.33 22.97-55 9.32-8.67 21.65-15 36.96-19 10.66-3.33 22.3-5 34.96-5l14.98 1 1 15c0 12.67-1.67 24.33-4.99 35-3.99 15.33-10.31 27.67-18.98 37z"
				},
				{
					PackIconFontAwesomeKind.AppleBrands,
					"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"
				},
				{
					PackIconFontAwesomeKind.ApplePayBrands,
					"M116.9 158.5c-7.5 8.9-19.5 15.9-31.5 14.9-1.5-12 4.4-24.8 11.3-32.6 7.5-9.1 20.6-15.6 31.3-16.1 1.2 12.4-3.7 24.7-11.1 33.8m10.9 17.2c-17.4-1-32.3 9.9-40.5 9.9-8.4 0-21-9.4-34.8-9.1-17.9.3-34.5 10.4-43.6 26.5-18.8 32.3-4.9 80 13.3 106.3 8.9 13 19.5 27.3 33.5 26.8 13.3-.5 18.5-8.6 34.5-8.6 16.1 0 20.8 8.6 34.8 8.4 14.5-.3 23.6-13 32.5-26 10.1-14.8 14.3-29.1 14.5-29.9-.3-.3-28-10.9-28.3-42.9-.3-26.8 21.9-39.5 22.9-40.3-12.5-18.6-32-20.6-38.8-21.1m100.4-36.2v194.9h30.3v-66.6h41.9c38.3 0 65.1-26.3 65.1-64.3s-26.4-64-64.1-64h-73.2zm30.3 25.5h34.9c26.3 0 41.3 14 41.3 38.6s-15 38.8-41.4 38.8h-34.8V165zm162.2 170.9c19 0 36.6-9.6 44.6-24.9h.6v23.4h28v-97c0-28.1-22.5-46.3-57.1-46.3-32.1 0-55.9 18.4-56.8 43.6h27.3c2.3-12 13.4-19.9 28.6-19.9 18.5 0 28.9 8.6 28.9 24.5v10.8l-37.8 2.3c-35.1 2.1-54.1 16.5-54.1 41.5.1 25.2 19.7 42 47.8 42zm8.2-23.1c-16.1 0-26.4-7.8-26.4-19.6 0-12.3 9.9-19.4 28.8-20.5l33.6-2.1v11c0 18.2-15.5 31.2-36 31.2zm102.5 74.6c29.5 0 43.4-11.3 55.5-45.4L640 193h-30.8l-35.6 115.1h-.6L537.4 193h-31.6L557 334.9l-2.8 8.6c-4.6 14.6-12.1 20.3-25.5 20.3-2.4 0-7-.3-8.9-.5v23.4c1.8.4 9.3.7 11.6.7z"
				},
				{
					PackIconFontAwesomeKind.AppStoreBrands,
					"M255.9 120.9l9.1-15.7c5.6-9.8 18.1-13.1 27.9-7.5 9.8 5.6 13.1 18.1 7.5 27.9l-87.5 151.5h63.3c20.5 0 32 24.1 23.1 40.8H113.8c-11.3 0-20.4-9.1-20.4-20.4 0-11.3 9.1-20.4 20.4-20.4h52l66.6-115.4-20.8-36.1c-5.6-9.8-2.3-22.2 7.5-27.9 9.8-5.6 22.2-2.3 27.9 7.5l8.9 15.7zm-78.7 218l-19.6 34c-5.6 9.8-18.1 13.1-27.9 7.5-9.8-5.6-13.1-18.1-7.5-27.9l14.6-25.2c16.4-5.1 29.8-1.2 40.4 11.6zm168.9-61.7h53.1c11.3 0 20.4 9.1 20.4 20.4 0 11.3-9.1 20.4-20.4 20.4h-29.5l19.9 34.5c5.6 9.8 2.3 22.2-7.5 27.9-9.8 5.6-22.2 2.3-27.9-7.5-33.5-58.1-58.7-101.6-75.4-130.6-17.1-29.5-4.9-59.1 7.2-69.1 13.4 23 33.4 57.7 60.1 104zM256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm216 248c0 118.7-96.1 216-216 216-118.7 0-216-96.1-216-216 0-118.7 96.1-216 216-216 118.7 0 216 96.1 216 216z"
				},
				{
					PackIconFontAwesomeKind.AppStoreIosBrands,
					"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM127 384.5c-5.5 9.6-17.8 12.8-27.3 7.3-9.6-5.5-12.8-17.8-7.3-27.3l14.3-24.7c16.1-4.9 29.3-1.1 39.6 11.4L127 384.5zm138.9-53.9H84c-11 0-20-9-20-20s9-20 20-20h51l65.4-113.2-20.5-35.4c-5.5-9.6-2.2-21.8 7.3-27.3 9.6-5.5 21.8-2.2 27.3 7.3l8.9 15.4 8.9-15.4c5.5-9.6 17.8-12.8 27.3-7.3 9.6 5.5 12.8 17.8 7.3 27.3l-85.8 148.6h62.1c20.2 0 31.5 23.7 22.7 40zm98.1 0h-29l19.6 33.9c5.5 9.6 2.2 21.8-7.3 27.3-9.6 5.5-21.8 2.2-27.3-7.3-32.9-56.9-57.5-99.7-74-128.1-16.7-29-4.8-58 7.1-67.8 13.1 22.7 32.7 56.7 58.9 102h52c11 0 20 9 20 20 0 11.1-9 20-20 20z"
				},
				{
					PackIconFontAwesomeKind.ArchiveSolid,
					"M32 448c0 17.7 14.3 32 32 32h384c17.7 0 32-14.3 32-32V160H32v288zm160-212c0-6.6 5.4-12 12-12h104c6.6 0 12 5.4 12 12v8c0 6.6-5.4 12-12 12H204c-6.6 0-12-5.4-12-12v-8zM480 32H32C14.3 32 0 46.3 0 64v48c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16V64c0-17.7-14.3-32-32-32z"
				},
				{
					PackIconFontAwesomeKind.ArchwaySolid,
					"M560 448h-16V96H32v352H16.02c-8.84 0-16 7.16-16 16v32c0 8.84 7.16 16 16 16H176c8.84 0 16-7.16 16-16V320c0-53.02 42.98-96 96-96s96 42.98 96 96l.02 160v16c0 8.84 7.16 16 16 16H560c8.84 0 16-7.16 16-16v-32c0-8.84-7.16-16-16-16zm0-448H16C7.16 0 0 7.16 0 16v32c0 8.84 7.16 16 16 16h544c8.84 0 16-7.16 16-16V16c0-8.84-7.16-16-16-16z"
				},
				{
					PackIconFontAwesomeKind.ArrowAltCircleDownRegular,
					"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm-32-316v116h-67c-10.7 0-16 12.9-8.5 20.5l99 99c4.7 4.7 12.3 4.7 17 0l99-99c7.6-7.6 2.2-20.5-8.5-20.5h-67V140c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12z"
				},
				{
					PackIconFontAwesomeKind.ArrowAltCircleDownSolid,
					"M504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zM212 140v116h-70.9c-10.7 0-16.1 13-8.5 20.5l114.9 114.3c4.7 4.7 12.2 4.7 16.9 0l114.9-114.3c7.6-7.6 2.2-20.5-8.5-20.5H300V140c0-6.6-5.4-12-12-12h-64c-6.6 0-12 5.4-12 12z"
				},
				{
					PackIconFontAwesomeKind.ArrowAltCircleLeftRegular,
					"M8 256c0 137 111 248 248 248s248-111 248-248S393 8 256 8 8 119 8 256zm448 0c0 110.5-89.5 200-200 200S56 366.5 56 256 145.5 56 256 56s200 89.5 200 200zm-72-20v40c0 6.6-5.4 12-12 12H256v67c0 10.7-12.9 16-20.5 8.5l-99-99c-4.7-4.7-4.7-12.3 0-17l99-99c7.6-7.6 20.5-2.2 20.5 8.5v67h116c6.6 0 12 5.4 12 12z"
				},
				{
					PackIconFontAwesomeKind.ArrowAltCircleLeftSolid,
					"M256 504C119 504 8 393 8 256S119 8 256 8s248 111 248 248-111 248-248 248zm116-292H256v-70.9c0-10.7-13-16.1-20.5-8.5L121.2 247.5c-4.7 4.7-4.7 12.2 0 16.9l114.3 114.9c7.6 7.6 20.5 2.2 20.5-8.5V300h116c6.6 0 12-5.4 12-12v-64c0-6.6-5.4-12-12-12z"
				},
				{
					PackIconFontAwesomeKind.ArrowAltCircleRightRegular,
					"M504 256C504 119 393 8 256 8S8 119 8 256s111 248 248 248 248-111 248-248zm-448 0c0-110.5 89.5-200 200-200s200 89.5 200 200-89.5 200-200 200S56 366.5 56 256zm72 20v-40c0-6.6 5.4-12 12-12h116v-67c0-10.7 12.9-16 20.5-8.5l99 99c4.7 4.7 4.7 12.3 0 17l-99 99c-7.6 7.6-20.5 2.2-20.5-8.5v-67H140c-6.6 0-12-5.4-12-12z"
				},
				{
					PackIconFontAwesomeKind.ArrowAltCircleRightSolid,
					"M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zM140 300h116v70.9c0 10.7 13 16.1 20.5 8.5l114.3-114.9c4.7-4.7 4.7-12.2 0-16.9l-114.3-115c-7.6-7.6-20.5-2.2-20.5 8.5V212H140c-6.6 0-12 5.4-12 12v64c0 6.6 5.4 12 12 12z"
				},
				{
					PackIconFontAwesomeKind.ArrowAltCircleUpRegular,
					"M256 504c137 0 248-111 248-248S393 8 256 8 8 119 8 256s111 248 248 248zm0-448c110.5 0 200 89.5 200 200s-89.5 200-200 200S56 366.5 56 256 145.5 56 256 56zm20 328h-40c-6.6 0-12-5.4-12-12V256h-67c-10.7 0-16-12.9-8.5-20.5l99-99c4.7-4.7 12.3-4.7 17 0l99 99c7.6 7.6 2.2 20.5-8.5 20.5h-67v116c0 6.6-5.4 12-12 12z"
				},
				{
					PackIconFontAwesomeKind.ArrowAltCircleUpSolid,
					"M8 256C8 119 119 8 256 8s248 111 248 248-111 248-248 248S8 393 8 256zm292 116V256h70.9c10.7 0 16.1-13 8.5-20.5L264.5 121.2c-4.7-4.7-12.2-4.7-16.9 0l-115 114.3c-7.6 7.6-2.2 20.5 8.5 20.5H212v116c0 6.6 5.4 12 12 12h64c6.6 0 12-5.4 12-12z"
				},
				{
					PackIconFontAwesomeKind.ArrowCircleDownSolid,
					"M504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-143.6-28.9L288 302.6V120c0-13.3-10.7-24-24-24h-16c-13.3 0-24 10.7-24 24v182.6l-72.4-75.5c-9.3-9.7-24.8-9.9-34.3-.4l-10.9 11c-9.4 9.4-9.4 24.6 0 33.9L239 404.3c9.4 9.4 24.6 9.4 33.9 0l132.7-132.7c9.4-9.4 9.4-24.6 0-33.9l-10.9-11c-9.5-9.5-25-9.3-34.3.4z"
				},
				{
					PackIconFontAwesomeKind.ArrowCircleLeftSolid,
					"M256 504C119 504 8 393 8 256S119 8 256 8s248 111 248 248-111 248-248 248zm28.9-143.6L209.4 288H392c13.3 0 24-10.7 24-24v-16c0-13.3-10.7-24-24-24H209.4l75.5-72.4c9.7-9.3 9.9-24.8.4-34.3l-11-10.9c-9.4-9.4-24.6-9.4-33.9 0L107.7 239c-9.4 9.4-9.4 24.6 0 33.9l132.7 132.7c9.4 9.4 24.6 9.4 33.9 0l11-10.9c9.5-9.5 9.3-25-.4-34.3z"
				},
				{
					PackIconFontAwesomeKind.ArrowCircleRightSolid,
					"M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zm-28.9 143.6l75.5 72.4H120c-13.3 0-24 10.7-24 24v16c0 13.3 10.7 24 24 24h182.6l-75.5 72.4c-9.7 9.3-9.9 24.8-.4 34.3l11 10.9c9.4 9.4 24.6 9.4 33.9 0L404.3 273c9.4-9.4 9.4-24.6 0-33.9L271.6 106.3c-9.4-9.4-24.6-9.4-33.9 0l-11 10.9c-9.5 9.6-9.3 25.1.4 34.4z"
				},
				{
					PackIconFontAwesomeKind.ArrowCircleUpSolid,
					"M8 256C8 119 119 8 256 8s248 111 248 248-111 248-248 248S8 393 8 256zm143.6 28.9l72.4-75.5V392c0 13.3 10.7 24 24 24h16c13.3 0 24-10.7 24-24V209.4l72.4 75.5c9.3 9.7 24.8 9.9 34.3.4l10.9-11c9.4-9.4 9.4-24.6 0-33.9L273 107.7c-9.4-9.4-24.6-9.4-33.9 0L106.3 240.4c-9.4 9.4-9.4 24.6 0 33.9l10.9 11c9.6 9.5 25.1 9.3 34.4-.4z"
				},
				{
					PackIconFontAwesomeKind.ArrowDownSolid,
					"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"
				},
				{
					PackIconFontAwesomeKind.ArrowLeftSolid,
					"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"
				},
				{
					PackIconFontAwesomeKind.ArrowRightSolid,
					"M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"
				},
				{
					PackIconFontAwesomeKind.ArrowsAltHSolid,
					"M377.941 169.941V216H134.059v-46.059c0-21.382-25.851-32.09-40.971-16.971L7.029 239.029c-9.373 9.373-9.373 24.568 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971V296h243.882v46.059c0 21.382 25.851 32.09 40.971 16.971l86.059-86.059c9.373-9.373 9.373-24.568 0-33.941l-86.059-86.059c-15.119-15.12-40.971-4.412-40.971 16.97z"
				},
				{
					PackIconFontAwesomeKind.ArrowsAltSolid,
					"M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"
				},
				{
					PackIconFontAwesomeKind.ArrowsAltVSolid,
					"M214.059 377.941H168V134.059h46.059c21.382 0 32.09-25.851 16.971-40.971L144.971 7.029c-9.373-9.373-24.568-9.373-33.941 0L24.971 93.088c-15.119 15.119-4.411 40.971 16.971 40.971H88v243.882H41.941c-21.382 0-32.09 25.851-16.971 40.971l86.059 86.059c9.373 9.373 24.568 9.373 33.941 0l86.059-86.059c15.12-15.119 4.412-40.971-16.97-40.971z"
				},
				{
					PackIconFontAwesomeKind.ArrowUpSolid,
					"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"
				},
				{
					PackIconFontAwesomeKind.ArtstationBrands,
					"M2 377.4l43 74.3A51.35 51.35 0 0 0 90.9 480h285.4l-59.2-102.6zM501.8 350L335.6 59.3A51.38 51.38 0 0 0 290.2 32h-88.4l257.3 447.6 40.7-70.5c1.9-3.2 21-29.7 2-59.1zM275 304.5l-115.5-200L44 304.5z"
				},
				{
					PackIconFontAwesomeKind.AssistiveListeningSystemsSolid,
					"M216 260c0 15.464-12.536 28-28 28s-28-12.536-28-28c0-44.112 35.888-80 80-80s80 35.888 80 80c0 15.464-12.536 28-28 28s-28-12.536-28-28c0-13.234-10.767-24-24-24s-24 10.766-24 24zm24-176c-97.047 0-176 78.953-176 176 0 15.464 12.536 28 28 28s28-12.536 28-28c0-66.168 53.832-120 120-120s120 53.832 120 120c0 75.164-71.009 70.311-71.997 143.622L288 404c0 28.673-23.327 52-52 52-15.464 0-28 12.536-28 28s12.536 28 28 28c59.475 0 107.876-48.328 108-107.774.595-34.428 72-48.24 72-144.226 0-97.047-78.953-176-176-176zm-80 236c-17.673 0-32 14.327-32 32s14.327 32 32 32 32-14.327 32-32-14.327-32-32-32zM32 448c-17.673 0-32 14.327-32 32s14.327 32 32 32 32-14.327 32-32-14.327-32-32-32zm480-187.993c0-1.518-.012-3.025-.045-4.531C510.076 140.525 436.157 38.47 327.994 1.511c-14.633-4.998-30.549 2.809-35.55 17.442-5 14.633 2.81 30.549 17.442 35.55 85.906 29.354 144.61 110.513 146.077 201.953l.003.188c.026 1.118.033 2.236.033 3.363 0 15.464 12.536 28 28 28s28.001-12.536 28.001-28zM152.971 439.029l-80-80L39.03 392.97l80 80 33.941-33.941z"
				},
				{
					PackIconFontAwesomeKind.AsteriskSolid,
					"M478.21 334.093L336 256l142.21-78.093c11.795-6.477 15.961-21.384 9.232-33.037l-19.48-33.741c-6.728-11.653-21.72-15.499-33.227-8.523L296 186.718l3.475-162.204C299.763 11.061 288.937 0 275.48 0h-38.96c-13.456 0-24.283 11.061-23.994 24.514L216 186.718 77.265 102.607c-11.506-6.976-26.499-3.13-33.227 8.523l-19.48 33.741c-6.728 11.653-2.562 26.56 9.233 33.037L176 256 33.79 334.093c-11.795 6.477-15.961 21.384-9.232 33.037l19.48 33.741c6.728 11.653 21.721 15.499 33.227 8.523L216 325.282l-3.475 162.204C212.237 500.939 223.064 512 236.52 512h38.961c13.456 0 24.283-11.061 23.995-24.514L296 325.282l138.735 84.111c11.506 6.976 26.499 3.13 33.227-8.523l19.48-33.741c6.728-11.653 2.563-26.559-9.232-33.036z"
				},
				{
					PackIconFontAwesomeKind.AsymmetrikBrands,
					"M517.5 309.2c38.8-40 58.1-80 58.5-116.1.8-65.5-59.4-118.2-169.4-135C277.9 38.4 118.1 73.6 0 140.5 52 114 110.6 92.3 170.7 82.3c74.5-20.5 153-25.4 221.3-14.8C544.5 91.3 588.8 195 490.8 299.2c-10.2 10.8-22 21.1-35 30.6L304.9 103.4 114.7 388.9c-65.6-29.4-76.5-90.2-19.1-151.2 20.8-22.2 48.3-41.9 79.5-58.1 20-12.2 39.7-22.6 62-30.7-65.1 20.3-122.7 52.9-161.6 92.9-27.7 28.6-41.4 57.1-41.7 82.9-.5 35.1 23.4 65.1 68.4 83l-34.5 51.7h101.6l22-34.4c22.2 1 45.3 0 68.6-2.7l-22.8 37.1h135.5L340 406.3c18.6-5.3 36.9-11.5 54.5-18.7l45.9 71.8H542L468.6 349c18.5-12.1 35-25.5 48.9-39.8zm-187.6 80.5l-25-40.6-32.7 53.3c-23.4 3.5-46.7 5.1-69.2 4.4l101.9-159.3 78.7 123c-17.2 7.4-35.3 13.9-53.7 19.2z"
				},
				{
					PackIconFontAwesomeKind.AtlassianBrands,
					"M152.2 236.4c-7.7-8.2-19.7-7.7-24.8 2.8L1.6 490.2c-5 10 2.4 21.7 13.4 21.7h175c5.8.1 11-3.2 13.4-8.4 37.9-77.8 15.1-196.3-51.2-267.1zM244.4 8.1c-122.3 193.4-8.5 348.6 65 495.5 2.5 5.1 7.7 8.4 13.4 8.4H497c11.2 0 18.4-11.8 13.4-21.7 0 0-234.5-470.6-240.4-482.3-5.3-10.6-18.8-10.8-25.6.1z"
				},
				{
					PackIconFontAwesomeKind.AtlasSolid,
					"M318.38 208h-39.09c-1.49 27.03-6.54 51.35-14.21 70.41 27.71-13.24 48.02-39.19 53.3-70.41zm0-32c-5.29-31.22-25.59-57.17-53.3-70.41 7.68 19.06 12.72 43.38 14.21 70.41h39.09zM224 97.31c-7.69 7.45-20.77 34.42-23.43 78.69h46.87c-2.67-44.26-15.75-71.24-23.44-78.69zm-41.08 8.28c-27.71 13.24-48.02 39.19-53.3 70.41h39.09c1.49-27.03 6.53-51.35 14.21-70.41zm0 172.82c-7.68-19.06-12.72-43.38-14.21-70.41h-39.09c5.28 31.22 25.59 57.17 53.3 70.41zM247.43 208h-46.87c2.66 44.26 15.74 71.24 23.43 78.69 7.7-7.45 20.78-34.43 23.44-78.69zM448 358.4V25.6c0-16-9.6-25.6-25.6-25.6H96C41.6 0 0 41.6 0 96v320c0 54.4 41.6 96 96 96h326.4c12.8 0 25.6-9.6 25.6-25.6v-16c0-6.4-3.2-12.8-9.6-19.2-3.2-16-3.2-60.8 0-73.6 6.4-3.2 9.6-9.6 9.6-19.2zM224 64c70.69 0 128 57.31 128 128s-57.31 128-128 128S96 262.69 96 192 153.31 64 224 64zm160 384H96c-19.2 0-32-12.8-32-32s16-32 32-32h288v64z"
				},
				{
					PackIconFontAwesomeKind.AtomSolid,
					"M223.99908,224a32,32,0,1,0,32.00782,32A32.06431,32.06431,0,0,0,223.99908,224Zm214.172-96c-10.877-19.5-40.50979-50.75-116.27544-41.875C300.39168,34.875,267.63386,0,223.99908,0s-76.39066,34.875-97.89653,86.125C50.3369,77.375,20.706,108.5,9.82907,128-6.54984,157.375-5.17484,201.125,34.958,256-5.17484,310.875-6.54984,354.625,9.82907,384c29.13087,52.375,101.64652,43.625,116.27348,41.875C147.60842,477.125,180.36429,512,223.99908,512s76.3926-34.875,97.89652-86.125c14.62891,1.75,87.14456,10.5,116.27544-41.875C454.55,354.625,453.175,310.875,413.04017,256,453.175,201.125,454.55,157.375,438.171,128ZM63.33886,352c-4-7.25-.125-24.75,15.00391-48.25,6.87695,6.5,14.12891,12.875,21.88087,19.125,1.625,13.75,4,27.125,6.75,40.125C82.34472,363.875,67.09081,358.625,63.33886,352Zm36.88478-162.875c-7.752,6.25-15.00392,12.625-21.88087,19.125-15.12891-23.5-19.00392-41-15.00391-48.25,3.377-6.125,16.37891-11.5,37.88478-11.5,1.75,0,3.875.375,5.75.375C104.09864,162.25,101.84864,175.625,100.22364,189.125ZM223.99908,64c9.50195,0,22.25586,13.5,33.88282,37.25-11.252,3.75-22.50391,8-33.88282,12.875-11.377-4.875-22.62892-9.125-33.88283-12.875C201.74516,77.5,214.49712,64,223.99908,64Zm0,384c-9.502,0-22.25392-13.5-33.88283-37.25,11.25391-3.75,22.50587-8,33.88283-12.875C235.378,402.75,246.62994,407,257.8819,410.75,246.25494,434.5,233.501,448,223.99908,448Zm0-112a80,80,0,1,1,80-80A80.00023,80.00023,0,0,1,223.99908,336ZM384.6593,352c-3.625,6.625-19.00392,11.875-43.63479,11,2.752-13,5.127-26.375,6.752-40.125,7.75195-6.25,15.00391-12.625,21.87891-19.125C384.7843,327.25,388.6593,344.75,384.6593,352ZM369.65538,208.25c-6.875-6.5-14.127-12.875-21.87891-19.125-1.625-13.5-3.875-26.875-6.752-40.25,1.875,0,4.002-.375,5.752-.375,21.50391,0,34.50782,5.375,37.88283,11.5C388.6593,167.25,384.7843,184.75,369.65538,208.25Z"
				},
				{
					PackIconFontAwesomeKind.AtSolid,
					"M256 8C118.941 8 8 118.919 8 256c0 137.059 110.919 248 248 248 48.154 0 95.342-14.14 135.408-40.223 12.005-7.815 14.625-24.288 5.552-35.372l-10.177-12.433c-7.671-9.371-21.179-11.667-31.373-5.129C325.92 429.757 291.314 440 256 440c-101.458 0-184-82.542-184-184S154.542 72 256 72c100.139 0 184 57.619 184 160 0 38.786-21.093 79.742-58.17 83.693-17.349-.454-16.91-12.857-13.476-30.024l23.433-121.11C394.653 149.75 383.308 136 368.225 136h-44.981a13.518 13.518 0 0 0-13.432 11.993l-.01.092c-14.697-17.901-40.448-21.775-59.971-21.775-74.58 0-137.831 62.234-137.831 151.46 0 65.303 36.785 105.87 96 105.87 26.984 0 57.369-15.637 74.991-38.333 9.522 34.104 40.613 34.103 70.71 34.103C462.609 379.41 504 307.798 504 232 504 95.653 394.023 8 256 8zm-21.68 304.43c-22.249 0-36.07-15.623-36.07-40.771 0-44.993 30.779-72.729 58.63-72.729 22.292 0 35.601 15.241 35.601 40.77 0 45.061-33.875 72.73-58.161 72.73z"
				},
				{
					PackIconFontAwesomeKind.AudibleBrands,
					"M640 199.9v54l-320 200L0 254v-54l320 200 320-200.1zm-194.5 72l47.1-29.4c-37.2-55.8-100.7-92.6-172.7-92.6-72 0-135.5 36.7-172.6 92.4h.3c2.5-2.3 5.1-4.5 7.7-6.7 89.7-74.4 219.4-58.1 290.2 36.3zm-220.1 18.8c16.9-11.9 36.5-18.7 57.4-18.7 34.4 0 65.2 18.4 86.4 47.6l45.4-28.4c-20.9-29.9-55.6-49.5-94.8-49.5-38.9 0-73.4 19.4-94.4 49zM103.6 161.1c131.8-104.3 318.2-76.4 417.5 62.1l.7 1 48.8-30.4C517.1 112.1 424.8 58.1 319.9 58.1c-103.5 0-196.6 53.5-250.5 135.6 9.9-10.5 22.7-23.5 34.2-32.6zm467 32.7z"
				},
				{
					PackIconFontAwesomeKind.AudioDescriptionSolid,
					"M162.925 238.709l8.822 30.655h-25.606l9.041-30.652c1.277-4.421 2.651-9.994 3.872-15.245 1.22 5.251 2.594 10.823 3.871 15.242zm166.474-32.099h-14.523v98.781h14.523c29.776 0 46.175-17.678 46.175-49.776 0-32.239-17.49-49.005-46.175-49.005zM512 112v288c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48zM245.459 336.139l-57.097-168A12.001 12.001 0 0 0 177 160h-35.894a12.001 12.001 0 0 0-11.362 8.139l-57.097 168C70.003 343.922 75.789 352 84.009 352h29.133a12 12 0 0 0 11.535-8.693l8.574-29.906h51.367l8.793 29.977A12 12 0 0 0 204.926 352h29.172c8.22 0 14.006-8.078 11.361-15.861zm184.701-80.525c0-58.977-37.919-95.614-98.96-95.614h-57.366c-6.627 0-12 5.373-12 12v168c0 6.627 5.373 12 12 12H331.2c61.041 0 98.96-36.933 98.96-96.386z"
				},
				{
					PackIconFontAwesomeKind.AutoprefixerBrands,
					"M318.4 16l-161 480h77.5l25.4-81.4h119.5L405 496h77.5L318.4 16zm-40.3 341.9l41.2-130.4h1.5l40.9 130.4h-83.6zM640 405l-10-31.4L462.1 358l19.4 56.5L640 405zm-462.1-47L10 373.7 0 405l158.5 9.4 19.4-56.4z"
				},
				{
					PackIconFontAwesomeKind.AvianexBrands,
					"M453.1 32h-312c-38.9 0-76.2 31.2-83.3 69.7L1.2 410.3C-5.9 448.8 19.9 480 58.9 480h312c38.9 0 76.2-31.2 83.3-69.7l56.7-308.5c7-38.6-18.8-69.8-57.8-69.8zm-58.2 347.3l-32 13.5-115.4-110c-14.7 10-29.2 19.5-41.7 27.1l22.1 64.2-17.9 12.7-40.6-61-52.4-48.1 15.7-15.4 58 31.1c9.3-10.5 20.8-22.6 32.8-34.9L203 228.9l-68.8-99.8 18.8-28.9 8.9-4.8L265 207.8l4.9 4.5c19.4-18.8 33.8-32.4 33.8-32.4 7.7-6.5 21.5-2.9 30.7 7.9 9 10.5 10.6 24.7 2.7 31.3-1.8 1.3-15.5 11.4-35.3 25.6l4.5 7.3 94.9 119.4-6.3 7.9z"
				},
				{
					PackIconFontAwesomeKind.AviatoBrands,
					"M107.2 283.5l-19-41.8H36.1l-19 41.8H0l62.2-131.4 62.2 131.4h-17.2zm-45-98.1l-19.6 42.5h39.2l-19.6-42.5zm112.7 102.4l-62.2-131.4h17.1l45.1 96 45.1-96h17l-62.1 131.4zm80.6-4.3V156.4H271v127.1h-15.5zm209.1-115.6v115.6h-17.3V167.9h-41.2v-11.5h99.6v11.5h-41.1zM640 218.8c0 9.2-1.7 17.8-5.1 25.8-3.4 8-8.2 15.1-14.2 21.1-6 6-13.1 10.8-21.1 14.2-8 3.4-16.6 5.1-25.8 5.1s-17.8-1.7-25.8-5.1c-8-3.4-15.1-8.2-21.1-14.2-6-6-10.8-13-14.2-21.1-3.4-8-5.1-16.6-5.1-25.8s1.7-17.8 5.1-25.8c3.4-8 8.2-15.1 14.2-21.1 6-6 13-8.4 21.1-11.9 8-3.4 16.6-5.1 25.8-5.1s17.8 1.7 25.8 5.1c8 3.4 15.1 5.8 21.1 11.9 6 6 10.7 13.1 14.2 21.1 3.4 8 5.1 16.6 5.1 25.8zm-15.5 0c0-7.3-1.3-14-3.9-20.3-2.6-6.3-6.2-11.7-10.8-16.3-4.6-4.6-10-8.2-16.2-10.9-6.2-2.7-12.8-4-19.8-4s-13.6 1.3-19.8 4c-6.2 2.7-11.6 6.3-16.2 10.9-4.6 4.6-8.2 10-10.8 16.3-2.6 6.3-3.9 13.1-3.9 20.3 0 7.3 1.3 14 3.9 20.3 2.6 6.3 6.2 11.7 10.8 16.3 4.6 4.6 10 8.2 16.2 10.9 6.2 2.7 12.8 4 19.8 4s13.6-1.3 19.8-4c6.2-2.7 11.6-6.3 16.2-10.9 4.6-4.6 8.2-10 10.8-16.3 2.6-6.3 3.9-13.1 3.9-20.3zm-94.8 96.7v-6.3l88.9-10-242.9 13.4c.6-2.2 1.1-4.6 1.4-7.2.3-2 .5-4.2.6-6.5l64.8-8.1-64.9 1.9c0-.4-.1-.7-.1-1.1-2.8-17.2-25.5-23.7-25.5-23.7l-1.1-26.3h23.8l19 41.8h17.1L348.6 152l-62.2 131.4h17.1l19-41.8h23.6L345 268s-22.7 6.5-25.5 23.7c-.1.3-.1.7-.1 1.1l-64.9-1.9 64.8 8.1c.1 2.3.3 4.4.6 6.5.3 2.6.8 5 1.4 7.2L78.4 299.2l88.9 10v6.3c-5.9.9-10.5 6-10.5 12.2 0 6.8 5.6 12.4 12.4 12.4 6.8 0 12.4-5.6 12.4-12.4 0-6.2-4.6-11.3-10.5-12.2v-5.8l80.3 9v5.4c-5.7 1.1-9.9 6.2-9.9 12.1 0 6.8 5.6 10.2 12.4 10.2 6.8 0 12.4-3.4 12.4-10.2 0-6-4.3-11-9.9-12.1v-4.9l28.4 3.2v23.7h-5.9V360h5.9v-6.6h5v6.6h5.9v-13.8h-5.9V323l38.3 4.3c8.1 11.4 19 13.6 19 13.6l-.1 6.7-5.1.2-.1 12.1h4.1l.1-5h5.2l.1 5h4.1l-.1-12.1-5.1-.2-.1-6.7s10.9-2.1 19-13.6l38.3-4.3v23.2h-5.9V360h5.9v-6.6h5v6.6h5.9v-13.8h-5.9v-23.7l28.4-3.2v4.9c-5.7 1.1-9.9 6.2-9.9 12.1 0 6.8 5.6 10.2 12.4 10.2 6.8 0 12.4-3.4 12.4-10.2 0-6-4.3-11-9.9-12.1v-5.4l80.3-9v5.8c-5.9.9-10.5 6-10.5 12.2 0 6.8 5.6 12.4 12.4 12.4 6.8 0 12.4-5.6 12.4-12.4-.2-6.3-4.7-11.4-10.7-12.3zm-200.8-87.6l19.6-42.5 19.6 42.5h-17.9l-1.7-40.3-1.7 40.3h-17.9z"
				},
				{
					PackIconFontAwesomeKind.AwardSolid,
					"M97.12 362.63c-8.69-8.69-4.16-6.24-25.12-11.85-9.51-2.55-17.87-7.45-25.43-13.32L1.2 448.7c-4.39 10.77 3.81 22.47 15.43 22.03l52.69-2.01L105.56 507c8 8.44 22.04 5.81 26.43-4.96l52.05-127.62c-10.84 6.04-22.87 9.58-35.31 9.58-19.5 0-37.82-7.59-51.61-21.37zM382.8 448.7l-45.37-111.24c-7.56 5.88-15.92 10.77-25.43 13.32-21.07 5.64-16.45 3.18-25.12 11.85-13.79 13.78-32.12 21.37-51.62 21.37-12.44 0-24.47-3.55-35.31-9.58L252 502.04c4.39 10.77 18.44 13.4 26.43 4.96l36.25-38.28 52.69 2.01c11.62.44 19.82-11.27 15.43-22.03zM263 340c15.28-15.55 17.03-14.21 38.79-20.14 13.89-3.79 24.75-14.84 28.47-28.98 7.48-28.4 5.54-24.97 25.95-45.75 10.17-10.35 14.14-25.44 10.42-39.58-7.47-28.38-7.48-24.42 0-52.83 3.72-14.14-.25-29.23-10.42-39.58-20.41-20.78-18.47-17.36-25.95-45.75-3.72-14.14-14.58-25.19-28.47-28.98-27.88-7.61-24.52-5.62-44.95-26.41-10.17-10.35-25-14.4-38.89-10.61-27.87 7.6-23.98 7.61-51.9 0-13.89-3.79-28.72.25-38.89 10.61-20.41 20.78-17.05 18.8-44.94 26.41-13.89 3.79-24.75 14.84-28.47 28.98-7.47 28.39-5.54 24.97-25.95 45.75-10.17 10.35-14.15 25.44-10.42 39.58 7.47 28.36 7.48 24.4 0 52.82-3.72 14.14.25 29.23 10.42 39.59 20.41 20.78 18.47 17.35 25.95 45.75 3.72 14.14 14.58 25.19 28.47 28.98C104.6 325.96 106.27 325 121 340c13.23 13.47 33.84 15.88 49.74 5.82a39.676 39.676 0 0 1 42.53 0c15.89 10.06 36.5 7.65 49.73-5.82zM97.66 175.96c0-53.03 42.24-96.02 94.34-96.02s94.34 42.99 94.34 96.02-42.24 96.02-94.34 96.02-94.34-42.99-94.34-96.02z"
				},
				{
					PackIconFontAwesomeKind.AwsBrands,
					"M180.41 203.01c-.72 22.65 10.6 32.68 10.88 39.05a8.164 8.164 0 0 1-4.1 6.27l-12.8 8.96a10.66 10.66 0 0 1-5.63 1.92c-.43-.02-8.19 1.83-20.48-25.61a78.608 78.608 0 0 1-62.61 29.45c-16.28.89-60.4-9.24-58.13-56.21-1.59-38.28 34.06-62.06 70.93-60.05 7.1.02 21.6.37 46.99 6.27v-15.62c2.69-26.46-14.7-46.99-44.81-43.91-2.4.01-19.4-.5-45.84 10.11-7.36 3.38-8.3 2.82-10.75 2.82-7.41 0-4.36-21.48-2.94-24.2 5.21-6.4 35.86-18.35 65.94-18.18a76.857 76.857 0 0 1 55.69 17.28 70.285 70.285 0 0 1 17.67 52.36l-.01 69.29zM93.99 235.4c32.43-.47 46.16-19.97 49.29-30.47 2.46-10.05 2.05-16.41 2.05-27.4-9.67-2.32-23.59-4.85-39.56-4.87-15.15-1.14-42.82 5.63-41.74 32.26-1.24 16.79 11.12 31.4 29.96 30.48zm170.92 23.05c-7.86.72-11.52-4.86-12.68-10.37l-49.8-164.65c-.97-2.78-1.61-5.65-1.92-8.58a4.61 4.61 0 0 1 3.86-5.25c.24-.04-2.13 0 22.25 0 8.78-.88 11.64 6.03 12.55 10.37l35.72 140.83 33.16-140.83c.53-3.22 2.94-11.07 12.8-10.24h17.16c2.17-.18 11.11-.5 12.68 10.37l33.42 142.63L420.98 80.1c.48-2.18 2.72-11.37 12.68-10.37h19.72c.85-.13 6.15-.81 5.25 8.58-.43 1.85 3.41-10.66-52.75 169.9-1.15 5.51-4.82 11.09-12.68 10.37h-18.69c-10.94 1.15-12.51-9.66-12.68-10.75L328.67 110.7l-32.78 136.99c-.16 1.09-1.73 11.9-12.68 10.75h-18.3zm273.48 5.63c-5.88.01-33.92-.3-57.36-12.29a12.802 12.802 0 0 1-7.81-11.91v-10.75c0-8.45 6.2-6.9 8.83-5.89 10.04 4.06 16.48 7.14 28.81 9.6 36.65 7.53 52.77-2.3 56.72-4.48 13.15-7.81 14.19-25.68 5.25-34.95-10.48-8.79-15.48-9.12-53.13-21-4.64-1.29-43.7-13.61-43.79-52.36-.61-28.24 25.05-56.18 69.52-55.95 12.67-.01 46.43 4.13 55.57 15.62 1.35 2.09 2.02 4.55 1.92 7.04v10.11c0 4.44-1.62 6.66-4.87 6.66-7.71-.86-21.39-11.17-49.16-10.75-6.89-.36-39.89.91-38.41 24.97-.43 18.96 26.61 26.07 29.7 26.89 36.46 10.97 48.65 12.79 63.12 29.58 17.14 22.25 7.9 48.3 4.35 55.44-19.08 37.49-68.42 34.44-69.26 34.42zm40.2 104.86c-70.03 51.72-171.69 79.25-258.49 79.25A469.127 469.127 0 0 1 2.83 327.46c-6.53-5.89-.77-13.96 7.17-9.47a637.37 637.37 0 0 0 316.88 84.12 630.22 630.22 0 0 0 241.59-49.55c11.78-5 21.77 7.8 10.12 16.38zm29.19-33.29c-8.96-11.52-59.28-5.38-81.81-2.69-6.79.77-7.94-5.12-1.79-9.47 40.07-28.17 105.88-20.1 113.44-10.63 7.55 9.47-2.05 75.41-39.56 106.91-5.76 4.87-11.27 2.3-8.71-4.1 8.44-21.25 27.39-68.49 18.43-80.02z"
				},
				{
					PackIconFontAwesomeKind.BabyCarriageSolid,
					"M144.8 17c-11.3-17.8-37.2-22.8-54-9.4C35.3 51.9 0 118 0 192h256L144.8 17zM496 96h-48c-35.3 0-64 28.7-64 64v64H0c0 50.6 23 96.4 60.3 130.7C25.7 363.6 0 394.7 0 432c0 44.2 35.8 80 80 80s80-35.8 80-80c0-8.9-1.8-17.2-4.4-25.2 21.6 5.9 44.6 9.2 68.4 9.2s46.9-3.3 68.4-9.2c-2.7 8-4.4 16.3-4.4 25.2 0 44.2 35.8 80 80 80s80-35.8 80-80c0-37.3-25.7-68.4-60.3-77.3C425 320.4 448 274.6 448 224v-64h48c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zM80 464c-17.6 0-32-14.4-32-32s14.4-32 32-32 32 14.4 32 32-14.4 32-32 32zm320-32c0 17.6-14.4 32-32 32s-32-14.4-32-32 14.4-32 32-32 32 14.4 32 32z"
				},
				{
					PackIconFontAwesomeKind.BabySolid,
					"M192 160c44.2 0 80-35.8 80-80S236.2 0 192 0s-80 35.8-80 80 35.8 80 80 80zm-53.4 248.8l25.6-32-61.5-51.2L56.8 383c-11.4 14.2-11.7 34.4-.8 49l48 64c7.9 10.5 19.9 16 32 16 8.3 0 16.8-2.6 24-8 17.7-13.2 21.2-38.3 8-56l-29.4-39.2zm142.7-83.2l-61.5 51.2 25.6 32L216 448c-13.2 17.7-9.7 42.8 8 56 7.2 5.4 15.6 8 24 8 12.2 0 24.2-5.5 32-16l48-64c10.9-14.6 10.6-34.8-.8-49l-45.9-57.4zM376.7 145c-12.7-18.1-37.6-22.4-55.7-9.8l-40.6 28.5c-52.7 37-124.2 37-176.8 0L63 135.3C44.9 122.6 20 127 7.3 145-5.4 163.1-1 188 17 200.7l40.6 28.5c17 11.9 35.4 20.9 54.4 27.9V288h160v-30.8c19-7 37.4-16 54.4-27.9l40.6-28.5c18.1-12.8 22.4-37.7 9.7-55.8z"
				},
				{
					PackIconFontAwesomeKind.BackspaceSolid,
					"M576 64H205.26A63.97 63.97 0 0 0 160 82.75L9.37 233.37c-12.5 12.5-12.5 32.76 0 45.25L160 429.25c12 12 28.28 18.75 45.25 18.75H576c35.35 0 64-28.65 64-64V128c0-35.35-28.65-64-64-64zm-84.69 254.06c6.25 6.25 6.25 16.38 0 22.63l-22.62 22.62c-6.25 6.25-16.38 6.25-22.63 0L384 301.25l-62.06 62.06c-6.25 6.25-16.38 6.25-22.63 0l-22.62-22.62c-6.25-6.25-6.25-16.38 0-22.63L338.75 256l-62.06-62.06c-6.25-6.25-6.25-16.38 0-22.63l22.62-22.62c6.25-6.25 16.38-6.25 22.63 0L384 210.75l62.06-62.06c6.25-6.25 16.38-6.25 22.63 0l22.62 22.62c6.25 6.25 6.25 16.38 0 22.63L429.25 256l62.06 62.06z"
				},
				{
					PackIconFontAwesomeKind.BackwardSolid,
					"M11.5 280.6l192 160c20.6 17.2 52.5 2.8 52.5-24.6V96c0-27.4-31.9-41.8-52.5-24.6l-192 160c-15.3 12.8-15.3 36.4 0 49.2zm256 0l192 160c20.6 17.2 52.5 2.8 52.5-24.6V96c0-27.4-31.9-41.8-52.5-24.6l-192 160c-15.3 12.8-15.3 36.4 0 49.2z"
				},
				{
					PackIconFontAwesomeKind.BaconSolid,
					"M218.92 336.39c34.89-34.89 44.2-59.7 54.05-86 10.61-28.29 21.59-57.54 61.37-97.34s69.05-50.77 97.35-61.38c23.88-9 46.64-17.68 76.79-45.37L470.81 8.91a31 31 0 0 0-40.18-2.83c-13.64 10.1-25.15 14.39-41 20.3C247 79.52 209.26 191.29 200.65 214.1c-29.75 78.83-89.55 94.68-98.72 98.09-24.86 9.26-54.73 20.38-91.07 50.36C-3 374-3.63 395 9.07 407.61l35.76 35.51C80 410.52 107 400.15 133 390.39c26.27-9.84 51.06-19.12 85.92-54zm348-232l-35.75-35.51c-35.19 32.63-62.18 43-88.25 52.79-26.26 9.85-51.06 19.16-85.95 54s-44.19 59.69-54 86C292.33 290 281.34 319.22 241.55 359s-69 50.73-97.3 61.32c-23.86 9-46.61 17.66-76.72 45.33l37.68 37.43a31 31 0 0 0 40.18 2.82c13.6-10.06 25.09-14.34 40.94-20.24 142.2-53 180-164.1 188.94-187.69C405 219.18 464.8 203.3 474 199.86c24.87-9.27 54.74-20.4 91.11-50.41 13.89-11.4 14.52-32.45 1.82-45.05z"
				},
				{
					PackIconFontAwesomeKind.BacteriaSolid,
					"M272.35,226.4A17.71,17.71,0,0,0,281.46,203l-4-9.08a121.29,121.29,0,0,1,12.36-3.08A83.34,83.34,0,0,0,323.57,177l10,9a17.76,17.76,0,1,0,23.92-26.27l-9.72-8.76a83.12,83.12,0,0,0,11.65-48.18l11.85-3.51a17.73,17.73,0,1,0-10.15-34l-11.34,3.36a84,84,0,0,0-36.38-35.57l2.84-10.85a17.8,17.8,0,0,0-34.47-8.93l-2.82,10.78a83.25,83.25,0,0,0-16.74,1.1C250.83,27,240,30.22,229.1,33.39l-3.38-9.46a17.8,17.8,0,0,0-33.56,11.89l3.49,9.8a286.74,286.74,0,0,0-43.94,23.57l-6.32-8.43a17.9,17.9,0,0,0-24.94-3.6A17.69,17.69,0,0,0,116.84,82l6.45,8.61a286.59,286.59,0,0,0-34.95,35.33l-8.82-6.42a17.84,17.84,0,0,0-24.89,3.86,17.66,17.66,0,0,0,3.88,24.77l8.88,6.47a286.6,286.6,0,0,0-23,43.91l-10.48-3.59a17.73,17.73,0,1,0-11.59,33.52L32.67,232c-2.79,10-5.79,19.84-7.52,30.22a83.16,83.16,0,0,0-.82,19l-11.58,3.43a17.73,17.73,0,1,0,10.13,34l11.27-3.33a83.51,83.51,0,0,0,36.39,35.43l-2.88,11.06a17.81,17.81,0,0,0,34.48,8.92l2.87-11c1,0,2.07.26,3.1.26a83.39,83.39,0,0,0,45.65-13.88l8.59,8.8a17.77,17.77,0,0,0,25.56-24.7l-9.14-9.37a83.41,83.41,0,0,0,12.08-31.05,119.08,119.08,0,0,1,3.87-15.53l9,4.22a17.74,17.74,0,1,0,15.15-32.09l-8.8-4.11c.67-1,1.2-2.08,1.9-3.05a119.89,119.89,0,0,1,7.87-9.41,121.73,121.73,0,0,1,11.65-11.4,119.49,119.49,0,0,1,9.94-7.82c1.12-.77,2.32-1.42,3.47-2.15l3.92,8.85a17.86,17.86,0,0,0,16.32,10.58A18.14,18.14,0,0,0,272.35,226.4ZM128,256a32,32,0,1,1,32-32A32,32,0,0,1,128,256Zm80-96a16,16,0,1,1,16-16A16,16,0,0,1,208,160Zm431.26,45.3a17.79,17.79,0,0,0-17.06-12.69,17.55,17.55,0,0,0-5.08.74l-11.27,3.33a83.61,83.61,0,0,0-36.39-35.43l2.88-11.06a17.81,17.81,0,0,0-34.48-8.91l-2.87,11c-1,0-2.07-.26-3.1-.26a83.32,83.32,0,0,0-45.65,13.89l-8.59-8.81a17.77,17.77,0,0,0-25.56,24.7l9.14,9.37a83.28,83.28,0,0,0-12.08,31.06,119.34,119.34,0,0,1-3.87,15.52l-9-4.22a17.74,17.74,0,1,0-15.15,32.09l8.8,4.11c-.67,1-1.2,2.08-1.89,3.05a117.71,117.71,0,0,1-7.94,9.47,119,119,0,0,1-11.57,11.33,121.59,121.59,0,0,1-10,7.83c-1.12.77-2.32,1.42-3.47,2.15l-3.92-8.85a17.86,17.86,0,0,0-16.32-10.58,18.14,18.14,0,0,0-7.18,1.5A17.71,17.71,0,0,0,358.54,309l4,9.08a118.71,118.71,0,0,1-12.36,3.08,83.34,83.34,0,0,0-33.77,13.9l-10-9a17.77,17.77,0,1,0-23.92,26.28l9.72,8.75a83.12,83.12,0,0,0-11.65,48.18l-11.86,3.51a17.73,17.73,0,1,0,10.16,34l11.34-3.36A84,84,0,0,0,326.61,479l-2.84,10.85a17.8,17.8,0,0,0,34.47,8.93L361.06,488a83.3,83.3,0,0,0,16.74-1.1c11.37-1.89,22.24-5.07,33.1-8.24l3.38,9.46a17.8,17.8,0,0,0,33.56-11.89l-3.49-9.79a287.66,287.66,0,0,0,43.94-23.58l6.32,8.43a17.88,17.88,0,0,0,24.93,3.6A17.67,17.67,0,0,0,523.16,430l-6.45-8.61a287.37,287.37,0,0,0,34.95-35.34l8.82,6.42a17.76,17.76,0,1,0,21-28.63l-8.88-6.46a287.17,287.17,0,0,0,23-43.92l10.48,3.59a17.73,17.73,0,1,0,11.59-33.52L607.33,280c2.79-10,5.79-19.84,7.52-30.21a83.27,83.27,0,0,0,.82-19.05l11.58-3.43A17.7,17.7,0,0,0,639.26,205.3ZM416,416a32,32,0,1,1,32-32A32,32,0,0,1,416,416Z"
				},
				{
					PackIconFontAwesomeKind.BacteriumSolid,
					"M511,102.93A23.76,23.76,0,0,0,481.47,87l-15.12,4.48a111.85,111.85,0,0,0-48.5-47.42l3.79-14.47a23.74,23.74,0,0,0-46-11.91l-3.76,14.37a111.94,111.94,0,0,0-22.33,1.47,386.74,386.74,0,0,0-44.33,10.41l-4.3-12a23.74,23.74,0,0,0-44.75,15.85l4.3,12.05a383.4,383.4,0,0,0-58.69,31.83l-8-10.63a23.85,23.85,0,0,0-33.24-4.8,23.57,23.57,0,0,0-4.83,33.09l8,10.63a386.14,386.14,0,0,0-46.7,47.44l-11-8a23.68,23.68,0,1,0-28,38.17l11.09,8.06a383.45,383.45,0,0,0-30.92,58.75l-12.93-4.43a23.65,23.65,0,1,0-15.47,44.69l13,4.48a385.81,385.81,0,0,0-9.3,40.53A111.58,111.58,0,0,0,32.44,375L17,379.56a23.64,23.64,0,0,0,13.51,45.31l15-4.44a111.49,111.49,0,0,0,48.53,47.24l-3.85,14.75a23.66,23.66,0,0,0,17,28.83,24.7,24.7,0,0,0,6,.75,23.73,23.73,0,0,0,23-17.7L140,479.67c1.37.05,2.77.35,4.13.35A111.22,111.22,0,0,0,205,461.5l11.45,11.74a23.7,23.7,0,0,0,34.08-32.93l-12.19-12.5a111,111,0,0,0,16.11-41.4,158.69,158.69,0,0,1,5.16-20.71l12,5.64a23.66,23.66,0,1,0,20.19-42.79l-11.72-5.49c.89-1.32,1.59-2.77,2.52-4.06a157.86,157.86,0,0,1,10.46-12.49,159.5,159.5,0,0,1,15.59-15.28,162.18,162.18,0,0,1,13.23-10.4c1.5-1,3.1-1.89,4.63-2.87l5.23,11.8a23.74,23.74,0,0,0,43.48-19.08l-5.36-12.11a158.87,158.87,0,0,1,16.49-4.1,111,111,0,0,0,45-18.54l13.33,12a23.69,23.69,0,1,0,31.88-35l-12.94-11.67A110.83,110.83,0,0,0,479.21,137L495,132.32A23.61,23.61,0,0,0,511,102.93ZM160,368a48,48,0,1,1,48-48A48,48,0,0,1,160,368Zm80-136a24,24,0,1,1,24-24A24,24,0,0,1,240,232Z"
				},
				{
					PackIconFontAwesomeKind.BahaiSolid,
					"M496.25 202.52l-110-15.44 41.82-104.34c6.67-16.64-11.6-32.18-26.59-22.63L307.44 120 273.35 12.82C270.64 4.27 263.32 0 256 0c-7.32 0-14.64 4.27-17.35 12.82l-34.09 107.19-94.04-59.89c-14.99-9.55-33.25 5.99-26.59 22.63l41.82 104.34-110 15.43c-17.54 2.46-21.68 26.27-6.03 34.67l98.16 52.66-74.48 83.54c-10.92 12.25-1.72 30.93 13.29 30.93 1.31 0 2.67-.14 4.07-.45l108.57-23.65-4.11 112.55c-.43 11.65 8.87 19.22 18.41 19.22 5.15 0 10.39-2.21 14.2-7.18l68.18-88.9 68.18 88.9c3.81 4.97 9.04 7.18 14.2 7.18 9.54 0 18.84-7.57 18.41-19.22l-4.11-112.55 108.57 23.65c17.36 3.76 29.21-17.2 17.35-30.49l-74.48-83.54 98.16-52.66c15.64-8.39 11.5-32.2-6.04-34.66zM338.51 311.68l-51.89-11.3 1.97 53.79L256 311.68l-32.59 42.49 1.96-53.79-51.89 11.3 35.6-39.93-46.92-25.17 52.57-7.38-19.99-49.87 44.95 28.62L256 166.72l16.29 51.23 44.95-28.62-19.99 49.87 52.57 7.38-46.92 25.17 35.61 39.93z"
				},
				{
					PackIconFontAwesomeKind.BalanceScaleLeftSolid,
					"M528 448H352V153.25c20.42-8.94 36.1-26.22 43.38-47.47l132-44.26c8.38-2.81 12.89-11.88 10.08-20.26l-10.17-30.34C524.48 2.54 515.41-1.97 507.03.84L389.11 40.37C375.3 16.36 349.69 0 320 0c-44.18 0-80 35.82-80 80 0 3.43.59 6.71 1.01 10.03l-128.39 43.05c-8.38 2.81-12.89 11.88-10.08 20.26l10.17 30.34c2.81 8.38 11.88 12.89 20.26 10.08l142.05-47.63c4.07 2.77 8.43 5.12 12.99 7.12V496c0 8.84 7.16 16 16 16h224c8.84 0 16-7.16 16-16v-32c-.01-8.84-7.17-16-16.01-16zm111.98-144c0-16.18 1.34-8.73-85.05-181.51-17.65-35.29-68.19-35.36-85.87 0-87.12 174.26-85.04 165.84-85.04 181.51H384c0 44.18 57.31 80 128 80s128-35.82 128-80h-.02zM440 288l72-144 72 144H440zm-269.07-37.51c-17.65-35.29-68.19-35.36-85.87 0C-2.06 424.75.02 416.33.02 432H0c0 44.18 57.31 80 128 80s128-35.82 128-80h-.02c0-16.18 1.34-8.73-85.05-181.51zM56 416l72-144 72 144H56z"
				},
				{
					PackIconFontAwesomeKind.BalanceScaleRightSolid,
					"M96 464v32c0 8.84 7.16 16 16 16h224c8.84 0 16-7.16 16-16V153.25c4.56-2 8.92-4.35 12.99-7.12l142.05 47.63c8.38 2.81 17.45-1.71 20.26-10.08l10.17-30.34c2.81-8.38-1.71-17.45-10.08-20.26l-128.4-43.05c.42-3.32 1.01-6.6 1.01-10.03 0-44.18-35.82-80-80-80-29.69 0-55.3 16.36-69.11 40.37L132.96.83c-8.38-2.81-17.45 1.71-20.26 10.08l-10.17 30.34c-2.81 8.38 1.71 17.45 10.08 20.26l132 44.26c7.28 21.25 22.96 38.54 43.38 47.47V448H112c-8.84 0-16 7.16-16 16zM0 304c0 44.18 57.31 80 128 80s128-35.82 128-80h-.02c0-15.67 2.08-7.25-85.05-181.51-17.68-35.36-68.22-35.29-85.87 0C-1.32 295.27.02 287.82.02 304H0zm56-16l72-144 72 144H56zm328.02 144H384c0 44.18 57.31 80 128 80s128-35.82 128-80h-.02c0-15.67 2.08-7.25-85.05-181.51-17.68-35.36-68.22-35.29-85.87 0-86.38 172.78-85.04 165.33-85.04 181.51zM440 416l72-144 72 144H440z"
				},
				{
					PackIconFontAwesomeKind.BalanceScaleSolid,
					"M256 336h-.02c0-16.18 1.34-8.73-85.05-181.51-17.65-35.29-68.19-35.36-85.87 0C-2.06 328.75.02 320.33.02 336H0c0 44.18 57.31 80 128 80s128-35.82 128-80zM128 176l72 144H56l72-144zm511.98 160c0-16.18 1.34-8.73-85.05-181.51-17.65-35.29-68.19-35.36-85.87 0-87.12 174.26-85.04 165.84-85.04 181.51H384c0 44.18 57.31 80 128 80s128-35.82 128-80h-.02zM440 320l72-144 72 144H440zm88 128H352V153.25c23.51-10.29 41.16-31.48 46.39-57.25H528c8.84 0 16-7.16 16-16V48c0-8.84-7.16-16-16-16H383.64C369.04 12.68 346.09 0 320 0s-49.04 12.68-63.64 32H112c-8.84 0-16 7.16-16 16v32c0 8.84 7.16 16 16 16h129.61c5.23 25.76 22.87 46.96 46.39 57.25V448H112c-8.84 0-16 7.16-16 16v32c0 8.84 7.16 16 16 16h416c8.84 0 16-7.16 16-16v-32c0-8.84-7.16-16-16-16z"
				},
				{
					PackIconFontAwesomeKind.BandAidSolid,
					"M0 160v192c0 35.3 28.7 64 64 64h96V96H64c-35.3 0-64 28.7-64 64zm576-64h-96v320h96c35.3 0 64-28.7 64-64V160c0-35.3-28.7-64-64-64zM192 416h256V96H192v320zm176-232c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm0 96c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm-96-96c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm0 96c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24z"
				},
				{
					PackIconFontAwesomeKind.BandcampBrands,
					"M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm48.2,326.1h-181L207.9,178h181Z"
				},
				{
					PackIconFontAwesomeKind.BanSolid,
					"M256 8C119.034 8 8 119.033 8 256s111.034 248 248 248 248-111.034 248-248S392.967 8 256 8zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676zM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676z"
				},
				{
					PackIconFontAwesomeKind.BarcodeSolid,
					"M0 448V64h18v384H0zm26.857-.273V64H36v383.727h-9.143zm27.143 0V64h8.857v383.727H54zm44.857 0V64h8.857v383.727h-8.857zm36 0V64h17.714v383.727h-17.714zm44.857 0V64h8.857v383.727h-8.857zm18 0V64h8.857v383.727h-8.857zm18 0V64h8.857v383.727h-8.857zm35.715 0V64h18v383.727h-18zm44.857 0V64h18v383.727h-18zm35.999 0V64h18.001v383.727h-18.001zm36.001 0V64h18.001v383.727h-18.001zm26.857 0V64h18v383.727h-18zm45.143 0V64h26.857v383.727h-26.857zm35.714 0V64h9.143v383.727H476zm18 .273V64h18v384h-18z"
				},
				{
					PackIconFontAwesomeKind.BarsSolid,
					"M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"
				},
				{
					PackIconFontAwesomeKind.BaseballBallSolid,
					"M368.5 363.9l28.8-13.9c11.1 22.9 26 43.2 44.1 60.9 34-42.5 54.5-96.3 54.5-154.9 0-58.5-20.4-112.2-54.2-154.6-17.8 17.3-32.6 37.1-43.6 59.5l-28.7-14.1c12.8-26 30-49 50.8-69C375.6 34.7 315 8 248 8 181.1 8 120.5 34.6 75.9 77.7c20.7 19.9 37.9 42.9 50.7 68.8l-28.7 14.1c-11-22.3-25.7-42.1-43.5-59.4C20.4 143.7 0 197.4 0 256c0 58.6 20.4 112.3 54.4 154.7 18.2-17.7 33.2-38 44.3-61l28.8 13.9c-12.9 26.7-30.3 50.3-51.5 70.7 44.5 43.1 105.1 69.7 172 69.7 66.8 0 127.3-26.5 171.9-69.5-21.1-20.4-38.5-43.9-51.4-70.6zm-228.3-32l-30.5-9.8c14.9-46.4 12.7-93.8-.6-134l30.4-10c15 45.6 18 99.9.7 153.8zm216.3-153.4l30.4 10c-13.2 40.1-15.5 87.5-.6 134l-30.5 9.8c-17.3-54-14.3-108.3.7-153.8z"
				},
				{
					PackIconFontAwesomeKind.BasketballBallSolid,
					"M212.3 10.3c-43.8 6.3-86.2 24.1-122.2 53.8l77.4 77.4c27.8-35.8 43.3-81.2 44.8-131.2zM248 222L405.9 64.1c-42.4-35-93.6-53.5-145.5-56.1-1.2 63.9-21.5 122.3-58.7 167.7L248 222zM56.1 98.1c-29.7 36-47.5 78.4-53.8 122.2 50-1.5 95.5-17 131.2-44.8L56.1 98.1zm272.2 204.2c45.3-37.1 103.7-57.4 167.7-58.7-2.6-51.9-21.1-103.1-56.1-145.5L282 256l46.3 46.3zM248 290L90.1 447.9c42.4 34.9 93.6 53.5 145.5 56.1 1.3-64 21.6-122.4 58.7-167.7L248 290zm191.9 123.9c29.7-36 47.5-78.4 53.8-122.2-50.1 1.6-95.5 17.1-131.2 44.8l77.4 77.4zM167.7 209.7C122.3 246.9 63.9 267.3 0 268.4c2.6 51.9 21.1 103.1 56.1 145.5L214 256l-46.3-46.3zm116 292c43.8-6.3 86.2-24.1 122.2-53.8l-77.4-77.4c-27.7 35.7-43.2 81.2-44.8 131.2z"
				},
				{
					PackIconFontAwesomeKind.BathSolid,
					"M32,384a95.4,95.4,0,0,0,32,71.09V496a16,16,0,0,0,16,16h32a16,16,0,0,0,16-16V480H384v16a16,16,0,0,0,16,16h32a16,16,0,0,0,16-16V455.09A95.4,95.4,0,0,0,480,384V336H32ZM496,256H80V69.25a21.26,21.26,0,0,1,36.28-15l19.27,19.26c-13.13,29.88-7.61,59.11,8.62,79.73l-.17.17A16,16,0,0,0,144,176l11.31,11.31a16,16,0,0,0,22.63,0L283.31,81.94a16,16,0,0,0,0-22.63L272,48a16,16,0,0,0-22.62,0l-.17.17c-20.62-16.23-49.83-21.75-79.73-8.62L150.22,20.28A69.25,69.25,0,0,0,32,69.25V256H16A16,16,0,0,0,0,272v16a16,16,0,0,0,16,16H496a16,16,0,0,0,16-16V272A16,16,0,0,0,496,256Z"
				},
				{
					PackIconFontAwesomeKind.BatteryEmptySolid,
					"M544 160v64h32v64h-32v64H64V160h480m16-64H48c-26.51 0-48 21.49-48 48v224c0 26.51 21.49 48 48 48h512c26.51 0 48-21.49 48-48v-16h8c13.255 0 24-10.745 24-24V184c0-13.255-10.745-24-24-24h-8v-16c0-26.51-21.49-48-48-48z"
				},
				{
					PackIconFontAwesomeKind.BatteryFullSolid,
					"M544 160v64h32v64h-32v64H64V160h480m16-64H48c-26.51 0-48 21.49-48 48v224c0 26.51 21.49 48 48 48h512c26.51 0 48-21.49 48-48v-16h8c13.255 0 24-10.745 24-24V184c0-13.255-10.745-24-24-24h-8v-16c0-26.51-21.49-48-48-48zm-48 96H96v128h416V192z"
				},
				{
					PackIconFontAwesomeKind.BatteryHalfSolid,
					"M544 160v64h32v64h-32v64H64V160h480m16-64H48c-26.51 0-48 21.49-48 48v224c0 26.51 21.49 48 48 48h512c26.51 0 48-21.49 48-48v-16h8c13.255 0 24-10.745 24-24V184c0-13.255-10.745-24-24-24h-8v-16c0-26.51-21.49-48-48-48zm-240 96H96v128h224V192z"
				},
				{
					PackIconFontAwesomeKind.BatteryQuarterSolid,
					"M544 160v64h32v64h-32v64H64V160h480m16-64H48c-26.51 0-48 21.49-48 48v224c0 26.51 21.49 48 48 48h512c26.51 0 48-21.49 48-48v-16h8c13.255 0 24-10.745 24-24V184c0-13.255-10.745-24-24-24h-8v-16c0-26.51-21.49-48-48-48zm-336 96H96v128h128V192z"
				},
				{
					PackIconFontAwesomeKind.BatteryThreeQuartersSolid,
					"M544 160v64h32v64h-32v64H64V160h480m16-64H48c-26.51 0-48 21.49-48 48v224c0 26.51 21.49 48 48 48h512c26.51 0 48-21.49 48-48v-16h8c13.255 0 24-10.745 24-24V184c0-13.255-10.745-24-24-24h-8v-16c0-26.51-21.49-48-48-48zm-144 96H96v128h320V192z"
				},
				{
					PackIconFontAwesomeKind.BattleNetBrands,
					"M448.61 225.62c26.87.18 35.57-7.43 38.92-12.37 12.47-16.32-7.06-47.6-52.85-71.33 17.76-33.58 30.11-63.68 36.34-85.3 3.38-11.83 1.09-19 .45-20.25-1.72 10.52-15.85 48.46-48.2 100.05-25-11.22-56.52-20.1-93.77-23.8-8.94-16.94-34.88-63.86-60.48-88.93C252.18 7.14 238.7 1.07 228.18.22h-.05c-13.83-1.55-22.67 5.85-27.4 11-17.2 18.53-24.33 48.87-25 84.07-7.24-12.35-17.17-24.63-28.5-25.93h-.18c-20.66-3.48-38.39 29.22-36 81.29-38.36 1.38-71 5.75-93 11.23-9.9 2.45-16.22 7.27-17.76 9.72 1-.38 22.4-9.22 111.56-9.22 5.22 53 29.75 101.82 26 93.19-9.73 15.4-38.24 62.36-47.31 97.7-5.87 22.88-4.37 37.61.15 47.14 5.57 12.75 16.41 16.72 23.2 18.26 25 5.71 55.38-3.63 86.7-21.14-7.53 12.84-13.9 28.51-9.06 39.34 7.31 19.65 44.49 18.66 88.44-9.45 20.18 32.18 40.07 57.94 55.7 74.12a39.79 39.79 0 0 0 8.75 7.09c5.14 3.21 8.58 3.37 8.58 3.37-8.24-6.75-34-38-62.54-91.78 22.22-16 45.65-38.87 67.47-69.27 122.82 4.6 143.29-24.76 148-31.64 14.67-19.88 3.43-57.44-57.32-93.69zm-77.85 106.22c23.81-37.71 30.34-67.77 29.45-92.33 27.86 17.57 47.18 37.58 49.06 58.83 1.14 12.93-8.1 29.12-78.51 33.5zM216.9 387.69c9.76-6.23 19.53-13.12 29.2-20.49 6.68 13.33 13.6 26.1 20.6 38.19-40.6 21.86-68.84 12.76-49.8-17.7zm215-171.35c-10.29-5.34-21.16-10.34-32.38-15.05a722.459 722.459 0 0 0 22.74-36.9c39.06 24.1 45.9 53.18 9.64 51.95zM279.18 398c-5.51-11.35-11-23.5-16.5-36.44 43.25 1.27 62.42-18.73 63.28-20.41 0 .07-25 15.64-62.53 12.25a718.78 718.78 0 0 0 85.06-84q13.06-15.31 24.93-31.11c-.36-.29-1.54-3-16.51-12-51.7 60.27-102.34 98-132.75 115.92-20.59-11.18-40.84-31.78-55.71-61.49-20-39.92-30-82.39-31.57-116.07 12.3.91 25.27 2.17 38.85 3.88-22.29 36.8-14.39 63-13.47 64.23 0-.07-.95-29.17 20.14-59.57a695.23 695.23 0 0 0 44.67 152.84c.93-.38 1.84.88 18.67-8.25-26.33-74.47-33.76-138.17-34-173.43 20-12.42 48.18-19.8 81.63-17.81 44.57 2.67 86.36 15.25 116.32 30.71q-10.69 15.66-23.33 32.47C365.63 152 339.1 145.84 337.5 146c.11 0 25.9 14.07 41.52 47.22a717.63 717.63 0 0 0-115.34-31.71 646.608 646.608 0 0 0-39.39-6.05c-.07.45-1.81 1.85-2.16 20.33C300 190.28 358.78 215.68 389.36 233c.74 23.55-6.95 51.61-25.41 79.57-24.6 37.31-56.39 67.23-84.77 85.43zm27.4-287c-44.56-1.66-73.58 7.43-94.69 20.67 2-52.3 21.31-76.38 38.21-75.28C267 52.15 305 108.55 306.58 111zm-130.65 3.1c.48 12.11 1.59 24.62 3.21 37.28-14.55-.85-28.74-1.25-42.4-1.26-.08 3.24-.12-51 24.67-49.59h.09c5.76 1.09 10.63 6.88 14.43 13.57zm-28.06 162c20.76 39.7 43.3 60.57 65.25 72.31-46.79 24.76-77.53 20-84.92 4.51-.2-.21-11.13-15.3 19.67-76.81zm210.06 74.8"
				},
				{
					PackIconFontAwesomeKind.BedSolid,
					"M176 256c44.11 0 80-35.89 80-80s-35.89-80-80-80-80 35.89-80 80 35.89 80 80 80zm352-128H304c-8.84 0-16 7.16-16 16v144H64V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v352c0 8.84 7.16 16 16 16h32c8.84 0 16-7.16 16-16v-48h512v48c0 8.84 7.16 16 16 16h32c8.84 0 16-7.16 16-16V240c0-61.86-50.14-112-112-112z"
				},
				{
					PackIconFontAwesomeKind.BeerSolid,
					"M368 96h-48V56c0-13.255-10.745-24-24-24H24C10.745 32 0 42.745 0 56v400c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24v-42.11l80.606-35.977C429.396 365.063 448 336.388 448 304.86V176c0-44.112-35.888-80-80-80zm16 208.86a16.018 16.018 0 0 1-9.479 14.611L320 343.805V160h48c8.822 0 16 7.178 16 16v128.86zM208 384c-8.836 0-16-7.164-16-16V144c0-8.836 7.164-16 16-16s16 7.164 16 16v224c0 8.836-7.164 16-16 16zm-96 0c-8.836 0-16-7.164-16-16V144c0-8.836 7.164-16 16-16s16 7.164 16 16v224c0 8.836-7.164 16-16 16z"
				},
				{
					PackIconFontAwesomeKind.BehanceBrands,
					"M232 237.2c31.8-15.2 48.4-38.2 48.4-74 0-70.6-52.6-87.8-113.3-87.8H0v354.4h171.8c64.4 0 124.9-30.9 124.9-102.9 0-44.5-21.1-77.4-64.7-89.7zM77.9 135.9H151c28.1 0 53.4 7.9 53.4 40.5 0 30.1-19.7 42.2-47.5 42.2h-79v-82.7zm83.3 233.7H77.9V272h84.9c34.3 0 56 14.3 56 50.6 0 35.8-25.9 47-57.6 47zm358.5-240.7H376V94h143.7v34.9zM576 305.2c0-75.9-44.4-139.2-124.9-139.2-78.2 0-131.3 58.8-131.3 135.8 0 79.9 50.3 134.7 131.3 134.7 61.3 0 101-27.6 120.1-86.3H509c-6.7 21.9-34.3 33.5-55.7 33.5-41.3 0-63-24.2-63-65.3h185.1c.3-4.2.6-8.7.6-13.2zM390.4 274c2.3-33.7 24.7-54.8 58.5-54.8 35.4 0 53.2 20.8 56.2 54.8H390.4z"
				},
				{
					PackIconFontAwesomeKind.BehanceSquareBrands,
					"M186.5 293c0 19.3-14 25.4-31.2 25.4h-45.1v-52.9h46c18.6.1 30.3 7.8 30.3 27.5zm-7.7-82.3c0-17.7-13.7-21.9-28.9-21.9h-39.6v44.8H153c15.1 0 25.8-6.6 25.8-22.9zm132.3 23.2c-18.3 0-30.5 11.4-31.7 29.7h62.2c-1.7-18.5-11.3-29.7-30.5-29.7zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zM271.7 185h77.8v-18.9h-77.8V185zm-43 110.3c0-24.1-11.4-44.9-35-51.6 17.2-8.2 26.2-17.7 26.2-37 0-38.2-28.5-47.5-61.4-47.5H68v192h93.1c34.9-.2 67.6-16.9 67.6-55.9zM380 280.5c0-41.1-24.1-75.4-67.6-75.4-42.4 0-71.1 31.8-71.1 73.6 0 43.3 27.3 73 71.1 73 33.2 0 54.7-14.9 65.1-46.8h-33.7c-3.7 11.9-18.6 18.1-30.2 18.1-22.4 0-34.1-13.1-34.1-35.3h100.2c.1-2.3.3-4.8.3-7.2z"
				},
				{
					PackIconFontAwesomeKind.BellRegular,
					"M439.39 362.29c-19.32-20.76-55.47-51.99-55.47-154.29 0-77.7-54.48-139.9-127.94-155.16V32c0-17.67-14.32-32-31.98-32s-31.98 14.33-31.98 32v20.84C118.56 68.1 64.08 130.3 64.08 208c0 102.3-36.15 133.53-55.47 154.29-6 6.45-8.66 14.16-8.61 21.71.11 16.4 12.98 32 32.1 32h383.8c19.12 0 32-15.6 32.1-32 .05-7.55-2.61-15.27-8.61-21.71zM67.53 368c21.22-27.97 44.42-74.33 44.53-159.42 0-.2-.06-.38-.06-.58 0-61.86 50.14-112 112-112s112 50.14 112 112c0 .2-.06.38-.06.58.11 85.1 23.31 131.46 44.53 159.42H67.53zM224 512c35.32 0 63.97-28.65 63.97-64H160.03c0 35.35 28.65 64 63.97 64z"
				},
				{
					PackIconFontAwesomeKind.BellSlashRegular,
					"M633.99 471.02L36 3.51C29.1-2.01 19.03-.9 13.51 6l-10 12.49C-2.02 25.39-.9 35.46 6 40.98l598 467.51c6.9 5.52 16.96 4.4 22.49-2.49l10-12.49c5.52-6.9 4.41-16.97-2.5-22.49zM163.53 368c16.71-22.03 34.48-55.8 41.4-110.58l-45.47-35.55c-3.27 90.73-36.47 120.68-54.84 140.42-6 6.45-8.66 14.16-8.61 21.71.11 16.4 12.98 32 32.1 32h279.66l-61.4-48H163.53zM320 96c61.86 0 112 50.14 112 112 0 .2-.06.38-.06.58.02 16.84 1.16 31.77 2.79 45.73l59.53 46.54c-8.31-22.13-14.34-51.49-14.34-92.85 0-77.7-54.48-139.9-127.94-155.16V32c0-17.67-14.32-32-31.98-32s-31.98 14.33-31.98 32v20.84c-26.02 5.41-49.45 16.94-69.13 32.72l38.17 29.84C275 103.18 296.65 96 320 96zm0 416c35.32 0 63.97-28.65 63.97-64H256.03c0 35.35 28.65 64 63.97 64z"
				},
				{
					PackIconFontAwesomeKind.BellSlashSolid,
					"M633.82 458.1l-90.62-70.05c.19-1.38.8-2.66.8-4.06.05-7.55-2.61-15.27-8.61-21.71-19.32-20.76-55.47-51.99-55.47-154.29 0-77.7-54.48-139.9-127.94-155.16V32c0-17.67-14.32-32-31.98-32s-31.98 14.33-31.98 32v20.84c-40.33 8.38-74.66 31.07-97.59 62.57L45.47 3.37C38.49-2.05 28.43-.8 23.01 6.18L3.37 31.45C-2.05 38.42-.8 48.47 6.18 53.9l588.35 454.73c6.98 5.43 17.03 4.17 22.46-2.81l19.64-25.27c5.42-6.97 4.17-17.02-2.81-22.45zM157.23 251.54c-8.61 67.96-36.41 93.33-52.62 110.75-6 6.45-8.66 14.16-8.61 21.71.11 16.4 12.98 32 32.1 32h241.92L157.23 251.54zM320 512c35.32 0 63.97-28.65 63.97-64H256.03c0 35.35 28.65 64 63.97 64z"
				},
				{
					PackIconFontAwesomeKind.BellSolid,
					"M224 512c35.32 0 63.97-28.65 63.97-64H160.03c0 35.35 28.65 64 63.97 64zm215.39-149.71c-19.32-20.76-55.47-51.99-55.47-154.29 0-77.7-54.48-139.9-127.94-155.16V32c0-17.67-14.32-32-31.98-32s-31.98 14.33-31.98 32v20.84C118.56 68.1 64.08 130.3 64.08 208c0 102.3-36.15 133.53-55.47 154.29-6 6.45-8.66 14.16-8.61 21.71.11 16.4 12.98 32 32.1 32h383.8c19.12 0 32-15.6 32.1-32 .05-7.55-2.61-15.27-8.61-21.71z"
				},
				{
					PackIconFontAwesomeKind.BezierCurveSolid,
					"M368 32h-96c-17.67 0-32 14.33-32 32v96c0 17.67 14.33 32 32 32h96c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zM208 88h-84.75C113.75 64.56 90.84 48 64 48 28.66 48 0 76.65 0 112s28.66 64 64 64c26.84 0 49.75-16.56 59.25-40h79.73c-55.37 32.52-95.86 87.32-109.54 152h49.4c11.3-41.61 36.77-77.21 71.04-101.56-3.7-8.08-5.88-16.99-5.88-26.44V88zm-48 232H64c-17.67 0-32 14.33-32 32v96c0 17.67 14.33 32 32 32h96c17.67 0 32-14.33 32-32v-96c0-17.67-14.33-32-32-32zM576 48c-26.84 0-49.75 16.56-59.25 40H432v72c0 9.45-2.19 18.36-5.88 26.44 34.27 24.35 59.74 59.95 71.04 101.56h49.4c-13.68-64.68-54.17-119.48-109.54-152h79.73c9.5 23.44 32.41 40 59.25 40 35.34 0 64-28.65 64-64s-28.66-64-64-64zm0 272h-96c-17.67 0-32 14.33-32 32v96c0 17.67 14.33 32 32 32h96c17.67 0 32-14.33 32-32v-96c0-17.67-14.33-32-32-32z"
				},
				{
					PackIconFontAwesomeKind.BibleSolid,
					"M448 358.4V25.6c0-16-9.6-25.6-25.6-25.6H96C41.6 0 0 41.6 0 96v320c0 54.4 41.6 96 96 96h326.4c12.8 0 25.6-9.6 25.6-25.6v-16c0-6.4-3.2-12.8-9.6-19.2-3.2-16-3.2-60.8 0-73.6 6.4-3.2 9.6-9.6 9.6-19.2zM144 144c0-8.84 7.16-16 16-16h48V80c0-8.84 7.16-16 16-16h32c8.84 0 16 7.16 16 16v48h48c8.84 0 16 7.16 16 16v32c0 8.84-7.16 16-16 16h-48v112c0 8.84-7.16 16-16 16h-32c-8.84 0-16-7.16-16-16V192h-48c-8.84 0-16-7.16-16-16v-32zm236.8 304H96c-19.2 0-32-12.8-32-32s16-32 32-32h284.8v64z"
				},
				{
					PackIconFontAwesomeKind.BicycleSolid,
					"M512.509 192.001c-16.373-.064-32.03 2.955-46.436 8.495l-77.68-125.153A24 24 0 0 0 368.001 64h-64c-8.837 0-16 7.163-16 16v16c0 8.837 7.163 16 16 16h50.649l14.896 24H256.002v-16c0-8.837-7.163-16-16-16h-87.459c-13.441 0-24.777 10.999-24.536 24.437.232 13.044 10.876 23.563 23.995 23.563h48.726l-29.417 47.52c-13.433-4.83-27.904-7.483-42.992-7.52C58.094 191.83.412 249.012.002 319.236-.413 390.279 57.055 448 128.002 448c59.642 0 109.758-40.793 123.967-96h52.033a24 24 0 0 0 20.406-11.367L410.37 201.77l14.938 24.067c-25.455 23.448-41.385 57.081-41.307 94.437.145 68.833 57.899 127.051 126.729 127.719 70.606.685 128.181-55.803 129.255-125.996 1.086-70.941-56.526-129.72-127.476-129.996zM186.75 265.772c9.727 10.529 16.673 23.661 19.642 38.228h-43.306l23.664-38.228zM128.002 400c-44.112 0-80-35.888-80-80s35.888-80 80-80c5.869 0 11.586.653 17.099 1.859l-45.505 73.509C89.715 331.327 101.213 352 120.002 352h81.3c-12.37 28.225-40.562 48-73.3 48zm162.63-96h-35.624c-3.96-31.756-19.556-59.894-42.383-80.026L237.371 184h127.547l-74.286 120zm217.057 95.886c-41.036-2.165-74.049-35.692-75.627-76.755-.812-21.121 6.633-40.518 19.335-55.263l44.433 71.586c4.66 7.508 14.524 9.816 22.032 5.156l13.594-8.437c7.508-4.66 9.817-14.524 5.156-22.032l-44.468-71.643a79.901 79.901 0 0 1 19.858-2.497c44.112 0 80 35.888 80 80-.001 45.54-38.252 82.316-84.313 79.885z"
				},
				{
					PackIconFontAwesomeKind.BikingSolid,
					"M400 96a48 48 0 1 0-48-48 48 48 0 0 0 48 48zm-4 121a31.9 31.9 0 0 0 20 7h64a32 32 0 0 0 0-64h-52.78L356 103a31.94 31.94 0 0 0-40.81.68l-112 96a32 32 0 0 0 3.08 50.92L288 305.12V416a32 32 0 0 0 64 0V288a32 32 0 0 0-14.25-26.62l-41.36-27.57 58.25-49.92zm116 39a128 128 0 1 0 128 128 128 128 0 0 0-128-128zm0 192a64 64 0 1 1 64-64 64 64 0 0 1-64 64zM128 256a128 128 0 1 0 128 128 128 128 0 0 0-128-128zm0 192a64 64 0 1 1 64-64 64 64 0 0 1-64 64z"
				},
				{
					PackIconFontAwesomeKind.BimobjectBrands,
					"M416 32H32C14.4 32 0 46.4 0 64v384c0 17.6 14.4 32 32 32h384c17.6 0 32-14.4 32-32V64c0-17.6-14.4-32-32-32zm-64 257.4c0 49.4-11.4 82.6-103.8 82.6h-16.9c-44.1 0-62.4-14.9-70.4-38.8h-.9V368H96V136h64v74.7h1.1c4.6-30.5 39.7-38.8 69.7-38.8h17.3c92.4 0 103.8 33.1 103.8 82.5v35zm-64-28.9v22.9c0 21.7-3.4 33.8-38.4 33.8h-45.3c-28.9 0-44.1-6.5-44.1-35.7v-19c0-29.3 15.2-35.7 44.1-35.7h45.3c35-.2 38.4 12 38.4 33.7z"
				},
				{
					PackIconFontAwesomeKind.BinocularsSolid,
					"M416 48c0-8.84-7.16-16-16-16h-64c-8.84 0-16 7.16-16 16v48h96V48zM63.91 159.99C61.4 253.84 3.46 274.22 0 404v44c0 17.67 14.33 32 32 32h96c17.67 0 32-14.33 32-32V288h32V128H95.84c-17.63 0-31.45 14.37-31.93 31.99zm384.18 0c-.48-17.62-14.3-31.99-31.93-31.99H320v160h32v160c0 17.67 14.33 32 32 32h96c17.67 0 32-14.33 32-32v-44c-3.46-129.78-61.4-150.16-63.91-244.01zM176 32h-64c-8.84 0-16 7.16-16 16v48h96V48c0-8.84-7.16-16-16-16zm48 256h64V128h-64v160z"
				},
				{
					PackIconFontAwesomeKind.BiohazardSolid,
					"M287.9 112c18.6 0 36.2 3.8 52.8 9.6 13.3-10.3 23.6-24.3 29.5-40.7-25.2-10.9-53-17-82.2-17-29.1 0-56.9 6-82.1 16.9 5.9 16.4 16.2 30.4 29.5 40.7 16.5-5.7 34-9.5 52.5-9.5zM163.6 438.7c12-11.8 20.4-26.4 24.5-42.4-32.9-26.4-54.8-65.3-58.9-109.6-8.5-2.8-17.2-4.6-26.4-4.6-7.6 0-15.2 1-22.5 3.1 4.1 62.8 35.8 118 83.3 153.5zm224.2-42.6c4.1 16 12.5 30.7 24.5 42.5 47.4-35.5 79.1-90.7 83-153.5-7.2-2-14.7-3-22.2-3-9.2 0-18 1.9-26.6 4.7-4.1 44.2-26 82.9-58.7 109.3zm113.5-205c-17.6-10.4-36.3-16.6-55.3-19.9 6-17.7 10-36.4 10-56.2 0-41-14.5-80.8-41-112.2-2.5-3-6.6-3.7-10-1.8-3.3 1.9-4.8 6-3.6 9.7 4.5 13.8 6.6 26.3 6.6 38.5 0 67.8-53.8 122.9-120 122.9S168 117 168 49.2c0-12.1 2.2-24.7 6.6-38.5 1.2-3.7-.3-7.8-3.6-9.7-3.4-1.9-7.5-1.2-10 1.8C134.6 34.2 120 74 120 115c0 19.8 3.9 38.5 10 56.2-18.9 3.3-37.7 9.5-55.3 19.9-34.6 20.5-61 53.3-74.3 92.4-1.3 3.7.2 7.7 3.5 9.8 3.3 2 7.5 1.3 10-1.6 9.4-10.8 19-19.1 29.2-25.1 57.3-33.9 130.8-13.7 163.9 45 33.1 58.7 13.4 134-43.9 167.9-10.2 6.1-22 10.4-35.8 13.4-3.7.8-6.4 4.2-6.4 8.1.1 4 2.7 7.3 6.5 8 39.7 7.8 80.6.8 115.2-19.7 18-10.6 32.9-24.5 45.3-40.1 12.4 15.6 27.3 29.5 45.3 40.1 34.6 20.5 75.5 27.5 115.2 19.7 3.8-.7 6.4-4 6.5-8 0-3.9-2.6-7.3-6.4-8.1-13.9-2.9-25.6-7.3-35.8-13.4-57.3-33.9-77-109.2-43.9-167.9s106.6-78.9 163.9-45c10.2 6.1 19.8 14.3 29.2 25.1 2.5 2.9 6.7 3.6 10 1.6s4.8-6.1 3.5-9.8c-13.1-39.1-39.5-72-74.1-92.4zm-213.4 129c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48z"
				},
				{
					PackIconFontAwesomeKind.BirthdayCakeSolid,
					"M448 384c-28.02 0-31.26-32-74.5-32-43.43 0-46.825 32-74.75 32-27.695 0-31.454-32-74.75-32-42.842 0-47.218 32-74.5 32-28.148 0-31.202-32-74.75-32-43.547 0-46.653 32-74.75 32v-80c0-26.5 21.5-48 48-48h16V112h64v144h64V112h64v144h64V112h64v144h16c26.5 0 48 21.5 48 48v80zm0 128H0v-96c43.356 0 46.767-32 74.75-32 27.951 0 31.253 32 74.75 32 42.843 0 47.217-32 74.5-32 28.148 0 31.201 32 74.75 32 43.357 0 46.767-32 74.75-32 27.488 0 31.252 32 74.5 32v96zM96 96c-17.75 0-32-14.25-32-32 0-31 32-23 32-64 12 0 32 29.5 32 56s-14.25 40-32 40zm128 0c-17.75 0-32-14.25-32-32 0-31 32-23 32-64 12 0 32 29.5 32 56s-14.25 40-32 40zm128 0c-17.75 0-32-14.25-32-32 0-31 32-23 32-64 12 0 32 29.5 32 56s-14.25 40-32 40z"
				},
				{
					PackIconFontAwesomeKind.BitbucketBrands,
					"M22.2 32A16 16 0 0 0 6 47.8a26.35 26.35 0 0 0 .2 2.8l67.9 412.1a21.77 21.77 0 0 0 21.3 18.2h325.7a16 16 0 0 0 16-13.4L505 50.7a16 16 0 0 0-13.2-18.3 24.58 24.58 0 0 0-2.8-.2L22.2 32zm285.9 297.8h-104l-28.1-147h157.3l-25.2 147z"
				},
				{
					PackIconFontAwesomeKind.BitcoinBrands,
					"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zm-141.651-35.33c4.937-32.999-20.191-50.739-54.55-62.573l11.146-44.702-27.213-6.781-10.851 43.524c-7.154-1.783-14.502-3.464-21.803-5.13l10.929-43.81-27.198-6.781-11.153 44.686c-5.922-1.349-11.735-2.682-17.377-4.084l.031-.14-37.53-9.37-7.239 29.062s20.191 4.627 19.765 4.913c11.022 2.751 13.014 10.044 12.68 15.825l-12.696 50.925c.76.194 1.744.473 2.829.907-.907-.225-1.876-.473-2.876-.713l-17.796 71.338c-1.349 3.348-4.767 8.37-12.471 6.464.271.395-19.78-4.937-19.78-4.937l-13.51 31.147 35.414 8.827c6.588 1.651 13.045 3.379 19.4 5.006l-11.262 45.213 27.182 6.781 11.153-44.733a1038.209 1038.209 0 0 0 21.687 5.627l-11.115 44.523 27.213 6.781 11.262-45.128c46.404 8.781 81.299 5.239 95.986-36.727 11.836-33.79-.589-53.281-25.004-65.991 17.78-4.098 31.174-15.792 34.747-39.949zm-62.177 87.179c-8.41 33.79-65.308 15.523-83.755 10.943l14.944-59.899c18.446 4.603 77.6 13.717 68.811 48.956zm8.417-87.667c-7.673 30.736-55.031 15.12-70.393 11.292l13.548-54.327c15.363 3.828 64.836 10.973 56.845 43.035z"
				},
				{
					PackIconFontAwesomeKind.BityBrands,
					"M78.4 67.2C173.8-22 324.5-24 421.5 71c14.3 14.1-6.4 37.1-22.4 21.5-84.8-82.4-215.8-80.3-298.9-3.2-16.3 15.1-36.5-8.3-21.8-22.1zm98.9 418.6c19.3 5.7 29.3-23.6 7.9-30C73 421.9 9.4 306.1 37.7 194.8c5-19.6-24.9-28.1-30.2-7.1-32.1 127.4 41.1 259.8 169.8 298.1zm148.1-2c121.9-40.2 192.9-166.9 164.4-291-4.5-19.7-34.9-13.8-30 7.9 24.2 107.7-37.1 217.9-143.2 253.4-21.2 7-10.4 36 8.8 29.7zm-62.9-79l.2-71.8c0-8.2-6.6-14.8-14.8-14.8-8.2 0-14.8 6.7-14.8 14.8l-.2 71.8c0 8.2 6.6 14.8 14.8 14.8s14.8-6.6 14.8-14.8zm71-269c2.1 90.9 4.7 131.9-85.5 132.5-92.5-.7-86.9-44.3-85.5-132.5 0-21.8-32.5-19.6-32.5 0v71.6c0 69.3 60.7 90.9 118 90.1 57.3.8 118-20.8 118-90.1v-71.6c0-19.6-32.5-21.8-32.5 0z"
				},
				{
					PackIconFontAwesomeKind.BlackberryBrands,
					"M166 116.9c0 23.4-16.4 49.1-72.5 49.1H23.4l21-88.8h67.8c42.1 0 53.8 23.3 53.8 39.7zm126.2-39.7h-67.8L205.7 166h70.1c53.8 0 70.1-25.7 70.1-49.1.1-16.4-11.6-39.7-53.7-39.7zM88.8 208.1H21L0 296.9h70.1c56.1 0 72.5-23.4 72.5-49.1 0-16.3-11.7-39.7-53.8-39.7zm180.1 0h-67.8l-18.7 88.8h70.1c53.8 0 70.1-23.4 70.1-49.1 0-16.3-11.7-39.7-53.7-39.7zm189.3-53.8h-67.8l-18.7 88.8h70.1c53.8 0 70.1-23.4 70.1-49.1.1-16.3-11.6-39.7-53.7-39.7zm-28 137.9h-67.8L343.7 381h70.1c56.1 0 70.1-23.4 70.1-49.1 0-16.3-11.6-39.7-53.7-39.7zM240.8 346H173l-18.7 88.8h70.1c56.1 0 70.1-25.7 70.1-49.1.1-16.3-11.6-39.7-53.7-39.7z"
				},
				{
					PackIconFontAwesomeKind.BlackTieBrands,
					"M0 32v448h448V32H0zm316.5 325.2L224 445.9l-92.5-88.7 64.5-184-64.5-86.6h184.9L252 173.2l64.5 184z"
				},
				{
					PackIconFontAwesomeKind.BlenderPhoneSolid,
					"M392 64h166.54L576 0H192v352h288l17.46-64H392c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h114.18l17.46-64H392c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h140.36l17.46-64H392c-4.42 0-8-3.58-8-8V72c0-4.42 3.58-8 8-8zM158.8 335.01l-25.78-63.26c-2.78-6.81-9.8-10.99-17.24-10.26l-45.03 4.42c-17.28-46.94-17.65-99.78 0-147.72l45.03 4.42c7.43.73 14.46-3.46 17.24-10.26l25.78-63.26c3.02-7.39.2-15.85-6.68-20.07l-39.28-24.1C98.51-3.87 80.09-.5 68.95 11.97c-92.57 103.6-92 259.55 2.1 362.49 9.87 10.8 29.12 12.48 41.65 4.8l39.41-24.18c6.89-4.22 9.7-12.67 6.69-20.07zM480 384H192c-35.35 0-64 28.65-64 64v32c0 17.67 14.33 32 32 32h352c17.67 0 32-14.33 32-32v-32c0-35.35-28.65-64-64-64zm-144 96c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z"
				},
				{
					PackIconFontAwesomeKind.BlenderSolid,
					"M416 384H160c-35.35 0-64 28.65-64 64v32c0 17.67 14.33 32 32 32h320c17.67 0 32-14.33 32-32v-32c0-35.35-28.65-64-64-64zm-128 96c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32zm40-416h166.54L512 0H48C21.49 0 0 21.49 0 48v160c0 26.51 21.49 48 48 48h103.27l8.73 96h256l17.46-64H328c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h114.18l17.46-64H328c-4.42 0-8-3.

Markdig.dll

Decompiled 5 months ago
using System;
using System.Buffers;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Markdig.Extensions.Abbreviations;
using Markdig.Extensions.AutoIdentifiers;
using Markdig.Extensions.AutoLinks;
using Markdig.Extensions.Bootstrap;
using Markdig.Extensions.Citations;
using Markdig.Extensions.CustomContainers;
using Markdig.Extensions.DefinitionLists;
using Markdig.Extensions.Diagrams;
using Markdig.Extensions.Emoji;
using Markdig.Extensions.EmphasisExtras;
using Markdig.Extensions.Figures;
using Markdig.Extensions.Footers;
using Markdig.Extensions.Footnotes;
using Markdig.Extensions.GenericAttributes;
using Markdig.Extensions.Globalization;
using Markdig.Extensions.Hardlines;
using Markdig.Extensions.JiraLinks;
using Markdig.Extensions.ListExtras;
using Markdig.Extensions.Mathematics;
using Markdig.Extensions.MediaLinks;
using Markdig.Extensions.NonAsciiNoEscape;
using Markdig.Extensions.PragmaLines;
using Markdig.Extensions.ReferralLinks;
using Markdig.Extensions.SelfPipeline;
using Markdig.Extensions.SmartyPants;
using Markdig.Extensions.Tables;
using Markdig.Extensions.TaskLists;
using Markdig.Extensions.TextRenderer;
using Markdig.Extensions.Yaml;
using Markdig.Helpers;
using Markdig.Parsers;
using Markdig.Parsers.Inlines;
using Markdig.Renderers;
using Markdig.Renderers.Html;
using Markdig.Renderers.Html.Inlines;
using Markdig.Renderers.Normalize;
using Markdig.Renderers.Normalize.Inlines;
using Markdig.Renderers.Roundtrip;
using Markdig.Renderers.Roundtrip.Inlines;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Alexandre Mutel")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Alexandre Mutel")]
[assembly: AssemblyDescription("A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET with 20+ builtin extensions (pipetables, footnotes, definition lists... etc.)")]
[assembly: AssemblyFileVersion("0.31.0.0")]
[assembly: AssemblyInformationalVersion("0.31.0+8155a1e3d657dbe17c14e5612791b4a7d7f3da68")]
[assembly: AssemblyProduct("Markdig")]
[assembly: AssemblyTitle("Markdig")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/xoofx/markdig")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("Markdig.Tests")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.31.0.0")]
[module: UnverifiableCode]
[module: SkipLocalsInit]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Markdig
{
	public interface IMarkdownExtension
	{
		void Setup(MarkdownPipelineBuilder pipeline);

		void Setup(MarkdownPipeline pipeline, IMarkdownRenderer renderer);
	}
	public static class Markdown
	{
		private static string? _Version;

		internal static readonly MarkdownPipeline DefaultPipeline = new MarkdownPipelineBuilder().Build();

		private static readonly MarkdownPipeline _defaultTrackTriviaPipeline = new MarkdownPipelineBuilder().EnableTrackTrivia().Build();

		public static string Version
		{
			get
			{
				if (_Version == null)
				{
					_Version = ((AssemblyFileVersionAttribute)typeof(Markdown).Assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), inherit: false).FirstOrDefault())?.Version ?? "Unknown";
				}
				return _Version;
			}
		}

		private static MarkdownPipeline GetPipeline(MarkdownPipeline? pipeline, string markdown)
		{
			if (pipeline == null)
			{
				return DefaultPipeline;
			}
			if (pipeline.SelfPipeline != null)
			{
				return pipeline.SelfPipeline.CreatePipelineFromInput(markdown);
			}
			return pipeline;
		}

		public static string Normalize(string markdown, NormalizeOptions? options = null, MarkdownPipeline? pipeline = null, MarkdownParserContext? context = null)
		{
			StringWriter stringWriter = new StringWriter();
			Normalize(markdown, stringWriter, options, pipeline, context);
			return stringWriter.ToString();
		}

		public static MarkdownDocument Normalize(string markdown, TextWriter writer, NormalizeOptions? options = null, MarkdownPipeline? pipeline = null, MarkdownParserContext? context = null)
		{
			if (markdown == null)
			{
				ThrowHelper.ArgumentNullException_markdown();
			}
			pipeline = GetPipeline(pipeline, markdown);
			MarkdownDocument markdownDocument = MarkdownParser.Parse(markdown, pipeline, context);
			NormalizeRenderer normalizeRenderer = new NormalizeRenderer(writer, options);
			pipeline.Setup(normalizeRenderer);
			normalizeRenderer.Render(markdownDocument);
			writer.Flush();
			return markdownDocument;
		}

		public static string ToHtml(string markdown, MarkdownPipeline? pipeline = null, MarkdownParserContext? context = null)
		{
			if (markdown == null)
			{
				ThrowHelper.ArgumentNullException_markdown();
			}
			pipeline = GetPipeline(pipeline, markdown);
			return MarkdownParser.Parse(markdown, pipeline, context).ToHtml(pipeline);
		}

		public static string ToHtml(this MarkdownDocument document, MarkdownPipeline? pipeline = null)
		{
			if (document == null)
			{
				ThrowHelper.ArgumentNullException("document");
			}
			if (pipeline == null)
			{
				pipeline = DefaultPipeline;
			}
			MarkdownPipeline.RentedHtmlRenderer rentedHtmlRenderer = pipeline.RentHtmlRenderer();
			try
			{
				HtmlRenderer instance = rentedHtmlRenderer.Instance;
				instance.Render(document);
				instance.Writer.Flush();
				return instance.Writer.ToString() ?? string.Empty;
			}
			finally
			{
				((IDisposable)rentedHtmlRenderer).Dispose();
			}
		}

		public static void ToHtml(this MarkdownDocument document, TextWriter writer, MarkdownPipeline? pipeline = null)
		{
			if (document == null)
			{
				ThrowHelper.ArgumentNullException("document");
			}
			if (writer == null)
			{
				ThrowHelper.ArgumentNullException_writer();
			}
			if (pipeline == null)
			{
				pipeline = DefaultPipeline;
			}
			MarkdownPipeline.RentedHtmlRenderer rentedHtmlRenderer = pipeline.RentHtmlRenderer(writer);
			try
			{
				HtmlRenderer instance = rentedHtmlRenderer.Instance;
				instance.Render(document);
				instance.Writer.Flush();
			}
			finally
			{
				((IDisposable)rentedHtmlRenderer).Dispose();
			}
		}

		public static MarkdownDocument ToHtml(string markdown, TextWriter writer, MarkdownPipeline? pipeline = null, MarkdownParserContext? context = null)
		{
			if (markdown == null)
			{
				ThrowHelper.ArgumentNullException_markdown();
			}
			if (writer == null)
			{
				ThrowHelper.ArgumentNullException_writer();
			}
			pipeline = GetPipeline(pipeline, markdown);
			MarkdownDocument markdownDocument = MarkdownParser.Parse(markdown, pipeline, context);
			MarkdownPipeline.RentedHtmlRenderer rentedHtmlRenderer = pipeline.RentHtmlRenderer(writer);
			try
			{
				rentedHtmlRenderer.Instance.Render(markdownDocument);
				writer.Flush();
				return markdownDocument;
			}
			finally
			{
				((IDisposable)rentedHtmlRenderer).Dispose();
			}
		}

		public static object Convert(string markdown, IMarkdownRenderer renderer, MarkdownPipeline? pipeline = null, MarkdownParserContext? context = null)
		{
			if (markdown == null)
			{
				ThrowHelper.ArgumentNullException_markdown();
			}
			if (renderer == null)
			{
				ThrowHelper.ArgumentNullException("renderer");
			}
			pipeline = GetPipeline(pipeline, markdown);
			MarkdownDocument markdownObject = MarkdownParser.Parse(markdown, pipeline, context);
			pipeline.Setup(renderer);
			return renderer.Render(markdownObject);
		}

		public static MarkdownDocument Parse(string markdown, bool trackTrivia = false)
		{
			if (markdown == null)
			{
				ThrowHelper.ArgumentNullException_markdown();
			}
			MarkdownPipeline pipeline = (trackTrivia ? _defaultTrackTriviaPipeline : null);
			return Parse(markdown, pipeline);
		}

		public static MarkdownDocument Parse(string markdown, MarkdownPipeline? pipeline, MarkdownParserContext? context = null)
		{
			if (markdown == null)
			{
				ThrowHelper.ArgumentNullException_markdown();
			}
			pipeline = GetPipeline(pipeline, markdown);
			return MarkdownParser.Parse(markdown, pipeline, context);
		}

		public static MarkdownDocument ToPlainText(string markdown, TextWriter writer, MarkdownPipeline? pipeline = null, MarkdownParserContext? context = null)
		{
			if (markdown == null)
			{
				ThrowHelper.ArgumentNullException_markdown();
			}
			if (writer == null)
			{
				ThrowHelper.ArgumentNullException_writer();
			}
			pipeline = GetPipeline(pipeline, markdown);
			MarkdownDocument markdownDocument = MarkdownParser.Parse(markdown, pipeline, context);
			HtmlRenderer htmlRenderer = new HtmlRenderer(writer)
			{
				EnableHtmlForBlock = false,
				EnableHtmlForInline = false,
				EnableHtmlEscape = false
			};
			pipeline.Setup(htmlRenderer);
			htmlRenderer.Render(markdownDocument);
			writer.Flush();
			return markdownDocument;
		}

		public static string ToPlainText(string markdown, MarkdownPipeline? pipeline = null, MarkdownParserContext? context = null)
		{
			if (markdown == null)
			{
				ThrowHelper.ArgumentNullException_markdown();
			}
			StringWriter stringWriter = new StringWriter();
			ToPlainText(markdown, stringWriter, pipeline, context);
			return stringWriter.ToString();
		}
	}
	public static class MarkdownExtensions
	{
		public static MarkdownPipelineBuilder Use<TExtension>(this MarkdownPipelineBuilder pipeline) where TExtension : class, IMarkdownExtension, new()
		{
			pipeline.Extensions.AddIfNotAlready<TExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder Use<TExtension>(this MarkdownPipelineBuilder pipeline, TExtension extension) where TExtension : class, IMarkdownExtension
		{
			pipeline.Extensions.AddIfNotAlready(extension);
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseAdvancedExtensions(this MarkdownPipelineBuilder pipeline)
		{
			return pipeline.UseAbbreviations().UseAutoIdentifiers().UseCitations()
				.UseCustomContainers()
				.UseDefinitionLists()
				.UseEmphasisExtras()
				.UseFigures()
				.UseFooters()
				.UseFootnotes()
				.UseGridTables()
				.UseMathematics()
				.UseMediaLinks()
				.UsePipeTables()
				.UseListExtras()
				.UseTaskLists()
				.UseDiagrams()
				.UseAutoLinks()
				.UseGenericAttributes();
		}

		public static MarkdownPipelineBuilder UseAutoLinks(this MarkdownPipelineBuilder pipeline, AutoLinkOptions? options = null)
		{
			pipeline.Extensions.ReplaceOrAdd<AutoLinkExtension>(new AutoLinkExtension(options));
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseNonAsciiNoEscape(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<NonAsciiNoEscapeExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseYamlFrontMatter(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<YamlFrontMatterExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseSelfPipeline(this MarkdownPipelineBuilder pipeline, string defaultTag = "markdig", string? defaultExtensions = null)
		{
			if (pipeline.Extensions.Count != 0)
			{
				ThrowHelper.InvalidOperationException("The SelfPipeline extension cannot be used with other extensions");
			}
			pipeline.Extensions.Add(new SelfPipelineExtension(defaultTag, defaultExtensions));
			return pipeline;
		}

		public static MarkdownPipelineBuilder UsePragmaLines(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<PragmaLineExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseDiagrams(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<DiagramExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UsePreciseSourceLocation(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.PreciseSourceLocation = true;
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseTaskLists(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<TaskListExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseCustomContainers(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<CustomContainerExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseMediaLinks(this MarkdownPipelineBuilder pipeline, MediaOptions? options = null)
		{
			if (!pipeline.Extensions.Contains<MediaLinkExtension>())
			{
				pipeline.Extensions.Add(new MediaLinkExtension(options));
			}
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseAutoIdentifiers(this MarkdownPipelineBuilder pipeline, AutoIdentifierOptions options = AutoIdentifierOptions.Default)
		{
			if (!pipeline.Extensions.Contains<AutoIdentifierExtension>())
			{
				pipeline.Extensions.Add(new AutoIdentifierExtension(options));
			}
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseSmartyPants(this MarkdownPipelineBuilder pipeline, SmartyPantOptions? options = null)
		{
			if (!pipeline.Extensions.Contains<SmartyPantsExtension>())
			{
				pipeline.Extensions.Add(new SmartyPantsExtension(options));
			}
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseBootstrap(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<BootstrapExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseMathematics(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<MathExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseFigures(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<FigureExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseAbbreviations(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<AbbreviationExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseDefinitionLists(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<DefinitionListExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UsePipeTables(this MarkdownPipelineBuilder pipeline, PipeTableOptions? options = null)
		{
			if (!pipeline.Extensions.Contains<PipeTableExtension>())
			{
				pipeline.Extensions.Add(new PipeTableExtension(options));
			}
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseGridTables(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<GridTableExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseCitations(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<CitationExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseFooters(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<FooterExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseFootnotes(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<FootnoteExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseSoftlineBreakAsHardlineBreak(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<SoftlineBreakAsHardlineExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseEmphasisExtras(this MarkdownPipelineBuilder pipeline, EmphasisExtraOptions options = EmphasisExtraOptions.Default)
		{
			if (!pipeline.Extensions.Contains<EmphasisExtraExtension>())
			{
				pipeline.Extensions.Add(new EmphasisExtraExtension(options));
			}
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseListExtras(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<ListExtraExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseGenericAttributes(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<GenericAttributesExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseEmojiAndSmiley(this MarkdownPipelineBuilder pipeline, bool enableSmileys = true)
		{
			if (!pipeline.Extensions.Contains<EmojiExtension>())
			{
				EmojiMapping emojiMapping = (enableSmileys ? EmojiMapping.DefaultEmojisAndSmileysMapping : EmojiMapping.DefaultEmojisOnlyMapping);
				pipeline.Extensions.Add(new EmojiExtension(emojiMapping));
			}
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseEmojiAndSmiley(this MarkdownPipelineBuilder pipeline, EmojiMapping customEmojiMapping)
		{
			if (!pipeline.Extensions.Contains<EmojiExtension>())
			{
				pipeline.Extensions.Add(new EmojiExtension(customEmojiMapping));
			}
			return pipeline;
		}

		[Obsolete("Call `UseReferralLinks(\"nofollow\")` instead")]
		public static MarkdownPipelineBuilder UseNoFollowLinks(this MarkdownPipelineBuilder pipeline)
		{
			return pipeline.UseReferralLinks("nofollow");
		}

		public static MarkdownPipelineBuilder UseReferralLinks(this MarkdownPipelineBuilder pipeline, params string[] rels)
		{
			if (pipeline.Extensions.TryFind<ReferralLinksExtension>(out ReferralLinksExtension item))
			{
				foreach (string item2 in rels)
				{
					if (!item.Rels.Contains(item2))
					{
						item.Rels.Add(item2);
					}
				}
			}
			else
			{
				pipeline.Extensions.Add(new ReferralLinksExtension(rels));
			}
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseJiraLinks(this MarkdownPipelineBuilder pipeline, JiraLinkOptions options)
		{
			if (!pipeline.Extensions.Contains<JiraLinkExtension>())
			{
				pipeline.Extensions.Add(new JiraLinkExtension(options));
			}
			return pipeline;
		}

		public static MarkdownPipelineBuilder UseGlobalization(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.Extensions.AddIfNotAlready<GlobalizationExtension>();
			return pipeline;
		}

		public static MarkdownPipelineBuilder DisableHtml(this MarkdownPipelineBuilder pipeline)
		{
			HtmlBlockParser htmlBlockParser = pipeline.BlockParsers.Find<HtmlBlockParser>();
			if (htmlBlockParser != null)
			{
				pipeline.BlockParsers.Remove(htmlBlockParser);
			}
			AutolinkInlineParser autolinkInlineParser = pipeline.InlineParsers.Find<AutolinkInlineParser>();
			if (autolinkInlineParser != null)
			{
				autolinkInlineParser.EnableHtmlParsing = false;
			}
			return pipeline;
		}

		public static MarkdownPipelineBuilder Configure(this MarkdownPipelineBuilder pipeline, string? extensions)
		{
			if (extensions == null)
			{
				return pipeline;
			}
			string[] array = extensions.Split(new char[1] { '+' }, StringSplitOptions.RemoveEmptyEntries);
			foreach (string text in array)
			{
				switch (text.ToLowerInvariant())
				{
				case "advanced":
					pipeline.UseAdvancedExtensions();
					continue;
				case "pipetables":
					pipeline.UsePipeTables();
					continue;
				case "gfm-pipetables":
					pipeline.UsePipeTables(new PipeTableOptions
					{
						UseHeaderForColumnCount = true
					});
					continue;
				case "emphasisextras":
					pipeline.UseEmphasisExtras();
					continue;
				case "listextras":
					pipeline.UseListExtras();
					continue;
				case "hardlinebreak":
					pipeline.UseSoftlineBreakAsHardlineBreak();
					continue;
				case "footnotes":
					pipeline.UseFootnotes();
					continue;
				case "footers":
					pipeline.UseFooters();
					continue;
				case "citations":
					pipeline.UseCitations();
					continue;
				case "attributes":
					pipeline.UseGenericAttributes();
					continue;
				case "gridtables":
					pipeline.UseGridTables();
					continue;
				case "abbreviations":
					pipeline.UseAbbreviations();
					continue;
				case "emojis":
					pipeline.UseEmojiAndSmiley();
					continue;
				case "definitionlists":
					pipeline.UseDefinitionLists();
					continue;
				case "customcontainers":
					pipeline.UseCustomContainers();
					continue;
				case "figures":
					pipeline.UseFigures();
					continue;
				case "mathematics":
					pipeline.UseMathematics();
					continue;
				case "bootstrap":
					pipeline.UseBootstrap();
					continue;
				case "medialinks":
					pipeline.UseMediaLinks();
					continue;
				case "smartypants":
					pipeline.UseSmartyPants();
					continue;
				case "autoidentifiers":
					pipeline.UseAutoIdentifiers();
					continue;
				case "tasklists":
					pipeline.UseTaskLists();
					continue;
				case "diagrams":
					pipeline.UseDiagrams();
					continue;
				case "nofollowlinks":
					pipeline.UseReferralLinks("nofollow");
					continue;
				case "noopenerlinks":
					pipeline.UseReferralLinks("noopener");
					continue;
				case "noreferrerlinks":
					pipeline.UseReferralLinks("noreferrer");
					continue;
				case "nohtml":
					pipeline.DisableHtml();
					continue;
				case "yaml":
					pipeline.UseYamlFrontMatter();
					continue;
				case "nonascii-noescape":
					pipeline.UseNonAsciiNoEscape();
					continue;
				case "autolinks":
					pipeline.UseAutoLinks();
					continue;
				case "globalization":
					pipeline.UseGlobalization();
					continue;
				case "common":
					continue;
				}
				throw new ArgumentException($"Invalid extension `{text}` from `{extensions}`", "extensions");
			}
			return pipeline;
		}

		public static MarkdownPipelineBuilder ConfigureNewLine(this MarkdownPipelineBuilder pipeline, string newLine)
		{
			pipeline.Use(new ConfigureNewLineExtension(newLine));
			return pipeline;
		}

		public static MarkdownPipelineBuilder DisableHeadings(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.BlockParsers.TryRemove<HeadingBlockParser>();
			if (pipeline.BlockParsers.TryFind<ParagraphBlockParser>(out ParagraphBlockParser item))
			{
				item.ParseSetexHeadings = false;
			}
			return pipeline;
		}

		public static MarkdownPipelineBuilder EnableTrackTrivia(this MarkdownPipelineBuilder pipeline)
		{
			pipeline.TrackTrivia = true;
			if (pipeline.BlockParsers.TryFind<FencedCodeBlockParser>(out FencedCodeBlockParser item))
			{
				item.InfoParser = FencedBlockParserBase<FencedCodeBlock>.RoundtripInfoParser;
			}
			return pipeline;
		}
	}
	public class MarkdownParserContext
	{
		public Dictionary<object, object> Properties { get; }

		public MarkdownParserContext()
		{
			Properties = new Dictionary<object, object>();
		}
	}
	public sealed class MarkdownPipeline
	{
		internal sealed class HtmlRendererCache : ObjectCache<HtmlRenderer>
		{
			private static readonly TextWriter s_dummyWriter = new FastStringWriter();

			private readonly MarkdownPipeline _pipeline;

			private readonly bool _customWriter;

			public HtmlRendererCache(MarkdownPipeline pipeline, bool customWriter = false)
			{
				_pipeline = pipeline;
				_customWriter = customWriter;
			}

			protected override HtmlRenderer NewInstance()
			{
				HtmlRenderer htmlRenderer = new HtmlRenderer(_customWriter ? s_dummyWriter : new FastStringWriter());
				_pipeline.Setup(htmlRenderer);
				return htmlRenderer;
			}

			protected override void Reset(HtmlRenderer instance)
			{
				instance.ResetInternal();
				if (_customWriter)
				{
					instance.Writer = s_dummyWriter;
				}
				else
				{
					((FastStringWriter)instance.Writer).Reset();
				}
			}
		}

		internal readonly struct RentedHtmlRenderer : IDisposable
		{
			private readonly HtmlRendererCache _cache;

			public readonly HtmlRenderer Instance;

			internal RentedHtmlRenderer(HtmlRendererCache cache, HtmlRenderer renderer)
			{
				_cache = cache;
				Instance = renderer;
			}

			public void Dispose()
			{
				_cache.Release(Instance);
			}
		}

		internal ProcessDocumentDelegate? DocumentProcessed;

		internal SelfPipelineExtension? SelfPipeline;

		private HtmlRendererCache? _rendererCache;

		private HtmlRendererCache? _rendererCacheForCustomWriter;

		internal bool PreciseSourceLocation { get; set; }

		public OrderedList<IMarkdownExtension> Extensions { get; }

		internal BlockParserList BlockParsers { get; }

		internal InlineParserList InlineParsers { get; }

		internal TextWriter? DebugLog { get; }

		public bool TrackTrivia { get; internal set; }

		internal MarkdownPipeline(OrderedList<IMarkdownExtension> extensions, BlockParserList blockParsers, InlineParserList inlineParsers, TextWriter? debugLog, ProcessDocumentDelegate? documentProcessed)
		{
			if (blockParsers == null)
			{
				ThrowHelper.ArgumentNullException("blockParsers");
			}
			if (inlineParsers == null)
			{
				ThrowHelper.ArgumentNullException("inlineParsers");
			}
			Extensions = extensions;
			BlockParsers = blockParsers;
			InlineParsers = inlineParsers;
			DebugLog = debugLog;
			DocumentProcessed = documentProcessed;
			SelfPipeline = Extensions.Find<SelfPipelineExtension>();
		}

		public void Setup(IMarkdownRenderer renderer)
		{
			if (renderer == null)
			{
				ThrowHelper.ArgumentNullException("renderer");
			}
			foreach (IMarkdownExtension extension in Extensions)
			{
				extension.Setup(this, renderer);
			}
		}

		internal RentedHtmlRenderer RentHtmlRenderer(TextWriter? writer = null)
		{
			HtmlRendererCache? obj = ((writer == null) ? (_rendererCache ?? (_rendererCache = new HtmlRendererCache(this))) : (_rendererCacheForCustomWriter ?? (_rendererCacheForCustomWriter = new HtmlRendererCache(this, customWriter: true))));
			HtmlRenderer htmlRenderer = obj.Get();
			if (writer != null)
			{
				htmlRenderer.Writer = writer;
			}
			return new RentedHtmlRenderer(obj, htmlRenderer);
		}
	}
	public class MarkdownPipelineBuilder
	{
		private MarkdownPipeline? pipeline;

		public OrderedList<BlockParser> BlockParsers { get; private set; }

		public OrderedList<InlineParser> InlineParsers { get; private set; }

		public OrderedList<IMarkdownExtension> Extensions { get; }

		public bool PreciseSourceLocation { get; set; }

		public TextWriter? DebugLog { get; set; }

		public bool TrackTrivia { get; internal set; }

		internal ProcessDocumentDelegate? GetDocumentProcessed => this.DocumentProcessed;

		public event ProcessDocumentDelegate? DocumentProcessed;

		public MarkdownPipelineBuilder()
		{
			BlockParsers = new OrderedList<BlockParser>
			{
				new ThematicBreakParser(),
				new HeadingBlockParser(),
				new QuoteBlockParser(),
				new ListBlockParser(),
				new HtmlBlockParser(),
				new FencedCodeBlockParser(),
				new IndentedCodeBlockParser(),
				new ParagraphBlockParser()
			};
			InlineParsers = new OrderedList<InlineParser>
			{
				new HtmlEntityParser(),
				new LinkInlineParser(),
				new EscapeInlineParser(),
				new EmphasisInlineParser(),
				new CodeInlineParser(),
				new AutolinkInlineParser(),
				new LineBreakInlineParser()
			};
			Extensions = new OrderedList<IMarkdownExtension>();
		}

		public MarkdownPipeline Build()
		{
			if (pipeline != null)
			{
				return pipeline;
			}
			foreach (IMarkdownExtension extension in Extensions)
			{
				if (extension == null)
				{
					ThrowHelper.InvalidOperationException("An extension cannot be null");
				}
				extension.Setup(this);
			}
			pipeline = new MarkdownPipeline(new OrderedList<IMarkdownExtension>(Extensions), new BlockParserList(BlockParsers), new InlineParserList(InlineParsers), DebugLog, GetDocumentProcessed)
			{
				PreciseSourceLocation = PreciseSourceLocation,
				TrackTrivia = TrackTrivia
			};
			return pipeline;
		}
	}
}
namespace Markdig.Syntax
{
	public sealed class BlankLineBlock : Block
	{
		public BlankLineBlock()
			: base(null)
		{
			base.IsOpen = false;
		}
	}
	public abstract class Block : MarkdownObject, IBlock, IMarkdownObject
	{
		private sealed class BlockTriviaProperties
		{
			public object? DerivedTriviaSlot;

			public StringSlice TriviaBefore;

			public StringSlice TriviaAfter;

			public List<StringSlice>? LinesBefore;

			public List<StringSlice>? LinesAfter;
		}

		private BlockTriviaProperties? _trivia => GetTrivia<BlockTriviaProperties>();

		private BlockTriviaProperties Trivia => GetOrSetTrivia<BlockTriviaProperties>();

		public ContainerBlock? Parent { get; internal set; }

		public BlockParser? Parser { get; }

		internal bool IsLeafBlock { get; private protected set; }

		internal bool IsParagraphBlock { get; private protected set; }

		public bool IsOpen { get; set; }

		public bool IsBreakable { get; set; }

		public NewLine NewLine { get; set; }

		public bool RemoveAfterProcessInlines { get; set; }

		public StringSlice TriviaBefore
		{
			get
			{
				return _trivia?.TriviaBefore ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaBefore = value;
			}
		}

		public StringSlice TriviaAfter
		{
			get
			{
				return _trivia?.TriviaAfter ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaAfter = value;
			}
		}

		public List<StringSlice>? LinesBefore
		{
			get
			{
				return _trivia?.LinesBefore;
			}
			set
			{
				Trivia.LinesBefore = value;
			}
		}

		public List<StringSlice>? LinesAfter
		{
			get
			{
				return _trivia?.LinesAfter;
			}
			set
			{
				Trivia.LinesAfter = value;
			}
		}

		public event ProcessInlineDelegate? ProcessInlinesBegin;

		public event ProcessInlineDelegate? ProcessInlinesEnd;

		protected Block(BlockParser? parser)
		{
			Parser = parser;
			IsOpen = true;
			IsBreakable = true;
			SetTypeKind(isInline: false, isContainer: false);
		}

		internal void OnProcessInlinesBegin(InlineProcessor state)
		{
			this.ProcessInlinesBegin?.Invoke(state, null);
		}

		internal void OnProcessInlinesEnd(InlineProcessor state)
		{
			this.ProcessInlinesEnd?.Invoke(state, null);
		}

		public void UpdateSpanEnd(int spanEnd)
		{
			int num = 0;
			Block block = this;
			while (block != null)
			{
				if (spanEnd > block.Span.End)
				{
					block.Span.End = spanEnd;
				}
				block = block.Parent;
				num++;
			}
			ThrowHelper.CheckDepthLimit(num, useLargeLimit: true);
		}

		internal static Block FindRootMostContainerParent(Block block)
		{
			while (true)
			{
				Block parent = block.Parent;
				if (parent == null || !parent.IsContainerBlock || parent is MarkdownDocument)
				{
					break;
				}
				block = parent;
			}
			return block;
		}

		private protected T? TryGetDerivedTrivia<T>() where T : class
		{
			return _trivia?.DerivedTriviaSlot as T;
		}

		private protected T GetOrSetDerivedTrivia<T>() where T : new()
		{
			BlockTriviaProperties trivia = Trivia;
			return (T)(trivia.DerivedTriviaSlot ?? (trivia.DerivedTriviaSlot = new T()));
		}
	}
	public static class BlockExtensions
	{
		public static Block? FindBlockAtPosition(this Block rootBlock, int position)
		{
			bool flag = rootBlock.CompareToPosition(position) == 0;
			if (!(rootBlock is ContainerBlock containerBlock) || containerBlock.Count == 0 || !flag)
			{
				if (!flag)
				{
					return null;
				}
				return rootBlock;
			}
			int num = 0;
			int num2 = containerBlock.Count - 1;
			Block block = null;
			while (num <= num2)
			{
				int num3 = (num2 - num) / 2 + num;
				block = containerBlock[num3];
				int num4 = block.CompareToPosition(position);
				if (num4 == 0)
				{
					break;
				}
				block = null;
				if (num4 < 0)
				{
					num = num3 + 1;
				}
				else
				{
					num2 = num3 - 1;
				}
			}
			if (block == null)
			{
				return rootBlock;
			}
			return block.FindBlockAtPosition(position);
		}

		public static int FindClosestLine(this MarkdownDocument root, int line)
		{
			return root.FindClosestBlock(line)?.Line ?? 0;
		}

		public static Block? FindClosestBlock(this Block rootBlock, int line)
		{
			if (!(rootBlock is ContainerBlock containerBlock) || containerBlock.Count == 0)
			{
				if (rootBlock.Line != line)
				{
					return null;
				}
				return rootBlock;
			}
			int num = 0;
			int num2 = containerBlock.Count - 1;
			while (num <= num2)
			{
				int num3 = (num2 - num) / 2 + num;
				Block block = containerBlock[num3];
				int num4 = block.Line.CompareTo(line);
				if (num4 == 0)
				{
					return block;
				}
				if (num4 < 0)
				{
					num = num3 + 1;
				}
				else
				{
					num2 = num3 - 1;
				}
			}
			if (num > 0 && num < containerBlock.Count)
			{
				Block block2 = containerBlock[num - 1].FindClosestBlock(line) ?? containerBlock[num - 1];
				Block block3 = containerBlock[num].FindClosestBlock(line) ?? containerBlock[num];
				if (block2.Line == line)
				{
					return block2;
				}
				if (block3.Line == line)
				{
					return block3;
				}
				int line2 = block2.Line;
				int line3 = block3.Line;
				if (!((double)(line - line2) * 1.0 / (double)(line3 - line2) < 0.5))
				{
					return block3;
				}
				return block2;
			}
			if (num == 0)
			{
				return containerBlock[num].FindClosestBlock(line) ?? containerBlock[num];
			}
			if (num == containerBlock.Count)
			{
				return containerBlock[num - 1].FindClosestBlock(line) ?? containerBlock[num - 1];
			}
			return null;
		}

		public static bool ContainsPosition(this Block block, int position)
		{
			return block.CompareToPosition(position) == 0;
		}

		public static int CompareToPosition(this Block block, int position)
		{
			if (position >= block.Span.Start)
			{
				if (position <= block.Span.End + 1)
				{
					return 0;
				}
				return -1;
			}
			return 1;
		}
	}
	public static class CharIteratorHelper
	{
		public static bool TrimStartAndCountNewLines<T>(ref T iterator, out int countNewLines) where T : ICharIterator
		{
			NewLine lastLine;
			return TrimStartAndCountNewLines(ref iterator, out countNewLines, out lastLine);
		}

		public static bool TrimStartAndCountNewLines<T>(ref T iterator, out int countNewLines, out NewLine lastLine) where T : ICharIterator
		{
			countNewLines = 0;
			char c = iterator.CurrentChar;
			bool result = false;
			lastLine = NewLine.None;
			while (c != 0 && c.IsWhitespace())
			{
				if (c == '\n' || c == '\r')
				{
					if (c == '\r' && iterator.PeekChar() == '\n')
					{
						lastLine = NewLine.CarriageReturnLineFeed;
						iterator.SkipChar();
					}
					else
					{
						switch (c)
						{
						case '\n':
							lastLine = NewLine.LineFeed;
							break;
						case '\r':
							lastLine = NewLine.CarriageReturn;
							break;
						}
					}
					countNewLines++;
				}
				else
				{
					lastLine = NewLine.None;
				}
				result = true;
				c = iterator.NextChar();
			}
			return result;
		}
	}
	public class CodeBlock : LeafBlock
	{
		public class CodeBlockLine
		{
			public StringSlice TriviaBefore { get; set; }
		}

		private List<CodeBlockLine>? _codeBlockLines;

		public List<CodeBlockLine> CodeBlockLines => _codeBlockLines ?? (_codeBlockLines = new List<CodeBlockLine>());

		public CodeBlock(BlockParser parser)
			: base(parser)
		{
		}
	}
	[DebuggerDisplay("{GetType().Name} Count = {Count}")]
	public abstract class ContainerBlock : Block, IList<Block>, ICollection<Block>, IEnumerable<Block>, IEnumerable, IReadOnlyList<Block>, IReadOnlyCollection<Block>
	{
		public struct Enumerator : IEnumerator<Block>, IEnumerator, IDisposable
		{
			private readonly ContainerBlock block;

			private int index;

			private Block? current;

			public Block Current => current;

			object IEnumerator.Current => Current;

			internal Enumerator(ContainerBlock block)
			{
				this.block = block;
				index = 0;
				current = null;
			}

			public void Dispose()
			{
			}

			public bool MoveNext()
			{
				if (index < block.Count)
				{
					current = block[index];
					index++;
					return true;
				}
				return MoveNextRare();
			}

			private bool MoveNextRare()
			{
				index = block.Count + 1;
				current = null;
				return false;
			}

			void IEnumerator.Reset()
			{
				index = 0;
				current = null;
			}
		}

		private sealed class BlockComparisonWrapper : IComparer<BlockWrapper>
		{
			private readonly Comparison<Block> _comparison;

			public BlockComparisonWrapper(Comparison<Block> comparison)
			{
				_comparison = comparison;
			}

			public int Compare(BlockWrapper x, BlockWrapper y)
			{
				return _comparison(x.Block, y.Block);
			}
		}

		private sealed class BlockComparerWrapper : IComparer<BlockWrapper>
		{
			private readonly IComparer<Block> _comparer;

			public BlockComparerWrapper(IComparer<Block> comparer)
			{
				_comparer = comparer;
			}

			public int Compare(BlockWrapper x, BlockWrapper y)
			{
				return _comparer.Compare(x.Block, y.Block);
			}
		}

		private BlockWrapper[] _children;

		public Block? LastChild
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				BlockWrapper[] children = _children;
				int num = Count - 1;
				if ((uint)num < (uint)children.Length)
				{
					return children[num].Block;
				}
				return null;
			}
		}

		public int Count { get; private set; }

		public bool IsReadOnly => false;

		public Block this[int index]
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				BlockWrapper[] children = _children;
				if ((uint)index >= (uint)children.Length || index >= Count)
				{
					ThrowHelper.ThrowIndexOutOfRangeException();
					return null;
				}
				return children[index].Block;
			}
			set
			{
				if ((uint)index >= (uint)Count)
				{
					ThrowHelper.ThrowIndexOutOfRangeException();
				}
				if (value == null)
				{
					ThrowHelper.ArgumentNullException_item();
				}
				if (value.Parent != null)
				{
					ThrowHelper.ArgumentException("Cannot add this block as it as already attached to another container (block.Parent != null)");
				}
				Block block = _children[index].Block;
				if (block != null)
				{
					block.Parent = null;
				}
				value.Parent = this;
				_children[index] = new BlockWrapper(value);
			}
		}

		protected ContainerBlock(BlockParser? parser)
			: base(parser)
		{
			_children = Array.Empty<BlockWrapper>();
			SetTypeKind(isInline: false, isContainer: true);
		}

		public Enumerator GetEnumerator()
		{
			return new Enumerator(this);
		}

		IEnumerator<Block> IEnumerable<Block>.GetEnumerator()
		{
			return GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

		public void Add(Block item)
		{
			if (item == null)
			{
				ThrowHelper.ArgumentNullException_item();
			}
			if (item.Parent != null)
			{
				ThrowHelper.ArgumentException("Cannot add this block as it as already attached to another container (block.Parent != null)");
			}
			if (Count == _children.Length)
			{
				Grow();
			}
			_children[Count] = new BlockWrapper(item);
			Count++;
			item.Parent = this;
			UpdateSpanEnd(item.Span.End);
		}

		private void Grow()
		{
			if (_children.Length == 0)
			{
				_children = new BlockWrapper[4];
				return;
			}
			BlockWrapper[] array = new BlockWrapper[_children.Length * 2];
			Array.Copy(_children, 0, array, 0, Count);
			_children = array;
		}

		public void Clear()
		{
			BlockWrapper[] children = _children;
			for (int i = 0; i < Count && i < children.Length; i++)
			{
				children[i].Block.Parent = null;
				children[i] = default(BlockWrapper);
			}
			Count = 0;
		}

		public bool Contains(Block item)
		{
			return IndexOf(item) >= 0;
		}

		public void CopyTo(Block[] array, int arrayIndex)
		{
			BlockWrapper[] children = _children;
			for (int i = 0; i < Count && i < children.Length; i++)
			{
				array[arrayIndex + i] = children[i].Block;
			}
		}

		public bool Remove(Block item)
		{
			int num = IndexOf(item);
			if (num >= 0)
			{
				RemoveAt(num);
				return true;
			}
			return false;
		}

		public int IndexOf(Block item)
		{
			if (item == null)
			{
				ThrowHelper.ArgumentNullException_item();
			}
			BlockWrapper[] children = _children;
			for (int i = 0; i < Count && i < children.Length; i++)
			{
				if (children[i].Block == item)
				{
					return i;
				}
			}
			return -1;
		}

		public void Insert(int index, Block item)
		{
			if (item == null)
			{
				ThrowHelper.ArgumentNullException_item();
			}
			if (item.Parent != null)
			{
				ThrowHelper.ArgumentException("Cannot add this block as it as already attached to another container (block.Parent != null)");
			}
			if ((uint)index > (uint)Count)
			{
				ThrowHelper.ArgumentOutOfRangeException_index();
			}
			if (Count == _children.Length)
			{
				Grow();
			}
			if (index < Count)
			{
				Array.Copy(_children, index, _children, index + 1, Count - index);
			}
			_children[index] = new BlockWrapper(item);
			Count++;
			item.Parent = this;
		}

		public void RemoveAt(int index)
		{
			if ((uint)index >= (uint)Count)
			{
				ThrowHelper.ArgumentOutOfRangeException_index();
			}
			Count--;
			_children[index].Block.Parent = null;
			if (index < Count)
			{
				Array.Copy(_children, index + 1, _children, index, Count - index);
			}
			_children[Count] = default(BlockWrapper);
		}

		public void Sort(IComparer<Block> comparer)
		{
			if (comparer == null)
			{
				ThrowHelper.ArgumentNullException("comparer");
			}
			Array.Sort(_children, 0, Count, new BlockComparerWrapper(comparer));
		}

		public void Sort(Comparison<Block> comparison)
		{
			if (comparison == null)
			{
				ThrowHelper.ArgumentNullException("comparison");
			}
			Array.Sort(_children, 0, Count, new BlockComparisonWrapper(comparison));
		}
	}
	public class FencedCodeBlock : CodeBlock, IFencedBlock, IBlock, IMarkdownObject
	{
		private sealed class TriviaProperties
		{
			public StringSlice TriviaAfterFencedChar;

			public StringSlice UnescapedInfo;

			public StringSlice TriviaAfterInfo;

			public StringSlice UnescapedArguments;

			public StringSlice TriviaAfterArguments;

			public NewLine InfoNewLine;

			public StringSlice TriviaBeforeClosingFence;
		}

		private TriviaProperties? _trivia => TryGetDerivedTrivia<TriviaProperties>();

		private TriviaProperties Trivia => GetOrSetDerivedTrivia<TriviaProperties>();

		public int IndentCount { get; set; }

		public char FencedChar { get; set; }

		public int OpeningFencedCharCount { get; set; }

		public StringSlice TriviaAfterFencedChar
		{
			get
			{
				return _trivia?.TriviaAfterFencedChar ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaAfterFencedChar = value;
			}
		}

		public string? Info { get; set; }

		public StringSlice UnescapedInfo
		{
			get
			{
				return _trivia?.UnescapedInfo ?? StringSlice.Empty;
			}
			set
			{
				Trivia.UnescapedInfo = value;
			}
		}

		public StringSlice TriviaAfterInfo
		{
			get
			{
				return _trivia?.TriviaAfterInfo ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaAfterInfo = value;
			}
		}

		public string? Arguments { get; set; }

		public StringSlice UnescapedArguments
		{
			get
			{
				return _trivia?.UnescapedArguments ?? StringSlice.Empty;
			}
			set
			{
				Trivia.UnescapedArguments = value;
			}
		}

		public StringSlice TriviaAfterArguments
		{
			get
			{
				return _trivia?.TriviaAfterArguments ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaAfterArguments = value;
			}
		}

		public NewLine InfoNewLine
		{
			get
			{
				return _trivia?.InfoNewLine ?? NewLine.None;
			}
			set
			{
				Trivia.InfoNewLine = value;
			}
		}

		public StringSlice TriviaBeforeClosingFence
		{
			get
			{
				return _trivia?.TriviaBeforeClosingFence ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaBeforeClosingFence = value;
			}
		}

		public int ClosingFencedCharCount { get; set; }

		public FencedCodeBlock(BlockParser parser)
			: base(parser)
		{
			base.IsBreakable = false;
		}
	}
	[DebuggerDisplay("{GetType().Name} Line: {Line}, {Lines} Level: {Level}")]
	public class HeadingBlock : LeafBlock
	{
		private sealed class TriviaProperties
		{
			public NewLine SetextNewline;

			public StringSlice TriviaAfterAtxHeaderChar;
		}

		private TriviaProperties? _trivia => TryGetDerivedTrivia<TriviaProperties>();

		private TriviaProperties Trivia => GetOrSetDerivedTrivia<TriviaProperties>();

		public char HeaderChar { get; set; }

		public int Level { get; set; }

		public bool IsSetext { get; set; }

		public int HeaderCharCount { get; set; }

		public NewLine SetextNewline
		{
			get
			{
				return _trivia?.SetextNewline ?? NewLine.None;
			}
			set
			{
				Trivia.SetextNewline = value;
			}
		}

		public StringSlice TriviaAfterAtxHeaderChar
		{
			get
			{
				return _trivia?.TriviaAfterAtxHeaderChar ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaAfterAtxHeaderChar = value;
			}
		}

		public HeadingBlock(BlockParser parser)
			: base(parser)
		{
			base.ProcessInlines = true;
		}
	}
	public class HtmlBlock : LeafBlock
	{
		public HtmlBlockType Type { get; set; }

		public HtmlBlock(BlockParser? parser)
			: base(parser)
		{
		}
	}
	public enum HtmlBlockType
	{
		DocumentType,
		CData,
		Comment,
		ProcessingInstruction,
		ScriptPreOrStyle,
		InterruptingBlock,
		NonInterruptingBlock
	}
	public interface IBlock : IMarkdownObject
	{
		int Column { get; set; }

		int Line { get; set; }

		ContainerBlock? Parent { get; }

		BlockParser? Parser { get; }

		bool IsOpen { get; set; }

		bool IsBreakable { get; set; }

		bool RemoveAfterProcessInlines { get; set; }

		StringSlice TriviaBefore { get; set; }

		StringSlice TriviaAfter { get; set; }

		event ProcessInlineDelegate? ProcessInlinesBegin;

		event ProcessInlineDelegate? ProcessInlinesEnd;
	}
	public interface IFencedBlock : IBlock, IMarkdownObject
	{
		char FencedChar { get; set; }

		int OpeningFencedCharCount { get; set; }

		StringSlice TriviaAfterFencedChar { get; set; }

		string? Info { get; set; }

		StringSlice UnescapedInfo { get; set; }

		StringSlice TriviaAfterInfo { get; set; }

		string? Arguments { get; set; }

		StringSlice UnescapedArguments { get; set; }

		StringSlice TriviaAfterArguments { get; set; }

		NewLine InfoNewLine { get; set; }

		StringSlice TriviaBeforeClosingFence { get; set; }

		int ClosingFencedCharCount { get; set; }

		NewLine NewLine { get; set; }
	}
	public interface IMarkdownObject
	{
		void SetData(object key, object value);

		bool ContainsData(object key);

		object? GetData(object key);

		bool RemoveData(object key);
	}
	[DebuggerDisplay("{GetType().Name} Line: {Line}, {Lines}")]
	public abstract class LeafBlock : Block
	{
		private ContainerInline? inline;

		public StringLineGroup Lines;

		public ContainerInline? Inline
		{
			get
			{
				return inline;
			}
			set
			{
				if (value != null)
				{
					if (value.Parent != null)
					{
						ThrowHelper.ArgumentException("Cannot add this inline as it as already attached to another container (inline.Parent != null)");
					}
					if (value.ParentBlock != null)
					{
						ThrowHelper.ArgumentException("Cannot add this inline as it as already attached to another container (inline.ParentBlock != null)");
					}
					value.ParentBlock = this;
				}
				if (inline != null)
				{
					inline.ParentBlock = null;
				}
				inline = value;
			}
		}

		public bool ProcessInlines { get; set; }

		protected LeafBlock(BlockParser? parser)
			: base(parser)
		{
			base.IsLeafBlock = true;
		}

		public void AppendLine(ref StringSlice slice, int column, int line, int sourceLinePosition, bool trackTrivia)
		{
			if (Lines.Lines == null)
			{
				Lines = new StringLineGroup(4, ProcessInlines);
			}
			StringLine line2 = new StringLine(ref slice, line, column, sourceLinePosition, slice.NewLine);
			if (slice.CurrentChar == '\t' && CharHelper.IsAcrossTab(column) && !trackTrivia)
			{
				Span<char> initialBuffer = stackalloc char[256];
				ValueStringBuilder valueStringBuilder = new ValueStringBuilder(initialBuffer);
				valueStringBuilder.Append(' ', CharHelper.AddTab(column) - column);
				valueStringBuilder.Append(slice.AsSpan().Slice(1));
				line2.Slice = new StringSlice(valueStringBuilder.ToString());
			}
			Lines.Add(ref line2);
			base.NewLine = slice.NewLine;
		}
	}
	public class LinkReferenceDefinition : LeafBlock
	{
		public delegate Inline CreateLinkInlineDelegate(InlineProcessor inlineState, LinkReferenceDefinition linkRef, Inline? child = null);

		private sealed class TriviaProperties
		{
			public StringSlice LabelWithTrivia;

			public StringSlice TriviaBeforeUrl;

			public StringSlice UnescapedUrl;

			public bool UrlHasPointyBrackets;

			public StringSlice TriviaBeforeTitle;

			public StringSlice UnescapedTitle;

			public char TitleEnclosingCharacter;
		}

		public SourceSpan LabelSpan;

		public SourceSpan UrlSpan;

		public SourceSpan TitleSpan;

		private TriviaProperties? _trivia => TryGetDerivedTrivia<TriviaProperties>();

		private TriviaProperties Trivia => GetOrSetDerivedTrivia<TriviaProperties>();

		public string? Label { get; set; }

		public StringSlice LabelWithTrivia
		{
			get
			{
				return _trivia?.LabelWithTrivia ?? StringSlice.Empty;
			}
			set
			{
				Trivia.LabelWithTrivia = value;
			}
		}

		public StringSlice TriviaBeforeUrl
		{
			get
			{
				return _trivia?.TriviaBeforeUrl ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaBeforeUrl = value;
			}
		}

		public string? Url { get; set; }

		public StringSlice UnescapedUrl
		{
			get
			{
				return _trivia?.UnescapedUrl ?? StringSlice.Empty;
			}
			set
			{
				Trivia.UnescapedUrl = value;
			}
		}

		public bool UrlHasPointyBrackets
		{
			get
			{
				return _trivia?.UrlHasPointyBrackets ?? false;
			}
			set
			{
				Trivia.UrlHasPointyBrackets = value;
			}
		}

		public StringSlice TriviaBeforeTitle
		{
			get
			{
				return _trivia?.TriviaBeforeTitle ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaBeforeTitle = value;
			}
		}

		public string? Title { get; set; }

		public StringSlice UnescapedTitle
		{
			get
			{
				return _trivia?.UnescapedTitle ?? StringSlice.Empty;
			}
			set
			{
				Trivia.UnescapedTitle = value;
			}
		}

		public char TitleEnclosingCharacter
		{
			get
			{
				return _trivia?.TitleEnclosingCharacter ?? '\0';
			}
			set
			{
				Trivia.TitleEnclosingCharacter = value;
			}
		}

		public CreateLinkInlineDelegate? CreateLinkInline { get; set; }

		public LinkReferenceDefinition()
			: base(null)
		{
			base.IsOpen = false;
		}

		public LinkReferenceDefinition(string? label, string? url, string? title)
			: this()
		{
			Label = label;
			Url = url;
			Title = title;
		}

		public static bool TryParse<T>(ref T text, [NotNullWhen(true)] out LinkReferenceDefinition? block) where T : ICharIterator
		{
			block = null;
			int start = text.Start;
			if (!LinkHelper.TryParseLinkReferenceDefinition(ref text, out string label, out string url, out string title, out SourceSpan labelSpan, out SourceSpan urlSpan, out SourceSpan titleSpan))
			{
				return false;
			}
			block = new LinkReferenceDefinition(label, url, title)
			{
				LabelSpan = labelSpan,
				UrlSpan = urlSpan,
				TitleSpan = titleSpan,
				Span = new SourceSpan(start, (titleSpan.End > 0) ? titleSpan.End : urlSpan.End)
			};
			return true;
		}

		public static bool TryParseTrivia<T>(ref T text, [NotNullWhen(true)] out LinkReferenceDefinition? block, out SourceSpan triviaBeforeLabel, out SourceSpan labelWithTrivia, out SourceSpan triviaBeforeUrl, out SourceSpan unescapedUrl, out SourceSpan triviaBeforeTitle, out SourceSpan unescapedTitle, out SourceSpan triviaAfterTitle) where T : ICharIterator
		{
			block = null;
			int start = text.Start;
			if (!LinkHelper.TryParseLinkReferenceDefinitionTrivia(ref text, out triviaBeforeLabel, out string label, out labelWithTrivia, out triviaBeforeUrl, out string url, out unescapedUrl, out bool urlHasPointyBrackets, out triviaBeforeTitle, out string title, out unescapedTitle, out char titleEnclosingCharacter, out NewLine newLine, out triviaAfterTitle, out SourceSpan labelSpan, out SourceSpan urlSpan, out SourceSpan titleSpan))
			{
				return false;
			}
			block = new LinkReferenceDefinition(label, url, title)
			{
				UrlHasPointyBrackets = urlHasPointyBrackets,
				TitleEnclosingCharacter = titleEnclosingCharacter,
				LabelSpan = labelSpan,
				UrlSpan = urlSpan,
				TitleSpan = titleSpan,
				Span = new SourceSpan(start, (titleSpan.End > 0) ? titleSpan.End : urlSpan.End),
				NewLine = newLine
			};
			return true;
		}
	}
	public static class LinkReferenceDefinitionExtensions
	{
		private static readonly object DocumentKey = typeof(LinkReferenceDefinitionGroup);

		public static bool ContainsLinkReferenceDefinition(this MarkdownDocument document, string label)
		{
			if (label == null)
			{
				ThrowHelper.ArgumentNullException_label();
			}
			if (!(document.GetData(DocumentKey) is LinkReferenceDefinitionGroup linkReferenceDefinitionGroup))
			{
				return false;
			}
			return linkReferenceDefinitionGroup.Links.ContainsKey(label);
		}

		public static void SetLinkReferenceDefinition(this MarkdownDocument document, string label, LinkReferenceDefinition linkReferenceDefinition, bool addGroup)
		{
			if (label == null)
			{
				ThrowHelper.ArgumentNullException_label();
			}
			document.GetLinkReferenceDefinitions(addGroup).Set(label, linkReferenceDefinition);
		}

		public static bool TryGetLinkReferenceDefinition(this MarkdownDocument document, string label, [NotNullWhen(true)] out LinkReferenceDefinition? linkReferenceDefinition)
		{
			if (label == null)
			{
				ThrowHelper.ArgumentNullException_label();
			}
			linkReferenceDefinition = null;
			if (!(document.GetData(DocumentKey) is LinkReferenceDefinitionGroup linkReferenceDefinitionGroup))
			{
				return false;
			}
			return linkReferenceDefinitionGroup.TryGet(label, out linkReferenceDefinition);
		}

		public static LinkReferenceDefinitionGroup GetLinkReferenceDefinitions(this MarkdownDocument document, bool addGroup)
		{
			LinkReferenceDefinitionGroup linkReferenceDefinitionGroup = document.GetData(DocumentKey) as LinkReferenceDefinitionGroup;
			if (linkReferenceDefinitionGroup == null)
			{
				linkReferenceDefinitionGroup = new LinkReferenceDefinitionGroup();
				document.SetData(DocumentKey, linkReferenceDefinitionGroup);
				if (addGroup)
				{
					document.Add(linkReferenceDefinitionGroup);
				}
			}
			return linkReferenceDefinitionGroup;
		}
	}
	public class LinkReferenceDefinitionGroup : ContainerBlock
	{
		private static readonly StringComparer _unicodeIgnoreCaseComparer = CultureInfo.InvariantCulture.CompareInfo.GetStringComparer(CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace);

		public Dictionary<string, LinkReferenceDefinition> Links { get; }

		public LinkReferenceDefinitionGroup()
			: base(null)
		{
			Links = new Dictionary<string, LinkReferenceDefinition>(_unicodeIgnoreCaseComparer);
		}

		public void Set(string label, LinkReferenceDefinition link)
		{
			if (link == null)
			{
				ThrowHelper.ArgumentNullException("link");
			}
			if (!Contains(link))
			{
				Add(link);
				if (!Links.ContainsKey(label))
				{
					Links[label] = link;
				}
			}
		}

		public bool TryGet(string label, [NotNullWhen(true)] out LinkReferenceDefinition? link)
		{
			return Links.TryGetValue(label, out link);
		}
	}
	public class ListBlock : ContainerBlock
	{
		public bool IsOrdered { get; set; }

		public char BulletType { get; set; }

		public string? OrderedStart { get; set; }

		public string? DefaultOrderedStart { get; set; }

		public char OrderedDelimiter { get; set; }

		public bool IsLoose { get; set; }

		internal int CountAllBlankLines { get; set; }

		internal int CountBlankLinesReset { get; set; }

		public ListBlock(BlockParser parser)
			: base(parser)
		{
		}
	}
	public class ListItemBlock : ContainerBlock
	{
		private sealed class TriviaProperties
		{
			public StringSlice SourceBullet;
		}

		private TriviaProperties? _trivia => TryGetDerivedTrivia<TriviaProperties>();

		private TriviaProperties Trivia => GetOrSetDerivedTrivia<TriviaProperties>();

		public int ColumnWidth { get; set; }

		public int Order { get; set; }

		public StringSlice SourceBullet
		{
			get
			{
				return _trivia?.SourceBullet ?? StringSlice.Empty;
			}
			set
			{
				Trivia.SourceBullet = value;
			}
		}

		public ListItemBlock(BlockParser parser)
			: base(parser)
		{
		}
	}
	public class MarkdownDocument : ContainerBlock
	{
		public int LineCount;

		public List<int>? LineStartIndexes { get; set; }

		public MarkdownDocument()
			: base(null)
		{
		}
	}
	public abstract class MarkdownObject : IMarkdownObject
	{
		private class DataEntriesAndTrivia
		{
			private struct DataEntry
			{
				public readonly object Key;

				public object Value;

				public DataEntry(object key, object value)
				{
					Key = key;
					Value = value;
				}
			}

			private DataEntry[]? _entries;

			private int _count;

			public object? Trivia;

			public void SetData(object key, object value)
			{
				if (key == null)
				{
					ThrowHelper.ArgumentNullException_key();
				}
				DataEntry[] entries = _entries;
				int count = _count;
				if (entries == null)
				{
					_entries = new DataEntry[2];
				}
				else
				{
					for (int i = 0; i < entries.Length && i < count; i++)
					{
						ref DataEntry reference = ref entries[i];
						if (reference.Key == key)
						{
							reference.Value = value;
							return;
						}
					}
					if (count == entries.Length)
					{
						Array.Resize(ref _entries, count + 2);
					}
				}
				_entries[count] = new DataEntry(key, value);
				_count++;
			}

			public object? GetData(object key)
			{
				if (key == null)
				{
					ThrowHelper.ArgumentNullException_key();
				}
				DataEntry[] entries = _entries;
				if (entries == null)
				{
					return null;
				}
				int count = _count;
				for (int i = 0; i < entries.Length && i < count; i++)
				{
					ref DataEntry reference = ref entries[i];
					if (reference.Key == key)
					{
						return reference.Value;
					}
				}
				return null;
			}

			public bool ContainsData(object key)
			{
				if (key == null)
				{
					ThrowHelper.ArgumentNullException_key();
				}
				DataEntry[] entries = _entries;
				if (entries == null)
				{
					return false;
				}
				int count = _count;
				for (int i = 0; i < entries.Length && i < count; i++)
				{
					if (entries[i].Key == key)
					{
						return true;
					}
				}
				return false;
			}

			public bool RemoveData(object key)
			{
				if (key == null)
				{
					ThrowHelper.ArgumentNullException_key();
				}
				DataEntry[] entries = _entries;
				if (entries == null)
				{
					return false;
				}
				int count = _count;
				for (int i = 0; i < entries.Length && i < count; i++)
				{
					if (entries[i].Key == key)
					{
						if (i < count - 1)
						{
							Array.Copy(entries, i + 1, entries, i, count - i - 1);
						}
						count--;
						entries[count] = default(DataEntry);
						_count = count;
						return true;
					}
				}
				return false;
			}
		}

		private const uint ValueBitMask = 1073741823u;

		private const uint FirstBitMask = 2147483648u;

		private const uint SecondBitMask = 1073741824u;

		private const uint IsInlineMask = 2147483648u;

		private const uint IsContainerMask = 1073741824u;

		private const uint TypeKindMask = 3221225472u;

		private uint _lineBits;

		private uint _columnBits;

		private DataEntriesAndTrivia? _attachedDatas;

		public SourceSpan Span;

		internal bool IsContainerInline => (_lineBits & 0xC0000000u) == 3221225472u;

		internal bool IsContainerBlock => (_lineBits & 0xC0000000u) == 1073741824;

		internal bool IsContainer => (_lineBits & 0x40000000) != 0;

		internal bool IsInline => (_lineBits & 0x80000000u) != 0;

		private protected bool IsClosedInternal
		{
			get
			{
				return (_columnBits & 0x80000000u) != 0;
			}
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			set
			{
				if (value)
				{
					_columnBits |= 2147483648u;
				}
				else
				{
					_columnBits &= 2147483647u;
				}
			}
		}

		private protected bool InternalSpareBit
		{
			get
			{
				return (_columnBits & 0x40000000) != 0;
			}
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			set
			{
				if (value)
				{
					_columnBits |= 1073741824u;
				}
				else
				{
					_columnBits &= 3221225471u;
				}
			}
		}

		public int Column
		{
			get
			{
				return (int)(_columnBits & 0x3FFFFFFF);
			}
			set
			{
				_columnBits = (_columnBits & 0xC0000000u) | ((uint)value & 0x3FFFFFFFu);
			}
		}

		public int Line
		{
			get
			{
				return (int)(_lineBits & 0x3FFFFFFF);
			}
			set
			{
				_lineBits = (_lineBits & 0xC0000000u) | ((uint)value & 0x3FFFFFFFu);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private protected void SetTypeKind(bool isInline, bool isContainer)
		{
			_lineBits |= (uint)((isInline ? int.MinValue : 0) | (isContainer ? 1073741824 : 0));
		}

		protected MarkdownObject()
		{
			Span = SourceSpan.Empty;
		}

		public string ToPositionText()
		{
			return $"${Line}, {Column}, {Span.Start}-{Span.End}";
		}

		public void SetData(object key, object value)
		{
			(_attachedDatas ?? (_attachedDatas = new DataEntriesAndTrivia())).SetData(key, value);
		}

		public bool ContainsData(object key)
		{
			return _attachedDatas?.ContainsData(key) ?? false;
		}

		public object? GetData(object key)
		{
			return _attachedDatas?.GetData(key);
		}

		public bool RemoveData(object key)
		{
			return _attachedDatas?.RemoveData(key) ?? false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private protected T? GetTrivia<T>() where T : class
		{
			object obj = _attachedDatas?.Trivia;
			if (obj != null)
			{
				return Unsafe.As<T>(obj);
			}
			return null;
		}

		private protected T GetOrSetTrivia<T>() where T : class, new()
		{
			DataEntriesAndTrivia? obj = _attachedDatas ?? (_attachedDatas = new DataEntriesAndTrivia());
			DataEntriesAndTrivia dataEntriesAndTrivia = obj;
			if (dataEntriesAndTrivia.Trivia == null)
			{
				dataEntriesAndTrivia.Trivia = new T();
			}
			return Unsafe.As<T>(obj.Trivia);
		}
	}
	public static class MarkdownObjectExtensions
	{
		public static IEnumerable<MarkdownObject> Descendants(this MarkdownObject markdownObject)
		{
			Stack<MarkdownObject> stack = new Stack<MarkdownObject>();
			Stack<bool> pushStack = new Stack<bool>();
			stack.Push(markdownObject);
			pushStack.Push(item: false);
			while (stack.Count > 0)
			{
				MarkdownObject block = stack.Pop();
				if (pushStack.Pop())
				{
					yield return block;
				}
				if (block is ContainerBlock containerBlock)
				{
					int count = containerBlock.Count;
					while (count-- > 0)
					{
						Block block2 = containerBlock[count];
						if (block2 is LeafBlock leafBlock && leafBlock.Inline != null)
						{
							stack.Push(leafBlock.Inline);
							pushStack.Push(item: false);
						}
						stack.Push(block2);
						pushStack.Push(item: true);
					}
				}
				else if (block is ContainerInline containerInline)
				{
					for (Inline inline = containerInline.LastChild; inline != null; inline = inline.PreviousSibling)
					{
						stack.Push(inline);
						pushStack.Push(item: true);
					}
				}
			}
		}

		public static IEnumerable<T> Descendants<T>(this MarkdownObject markdownObject) where T : MarkdownObject
		{
			if (typeof(T).IsSubclassOf(typeof(Block)))
			{
				if (markdownObject is ContainerBlock containerBlock && containerBlock.Count > 0)
				{
					return BlockDescendantsInternal<T>(containerBlock);
				}
			}
			else if (markdownObject is ContainerBlock containerBlock2)
			{
				if (containerBlock2.Count > 0)
				{
					return InlineDescendantsInternal<T>(containerBlock2);
				}
			}
			else if (markdownObject is ContainerInline containerInline && containerInline.FirstChild != null)
			{
				return containerInline.FindDescendantsInternal<T>();
			}
			return Array.Empty<T>();
		}

		public static IEnumerable<T> Descendants<T>(this ContainerInline inline) where T : Inline
		{
			return inline.FindDescendants<T>();
		}

		public static IEnumerable<T> Descendants<T>(this ContainerBlock block) where T : Block
		{
			if (block != null && block.Count > 0)
			{
				return BlockDescendantsInternal<T>(block);
			}
			return Array.Empty<T>();
		}

		private static IEnumerable<T> BlockDescendantsInternal<T>(ContainerBlock block) where T : MarkdownObject
		{
			Stack<Block> stack = new Stack<Block>();
			int count = block.Count;
			while (count-- > 0)
			{
				stack.Push(block[count]);
			}
			while (stack.Count > 0)
			{
				Block subBlock = stack.Pop();
				if (subBlock is T val)
				{
					yield return val;
				}
				if (subBlock is ContainerBlock containerBlock)
				{
					count = containerBlock.Count;
					while (count-- > 0)
					{
						stack.Push(containerBlock[count]);
					}
				}
			}
		}

		private static IEnumerable<T> InlineDescendantsInternal<T>(ContainerBlock block) where T : MarkdownObject
		{
			foreach (MarkdownObject item in block.Descendants())
			{
				if (item is T val)
				{
					yield return val;
				}
			}
		}
	}
	public sealed class EmptyBlock : LeafBlock
	{
		public EmptyBlock(BlockParser? parser)
			: base(parser)
		{
		}
	}
	public class ParagraphBlock : LeafBlock
	{
		public int LastLine => base.Line + Lines.Count - 1;

		public ParagraphBlock()
			: this(null)
		{
		}

		public ParagraphBlock(BlockParser? parser)
			: base(parser)
		{
			base.ProcessInlines = true;
			base.IsParagraphBlock = true;
		}
	}
	public class QuoteBlock : ContainerBlock
	{
		private List<QuoteBlockLine> Trivia => GetOrSetDerivedTrivia<List<QuoteBlockLine>>();

		public List<QuoteBlockLine> QuoteLines => Trivia;

		public char QuoteChar { get; set; }

		public QuoteBlock(BlockParser parser)
			: base(parser)
		{
		}
	}
	public class QuoteBlockLine
	{
		public StringSlice TriviaBefore { get; set; }

		public bool QuoteChar { get; set; }

		public bool HasSpaceAfterQuoteChar { get; set; }

		public StringSlice TriviaAfter { get; set; }

		public NewLine NewLine { get; set; }
	}
	public struct SourceSpan : IEquatable<SourceSpan>
	{
		public static readonly SourceSpan Empty = new SourceSpan(0, -1);

		public int Start { get; set; }

		public int End { get; set; }

		public int Length => End - Start + 1;

		public bool IsEmpty => Start > End;

		public SourceSpan(int start, int end)
		{
			Start = start;
			End = end;
		}

		public SourceSpan MoveForward(int count)
		{
			return new SourceSpan(Start + count, End + count);
		}

		public bool Equals(SourceSpan other)
		{
			if (Start == other.Start)
			{
				return End == other.End;
			}
			return false;
		}

		public override bool Equals(object? obj)
		{
			if (obj is SourceSpan other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return (Start * 397) ^ End;
		}

		public static bool operator ==(SourceSpan left, SourceSpan right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(SourceSpan left, SourceSpan right)
		{
			return !left.Equals(right);
		}

		public override string ToString()
		{
			return $"{Start}-{End}";
		}
	}
	public class ThematicBreakBlock : LeafBlock
	{
		public StringSlice Content;

		public char ThematicChar { get; set; }

		public int ThematicCharCount { get; set; }

		public ThematicBreakBlock(BlockParser parser)
			: base(parser)
		{
		}
	}
}
namespace Markdig.Syntax.Inlines
{
	[DebuggerDisplay("<{Url}>")]
	public sealed class AutolinkInline : LeafInline
	{
		public bool IsEmail { get; set; }

		public string Url { get; set; }

		public AutolinkInline(string url)
		{
			Url = url;
		}

		public override string ToString()
		{
			return Url;
		}
	}
	[DebuggerDisplay("`{Content}`")]
	public class CodeInline : LeafInline
	{
		private sealed class TriviaProperties
		{
			public StringSlice ContentWithTrivia;
		}

		private LazySubstring _content;

		private TriviaProperties? _trivia => GetTrivia<TriviaProperties>();

		private TriviaProperties Trivia => GetOrSetTrivia<TriviaProperties>();

		public char Delimiter { get; set; }

		public int DelimiterCount { get; set; }

		public string Content
		{
			get
			{
				return _content.ToString();
			}
			set
			{
				_content = new LazySubstring(value ?? string.Empty);
			}
		}

		public ReadOnlySpan<char> ContentSpan => _content.AsSpan();

		public StringSlice ContentWithTrivia
		{
			get
			{
				return _trivia?.ContentWithTrivia ?? StringSlice.Empty;
			}
			set
			{
				Trivia.ContentWithTrivia = value;
			}
		}

		public CodeInline(string content)
			: this(new LazySubstring(content))
		{
		}

		internal CodeInline(LazySubstring content)
		{
			_content = content;
		}
	}
	public class ContainerInline : Inline, IEnumerable<Inline>, IEnumerable
	{
		public struct Enumerator : IEnumerator<Inline>, IEnumerator, IDisposable
		{
			private readonly ContainerInline container;

			private Inline? currentChild;

			private Inline? nextChild;

			public Inline Current => currentChild;

			object IEnumerator.Current => Current;

			public Enumerator(ContainerInline container)
			{
				this = default(Enumerator);
				if (container == null)
				{
					ThrowHelper.ArgumentNullException("container");
				}
				this.container = container;
				currentChild = (nextChild = container.FirstChild);
			}

			public void Dispose()
			{
			}

			public bool MoveNext()
			{
				currentChild = nextChild;
				if (currentChild != null)
				{
					nextChild = currentChild.NextSibling;
					return true;
				}
				nextChild = null;
				return false;
			}

			public void Reset()
			{
				currentChild = (nextChild = container.FirstChild);
			}
		}

		public LeafBlock? ParentBlock { get; internal set; }

		public Inline? FirstChild { get; private set; }

		public Inline? LastChild { get; private set; }

		public ContainerInline()
		{
			SetTypeKind(isInline: true, isContainer: true);
		}

		public void Clear()
		{
			for (Inline inline = LastChild; inline != null; inline = inline.PreviousSibling)
			{
				inline.Parent = null;
			}
			FirstChild = null;
			LastChild = null;
		}

		public virtual ContainerInline AppendChild(Inline child)
		{
			if (child == null)
			{
				ThrowHelper.ArgumentNullException("child");
			}
			if (child.Parent != null)
			{
				ThrowHelper.ArgumentException("Inline has already a parent", "child");
			}
			if (FirstChild == null)
			{
				FirstChild = child;
				LastChild = child;
				child.Parent = this;
			}
			else
			{
				LastChild.InsertAfter(child);
			}
			return this;
		}

		public bool ContainsChild(Inline childToFind)
		{
			Inline inline = FirstChild;
			while (inline != null)
			{
				Inline nextSibling = inline.NextSibling;
				if (inline == childToFind)
				{
					return true;
				}
				inline = nextSibling;
			}
			return false;
		}

		public IEnumerable<T> FindDescendants<T>() where T : Inline
		{
			if (FirstChild == null)
			{
				return Array.Empty<T>();
			}
			return FindDescendantsInternal<T>();
		}

		internal IEnumerable<T> FindDescendantsInternal<T>() where T : MarkdownObject
		{
			Stack<Inline> stack = new Stack<Inline>();
			for (Inline child3 = LastChild; child3 != null; child3 = child3.PreviousSibling)
			{
				stack.Push(child3);
			}
			while (stack.Count > 0)
			{
				Inline child3 = stack.Pop();
				if (child3 is T val)
				{
					yield return val;
				}
				if (child3 is ContainerInline containerInline)
				{
					for (child3 = containerInline.LastChild; child3 != null; child3 = child3.PreviousSibling)
					{
						stack.Push(child3);
					}
				}
			}
		}

		public void MoveChildrenAfter(Inline parent)
		{
			if (parent == null)
			{
				ThrowHelper.ArgumentNullException("parent");
			}
			Inline inline = FirstChild;
			Inline inline2 = parent;
			while (inline != null)
			{
				Inline? nextSibling = inline.NextSibling;
				inline.Remove();
				inline2.InsertAfter(inline);
				inline2 = inline;
				inline = nextSibling;
			}
		}

		public void EmbraceChildrenBy(ContainerInline container)
		{
			if (container == null)
			{
				ThrowHelper.ArgumentNullException("container");
			}
			Inline inline = FirstChild;
			while (inline != null)
			{
				Inline? nextSibling = inline.NextSibling;
				inline.Remove();
				container.AppendChild(inline);
				inline = nextSibling;
			}
			AppendChild(container);
		}

		protected override void OnChildInsert(Inline child)
		{
			if (child.PreviousSibling == null && child.NextSibling == FirstChild)
			{
				FirstChild = child;
			}
			else if (child.NextSibling == null && child.PreviousSibling == LastChild)
			{
				LastChild = child;
			}
			if (LastChild == null)
			{
				LastChild = FirstChild;
			}
			else if (FirstChild == null)
			{
				FirstChild = LastChild;
			}
		}

		protected override void OnChildRemove(Inline child)
		{
			if (child == FirstChild)
			{
				if (FirstChild == LastChild)
				{
					FirstChild = null;
					LastChild = null;
				}
				else
				{
					FirstChild = child.NextSibling ?? LastChild;
				}
			}
			else if (child == LastChild)
			{
				LastChild = child.PreviousSibling ?? FirstChild;
			}
		}

		protected override void DumpChildTo(TextWriter writer, int level)
		{
			if (FirstChild != null)
			{
				level++;
				FirstChild.DumpTo(writer, level);
			}
		}

		public Enumerator GetEnumerator()
		{
			return new Enumerator(this);
		}

		IEnumerator<Inline> IEnumerable<Inline>.GetEnumerator()
		{
			return GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
	[DebuggerDisplay("{ToLiteral()} {Type}")]
	public abstract class DelimiterInline : ContainerInline
	{
		public InlineParser Parser { get; }

		public DelimiterType Type { get; set; }

		public bool IsActive { get; set; }

		protected DelimiterInline(InlineParser parser)
		{
			if (parser == null)
			{
				ThrowHelper.ArgumentNullException("parser");
			}
			Parser = parser;
			IsActive = true;
		}

		public abstract string ToLiteral();

		public void ReplaceByLiteral()
		{
			LiteralInline inline = new LiteralInline
			{
				Content = new StringSlice(ToLiteral()),
				Span = Span,
				Line = base.Line,
				Column = base.Column,
				IsClosed = true
			};
			ReplaceBy(inline);
		}
	}
	[Flags]
	public enum DelimiterType : byte
	{
		Undefined = 0,
		Open = 1,
		Close = 2
	}
	public class EmphasisDelimiterInline : DelimiterInline
	{
		public EmphasisDescriptor Descriptor { get; }

		public char DelimiterChar { get; }

		public int DelimiterCount { get; set; }

		public EmphasisDelimiterInline(InlineParser parser, EmphasisDescriptor descriptor)
			: base(parser)
		{
			if (descriptor == null)
			{
				ThrowHelper.ArgumentNullException("descriptor");
			}
			Descriptor = descriptor;
			DelimiterChar = descriptor.Character;
		}

		public override string ToLiteral()
		{
			if (DelimiterCount <= 0)
			{
				return string.Empty;
			}
			return new string(DelimiterChar, DelimiterCount);
		}

		public LiteralInline AsLiteralInline()
		{
			return new LiteralInline
			{
				Content = new StringSlice(ToLiteral()),
				IsClosed = true,
				Span = Span,
				Line = base.Line,
				Column = base.Column
			};
		}
	}
	[DebuggerDisplay("{DelimiterChar} Count: {DelimiterCount}")]
	public class EmphasisInline : ContainerInline
	{
		public char DelimiterChar { get; set; }

		[Obsolete("Use `DelimiterCount == 2` instead", false)]
		public bool IsDouble
		{
			get
			{
				return DelimiterCount == 2;
			}
			set
			{
				DelimiterCount = ((!value) ? 1 : 2);
			}
		}

		public int DelimiterCount { get; set; }
	}
	[DebuggerDisplay("{Original} -> {Transcoded}")]
	public class HtmlEntityInline : LeafInline
	{
		public StringSlice Original { get; set; }

		public StringSlice Transcoded { get; set; }
	}
	[DebuggerDisplay("{Tag}")]
	public class HtmlInline : LeafInline
	{
		public string Tag { get; set; }

		public HtmlInline(string tag)
		{
			Tag = tag;
		}
	}
	public interface IInline : IMarkdownObject
	{
		ContainerInline? Parent { get; }

		Inline? PreviousSibling { get; }

		Inline? NextSibling { get; }

		bool IsClosed { get; set; }
	}
	public abstract class Inline : MarkdownObject, IInline, IMarkdownObject
	{
		public ContainerInline? Parent { get; internal set; }

		public Inline? PreviousSibling { get; private set; }

		public Inline? NextSibling { get; internal set; }

		public bool IsClosed
		{
			get
			{
				return base.IsClosedInternal;
			}
			set
			{
				base.IsClosedInternal = value;
			}
		}

		protected Inline()
		{
			SetTypeKind(isInline: true, isContainer: false);
		}

		public void InsertAfter(Inline next)
		{
			if (next == null)
			{
				ThrowHelper.ArgumentNullException("next");
			}
			if (next.Parent != null)
			{
				ThrowHelper.ArgumentException("Inline has already a parent", "next");
			}
			Inline nextSibling = NextSibling;
			if (nextSibling != null)
			{
				nextSibling.PreviousSibling = next;
			}
			next.PreviousSibling = this;
			next.NextSibling = nextSibling;
			NextSibling = next;
			if (Parent != null)
			{
				Parent.OnChildInsert(next);
				next.Parent = Parent;
			}
		}

		public void InsertBefore(Inline previous)
		{
			if (previous == null)
			{
				ThrowHelper.ArgumentNullException("previous");
			}
			if (previous.Parent != null)
			{
				ThrowHelper.ArgumentException("Inline has already a parent", "previous");
			}
			Inline previousSibling = PreviousSibling;
			if (previousSibling != null)
			{
				previousSibling.NextSibling = previous;
			}
			PreviousSibling = previous;
			previous.NextSibling = this;
			if (Parent != null)
			{
				Parent.OnChildInsert(previous);
				previous.Parent = Parent;
			}
		}

		public void Remove()
		{
			if (PreviousSibling != null)
			{
				PreviousSibling.NextSibling = NextSibling;
			}
			if (NextSibling != null)
			{
				NextSibling.PreviousSibling = PreviousSibling;
			}
			if (Parent != null)
			{
				Parent.OnChildRemove(this);
				PreviousSibling = null;
				NextSibling = null;
				Parent = null;
			}
		}

		public Inline ReplaceBy(Inline inline, bool copyChildren = true)
		{
			if (inline == null)
			{
				ThrowHelper.ArgumentNullException("inline");
			}
			ContainerInline parent = Parent;
			Inline previousSibling = PreviousSibling;
			Inline nextSibling = NextSibling;
			Remove();
			if (previousSibling != null)
			{
				previousSibling.InsertAfter(inline);
			}
			else if (nextSibling != null)
			{
				nextSibling.InsertBefore(inline);
			}
			else
			{
				parent?.AppendChild(inline);
			}
			if (copyChildren && base.IsContainerInline)
			{
				ContainerInline containerInline = Unsafe.As<ContainerInline>(this);
				ContainerInline containerInline2 = ((inline.IsContainerInline && !inline.IsClosed) ? Unsafe.As<ContainerInline>(inline) : null);
				Inline inline2 = containerInline.FirstChild;
				Inline inline3 = inline;
				while (inline2 != null)
				{
					Inline? nextSibling2 = inline2.NextSibling;
					inline2.Remove();
					if (containerInline2 != null)
					{
						containerInline2.AppendChild(inline2);
					}
					else
					{
						inline3.InsertAfter(inline2);
					}
					inline3 = inline2;
					inline2 = nextSibling2;
				}
				return inline3;
			}
			return inline;
		}

		public bool ContainsParentOfType<T>() where T : Inline
		{
			for (Inline inline = this; inline != null; inline = inline.Parent)
			{
				if (inline as T != null)
				{
					return true;
				}
			}
			return false;
		}

		public IEnumerable<T> FindParentOfType<T>() where T : Inline
		{
			for (Inline inline = this; inline != null; inline = inline.Parent)
			{
				if (inline is T val)
				{
					yield return val;
				}
			}
		}

		public T? FirstParentOfType<T>() where T : notnull, Inline
		{
			for (Inline inline = this; inline != null; inline = inline.Parent)
			{
				if (inline is T result)
				{
					return result;
				}
			}
			return null;
		}

		public Inline FindBestParent()
		{
			Inline inline = this;
			while (inline.Parent != null || inline.PreviousSibling != null)
			{
				inline = ((inline.Parent == null) ? inline.PreviousSibling : inline.Parent);
			}
			return inline;
		}

		protected virtual void OnChildRemove(Inline child)
		{
		}

		protected virtual void OnChildInsert(Inline child)
		{
		}

		public void DumpTo(TextWriter writer)
		{
			if (writer == null)
			{
				ThrowHelper.ArgumentNullException_writer();
			}
			DumpTo(writer, 0);
		}

		public void DumpTo(TextWriter writer, int level)
		{
			if (writer == null)
			{
				ThrowHelper.ArgumentNullException_writer();
			}
			for (int i = 0; i < level; i++)
			{
				writer.Write(' ');
			}
			writer.WriteLine("-> " + GetType().Name + " = " + this);
			DumpChildTo(writer, level + 1);
			if (NextSibling != null)
			{
				NextSibling.DumpTo(writer, level);
			}
		}

		protected virtual void DumpChildTo(TextWriter writer, int level)
		{
		}
	}
	public abstract class LeafInline : Inline
	{
	}
	public class LineBreakInline : LeafInline
	{
		public bool IsHard { get; set; }

		public bool IsBackslash { get; set; }

		public NewLine NewLine { get; set; }
	}
	public class LinkDelimiterInline : DelimiterInline
	{
		private sealed class TriviaProperties
		{
			public StringSlice LabelWithTrivia;
		}

		public SourceSpan LabelSpan;

		private TriviaProperties? _trivia => GetTrivia<TriviaProperties>();

		private TriviaProperties Trivia => GetOrSetTrivia<TriviaProperties>();

		public bool IsImage { get; set; }

		public string? Label { get; set; }

		public StringSlice LabelWithTrivia
		{
			get
			{
				return _trivia?.LabelWithTrivia ?? StringSlice.Empty;
			}
			set
			{
				Trivia.LabelWithTrivia = value;
			}
		}

		public LinkDelimiterInline(InlineParser parser)
			: base(parser)
		{
		}

		public override string ToLiteral()
		{
			if (!IsImage)
			{
				return "[";
			}
			return "![";
		}
	}
	public enum LocalLabel : byte
	{
		Local,
		Empty,
		None
	}
	[DebuggerDisplay("Url: {Url} Title: {Title} Image: {IsImage}")]
	public class LinkInline : ContainerInline
	{
		public delegate string GetUrlDelegate();

		private sealed class TriviaProperties
		{
			public StringSlice LabelWithTrivia;

			public LocalLabel LocalLabel;

			public string? LinkRefDefLabel;

			public StringSlice LinkRefDefLabelWithTrivia;

			public StringSlice TriviaBeforeUrl;

			public bool UrlHasPointyBrackets;

			public StringSlice UnescapedUrl;

			public StringSlice TriviaAfterUrl;

			public char TitleEnclosingCharacter;

			public StringSlice UnescapedTitle;

			public StringSlice TriviaAfterTitle;
		}

		public SourceSpan LabelSpan;

		public SourceSpan UrlSpan;

		public SourceSpan TitleSpan;

		private TriviaProperties? _trivia => GetTrivia<TriviaProperties>();

		private TriviaProperties Trivia => GetOrSetTrivia<TriviaProperties>();

		public bool IsImage { get; set; }

		public string? Label { get; set; }

		public StringSlice LabelWithTrivia
		{
			get
			{
				return _trivia?.LabelWithTrivia ?? StringSlice.Empty;
			}
			set
			{
				Trivia.LabelWithTrivia = value;
			}
		}

		public LocalLabel LocalLabel
		{
			get
			{
				return _trivia?.LocalLabel ?? LocalLabel.None;
			}
			set
			{
				Trivia.LocalLabel = value;
			}
		}

		public LinkReferenceDefinition? Reference { get; set; }

		public string? LinkRefDefLabel
		{
			get
			{
				return _trivia?.LinkRefDefLabel;
			}
			set
			{
				Trivia.LinkRefDefLabel = value;
			}
		}

		public StringSlice LinkRefDefLabelWithTrivia
		{
			get
			{
				return _trivia?.LinkRefDefLabelWithTrivia ?? StringSlice.Empty;
			}
			set
			{
				Trivia.LinkRefDefLabelWithTrivia = value;
			}
		}

		public StringSlice TriviaBeforeUrl
		{
			get
			{
				return _trivia?.TriviaBeforeUrl ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaBeforeUrl = value;
			}
		}

		public bool UrlHasPointyBrackets
		{
			get
			{
				return _trivia?.UrlHasPointyBrackets ?? false;
			}
			set
			{
				Trivia.UrlHasPointyBrackets = value;
			}
		}

		public string? Url { get; set; }

		public StringSlice UnescapedUrl
		{
			get
			{
				return _trivia?.UnescapedUrl ?? StringSlice.Empty;
			}
			set
			{
				Trivia.UnescapedUrl = value;
			}
		}

		public StringSlice TriviaAfterUrl
		{
			get
			{
				return _trivia?.TriviaAfterUrl ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaAfterUrl = value;
			}
		}

		public GetUrlDelegate? GetDynamicUrl { get; set; }

		public char TitleEnclosingCharacter
		{
			get
			{
				return _trivia?.TitleEnclosingCharacter ?? '\0';
			}
			set
			{
				Trivia.TitleEnclosingCharacter = value;
			}
		}

		public string? Title { get; set; }

		public StringSlice UnescapedTitle
		{
			get
			{
				return _trivia?.UnescapedTitle ?? StringSlice.Empty;
			}
			set
			{
				Trivia.UnescapedTitle = value;
			}
		}

		public StringSlice TriviaAfterTitle
		{
			get
			{
				return _trivia?.TriviaAfterTitle ?? StringSlice.Empty;
			}
			set
			{
				Trivia.TriviaAfterTitle = value;
			}
		}

		public bool IsShortcut { get; set; }

		public bool IsAutoLink { get; set; }

		public LinkInline()
		{
		}

		public LinkInline(string url, string title)
		{
			Url = url;
			Title = title;
		}
	}
	[DebuggerDisplay("{Content}")]
	public class LiteralInline : LeafInline
	{
		public StringSlice Content;

		public bool IsFirstCharacterEscaped
		{
			get
			{
				return base.InternalSpareBit;
			}
			set
			{
				base.InternalSpareBit = value;
			}
		}

		public LiteralInline()
		{
			Content = new StringSlice(null);
		}

		public LiteralInline(StringSlice content)
		{
			Content = content;
		}

		public LiteralInline(string text)
		{
			if (text == null)
			{
				ThrowHelper.ArgumentNullException_text();
			}
			Content = new StringSlice(text);
		}

		public override string ToString()
		{
			return Content.ToString();
		}
	}
}
namespace Markdig.Renderers
{
	public class HtmlRenderer : TextRendererBase<HtmlRenderer>
	{
		private static readonly char[] s_writeEscapeIndexOfAnyChars = new char[4] { '<', '>', '&', '"' };

		private static readonly IdnMapping IdnMapping = new IdnMapping();

		public bool EnableHtmlForInline { get; set; }

		public bool EnableHtmlForBlock { get; set; }

		public bool EnableHtmlEscape { get; set; }

		public bool ImplicitParagraph { get; set; }

		public bool UseNonAsciiNoEscape { get; set; }

		public Uri? BaseUrl { get; set; }

		public Func<string, string>? LinkRewriter { get; set; }

		public HtmlRenderer(TextWriter writer)
			: base(writer)
		{
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.CodeBlockRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.ListRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.HeadingRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.HtmlBlockRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.ParagraphRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.QuoteBlockRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.ThematicBreakRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.Inlines.AutolinkInlineRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.Inlines.CodeInlineRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.Inlines.DelimiterInlineRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.Inlines.EmphasisInlineRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.Inlines.LineBreakInlineRenderer());
			base.ObjectRenderers.Add(new HtmlInlineRenderer());
			base.ObjectRenderers.Add(new HtmlEntityInlineRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.Inlines.LinkInlineRenderer());
			base.ObjectRenderers.Add(new Markdig.Renderers.Html.Inlines.LiteralInlineRenderer());
			EnableHtmlForBlock = true;
			EnableHtmlForInline = true;
			EnableHtmlEscape = true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public HtmlRenderer WriteEscape(string? content)
		{
			WriteEscape(content.AsSpan());
			return this;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public HtmlRenderer WriteEscape(ref StringSlice slice, bool softEscape = false)
		{
			WriteEscape(slice.AsSpan(), softEscape);
			return this;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public HtmlRenderer WriteEscape(StringSlice slice, bool softEscape = false)
		{
			WriteEscape(slice.AsSpan(), softEscape);
			return this;
		}

		public HtmlRenderer WriteEscape(string content, int offset, int length, bool softEscape = false)
		{
			WriteEscape(content.AsSpan(offset, length), softEscape);
			return this;
		}

		public void WriteEscape(ReadOnlySpan<char> content, bool softEscape = false)
		{
			if (!content.IsEmpty)
			{
				if (content.IndexOfAny(s_writeEscapeIndexOfAnyChars) == -1)
				{
					Write(content);
				}
				else
				{
					WriteEscapeSlow(content, softEscape);
				}
			}
		}

		private void WriteEscapeSlow(ReadOnlySpan<char> content, bool softEscape = false)
		{
			WriteIndent();
			int num = 0;
			for (int i = 0; i < content.Length; i++)
			{
				switch (content[i])
				{
				case '<':
					WriteRaw(content.Slice(num, i - num));
					if (EnableHtmlEscape)
					{
						WriteRaw("&lt;");
					}
					num = i + 1;
					break;
				case '>':
					if (!softEscape)
					{
						WriteRaw(content.Slice(num, i - num));
						if (EnableHtmlEscape)
						{
							WriteRaw("&gt;");
						}
						num = i + 1;
					}
					break;
				case '&':
					WriteRaw(content.Slice(num, i - num));
					if (EnableHtmlEscape)
					{
						WriteRaw("&amp;");
					}
					num = i + 1;
					break;
				case '"':
					if (!softEscape)
					{
						WriteRaw(content.Slice(num, i - num));
						if (EnableHtmlEscape)
						{
							WriteRaw("&quot;");
						}
						num = i + 1;
					}
					break;
				}
			}
			WriteRaw(content.Slice(num));
		}

		public HtmlRenderer WriteEscapeUrl(string? content)
		{
			if (content == null)
			{
				return this;
			}
			if (BaseUrl != null && Uri.TryCreate(content, UriKind.RelativeOrAbsolute, out Uri result) && !result.IsAbsoluteUri)
			{
				content = new Uri(BaseUrl, result).AbsoluteUri;
			}
			if (LinkRewriter != null)
			{
				content = LinkRewriter(content);
			}
			int num = ((content.Length < 7) ? (-1) : content.IndexOf("://", StringComparison.Ordinal));
			if (num != -1)
			{
				num += 3;
				WriteEscapeUrl(content, 0, num);
				bool flag = false;
				int i;
				for (i = num; i < content.Length; i++)
				{
					char c = content[i];
					if (c == '/' || c == '?' || c == '#' || c == ':')
					{
						break;
					}
					if (c > '\u007f')
					{
						flag = true;
					}
				}
				if (flag)
				{
					string ascii;
					try
					{
						ascii = IdnMapping.GetAscii(content, num, i - num);
					}
					catch
					{
						WriteEscapeUrl(content, num, content.Length);
						return this;
					}
					int num2 = 0;
					for (int j = 0; j < ascii.Length; j++)
					{
						string text = HtmlHelper.EscapeUrlCharacter(ascii[j]);
						if (text != null)
						{
							Write(ascii, num2, j - num2);
							num2 = j + 1;
							Write(text);
						}
					}
					Write(ascii, num2, ascii.Length - num2);
					WriteEscapeUrl(content, i, content.Length);
				}
				else
				{
					WriteEscapeUrl(content, num, content.Length);
				}
			}
			else
			{
				WriteEscapeUrl(content, 0, content.Length);
			}
			return this;
		}

		private void WriteEscapeUrl(string content, int start, int length)
		{
			int num = start;
			for (int i = num; i < length; i++)
			{
				char c = content[i];
				if (c < '\u0080')
				{
					string text = HtmlHelper.EscapeUrlCharacter(c);
					if (text != null)
					{
						Write(content, num, i - num);
						num = i + 1;
						Write(text);
					}
					continue;
				}
				Write(content, num, i - num);
				num = i + 1;
				if (UseNonAsciiNoEscape)
				{
					Write(c);
					continue;
				}
				byte[] bytes;
				if (c >= '\ud800' && c <= '\udfff' && num < length)
				{
					bytes = Encoding.UTF8.GetBytes(new char[2]
					{
						c,
						content[num]
					});
					i++;
					num = i + 1;
				}
				else
				{
					bytes = Encoding.UTF8.GetBytes(new char[1] { c });
				}
				for (int j = 0; j < bytes.Length; j++)
				{
					Write($"%{bytes[j]:X2}");
				}
			}
			Write(content, num, length - num);
		}

		public HtmlRenderer WriteAttributes(MarkdownObject markdownObject)
		{
			if (markdownObject == null)
			{
				ThrowHelper.ArgumentNullException_markdownObject();
			}
			return WriteAttributes(markdownObject.TryGetAttributes());
		}

		public HtmlRenderer WriteAttributes(HtmlAttributes? attributes, Func<string, string>? classFilter = null)
		{
			if (attributes == null)
			{
				return this;
			}
			if (attributes.Id != null)
			{
				Write(" id=\"");
				WriteEscape(attributes.Id);
				WriteRaw('"');
			}
			List<string> classes = attributes.Classes;
			if (classes != null && classes.Count > 0)
			{
				Write(" class=\"");
				for (int i = 0; i < attributes.Classes.Count; i++)
				{
					string text = attributes.Classes[i];
					if (i > 0)
					{
						WriteRaw(' ');
					}
					WriteEscape((classFilter != null) ? classFilter(text) : text);
				}
				WriteRaw('"');
			}
			List<KeyValuePair<string, string>> properties = attributes.Properties;
			if (properties != null && properties.Count > 0)
			{
				foreach (KeyValuePair<string, string> property in attributes.Properties)
				{
					Write(' ');
					WriteRaw(property.Key);
					WriteRaw("=\"");
					WriteEscape(property.Value ?? "");
					WriteRaw('"');
				}
			}
			return this;
		}

		public HtmlRenderer WriteLeafRawLines(LeafBlock leafBlock, bool writeEndOfLines, bool escape, bool softEscape = false)
		{
			if (leafBlock == null)
			{
				ThrowHelper.ArgumentNullException_leafBlock();
			}
			StringLine[] lines = leafBlock.Lines.Lines;
			if (lines != null)
			{
				for (int i = 0; i < lines.Length; i++)
				{
					ref StringSlice slice = ref lines[i].Slice;
					if (slice.Text == null)
					{
						break;
					}
					if (!writeEndOfLines && i > 0)
					{
						WriteLine();
					}
					ReadOnlySpan<char> content = slice.AsSpan();
					if (escape)
					{
						WriteEscape(content, softEscape);
					}
					else
					{
						Write(content);
					}
					if (writeEndOfLines)
					{
						WriteLine();
					}
				}
			}
			return this;
		}
	}
	public interface IMarkdownObjectRenderer
	{
		bool Accept(RendererBase renderer, Type objectType);

		void Write(RendererBase renderer, MarkdownObject objectToRender);
	}
	public interface IMarkdownRenderer
	{
		ObjectRendererCollection ObjectRenderers { get; }

		event Action<IMarkdownRenderer, MarkdownObject> ObjectWriteBefore;

		event Action<IMarkdownRenderer, MarkdownObject> ObjectWriteAfter;

		object Render(MarkdownObject markdownObject);
	}
	public abstract class MarkdownObjectRenderer<TRenderer, TObject> : IMarkdownObjectRenderer where TRenderer : RendererBase where TObject : MarkdownObject
	{
		public delegate bool TryWriteDelegate(TRenderer renderer, TObject obj);

		private OrderedList<TryWriteDelegate>? _tryWriters;

		public OrderedList<TryWriteDelegate> TryWriters => _tryWriters ?? (_tryWriters = new OrderedList<TryWriteDelegate>());

		public bool Accept(RendererBase renderer, Type objectType)
		{
			return typeof(TObject).IsAssignableFrom(objectType);
		}

		public virtual void Write(RendererBase renderer, MarkdownObject obj)
		{
			TRenderer renderer2 = (TRenderer)renderer;
			TObject obj2 = (TObject)obj;
			if (_tryWriters == null || !TryWrite(renderer2, obj2))
			{
				Write(renderer2, obj2);
			}
		}

		private bool TryWrite(TRenderer renderer, TObject obj)
		{
			for (int i = 0; i < _tryWriters.Count; i++)
			{
				if (_tryWriters[i](renderer, obj))
				{
					return true;
				}
			}
			return false;
		}

		protected abstract void Write(TRenderer renderer, TObject obj);
	}
	public class ObjectRendererCollection : OrderedList<IMarkdownObjectRenderer>
	{
	}
	public abstract class RendererBase : IMarkdownRenderer
	{
		private readonly struct KeyWrapper : IEquatable<KeyWrapper>
		{
			public readonly IntPtr Key;

			public KeyWrapper(IntPtr key)
			{
				Key = key;
			}

			public bool Equals(KeyWrapper other)
			{
				return Key == other.Key;
			}

			public override int GetHashCode()
			{
				return Key.GetHashCode();
			}

			public override bool Equals(object? obj)
			{
				throw new NotImplementedException();
			}
		}

		private readonly Dictionary<KeyWrapper, IMarkdownObjectRenderer?> _renderersPerType = new Dictionary<KeyWrapper, IMarkdownObjectRenderer>();

		internal int _childrenDepth;

		public ObjectRendererCollection ObjectRenderers { get; } = new ObjectRendererCollection();


		public bool IsFirstInContainer { get; private set; }

		public bool IsLastInContainer { get; private set; }

		public event Action<IMarkdownRenderer, MarkdownObject>? ObjectWriteBefore;

		public event Action<IMarkdownRenderer, MarkdownObject>? ObjectWriteAfter;

		private IMarkdownObjectRenderer? GetRendererInstance(MarkdownObject obj)
		{
			KeyWrapper keyForType = GetKeyForType(obj);
			Type type = obj.GetType();
			for (int i = 0; i < ObjectRenderers.Count; i++)
			{
				IMarkdownObjectRenderer markdownObjectRenderer = ObjectRenderers[i];
				if (markdownObjectRenderer.Accept(this, type))
				{
					_renderersPerType[keyForType] = markdownObjectRenderer;
					return markdownObjectRenderer;
				}
			}
			_renderersPerType[keyForType] = null;
			return null;
		}

		public abstract object Render(MarkdownObject markdownObject);

		public void WriteChildren(ContainerBlock containerBlock)
		{
			if (containerBlock != null)
			{
				ThrowHelper.CheckDepthLimit(_childrenDepth++);
				bool isFirstInContainer = IsFirstInContainer;
				bool isLastInContainer = IsLastInContainer;
				for (int i = 0; i < containerBlock.Count; i++)
				{
					IsFirstInContainer = i == 0;
					IsLastInContainer = i + 1 == containerBlock.Count;
					Write(containerBlock[i]);
				}
				IsFirstInContainer = isFirstInContainer;
				IsLastInContainer = isLastInContainer;
				_childrenDepth--;
			}
		}

		public void WriteChildren(ContainerInline containerInline)
		{
			if (containerInline != null)
			{
				ThrowHelper.CheckDepthLimit(_childrenDepth++);
				bool isFirstInContainer = IsFirstInContainer;
				bool isLastInContainer = IsLastInContainer;
				bool isFirstInContainer2 = true;
				Inline inline = containerInline.FirstChild;
				while (inline != null)
				{
					IsFirstInContainer = isFirstInContainer2;
					IsLastInContainer = inline.NextSibling == null;
					Write(inline);
					inline = inline.NextSibling;
					isFirstInContainer2 = false;
				}
				IsFirstInContainer = isFirstInContainer;
				IsLastInContainer = isLastInContainer;
				_childrenDepth--;
			}
		}

		public void Write(MarkdownObject obj)
		{
			if (obj != null)
			{
				this.ObjectWriteBefore?.Invoke(this, obj);
				if (!_renderersPerType.TryGetValue(GetKeyForType(obj), out IMarkdownObjectRenderer value))
				{
					value = GetRendererInstance(obj);
				}
				if (value != null)
				{
					value.Write(this, obj);
				}
				else if (obj.IsContainerInline)
				{
					WriteChildren(Unsafe.As<ContainerInline>(obj));
				}
				else if (obj.IsContainerBlock)
				{
					WriteChildren(Unsafe.As<ContainerBlock>(obj));
				}
				this.ObjectWriteAfter?.Invoke(this, obj);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static KeyWrapper GetKeyForType(MarkdownObject obj)
		{
			return new KeyWrapper(Type.GetTypeHandle(obj).Value);
		}
	}
	public abstract class TextRendererBase : RendererBase
	{
		private TextWriter _writer;

		public TextWriter Writer
		{
			get
			{
				return _writer;
			}
			[MemberNotNull("_writer")]
			set
			{
				if (value == null)
				{
					ThrowHelper.ArgumentNullException("value");
				}
				value.NewLine = "\n";
				_writer = value;
			}
		}

		protected TextRendererBase(TextWriter writer)
		{
			Writer = writer;
		}

		public override object Render(MarkdownObject markdownObject)
		{
			Write(markdownObject);
			return Writer;
		}
	}
	public abstract class TextRendererBase<T> : TextRendererBase where T : TextRendererBase<T>
	{
		private sealed class Indent
		{
			private readonly string? _constant;

			private readonly string[]? _lineSpecific;

			private int position;

			internal Indent(string constant)
			{
				_constant = constant;
			}

			internal Indent(string[] lineSpecific)
			{
				_lineSpecific = lineSpecific;
			}

			internal string Next()
			{
				if (_constant != null)
				{
					return _constant;
				}
				if (position == _lineSpecific.Length)
				{
					return string.Empty;
				}
				return _lineSpecific[position++];
			}
		}

		protected bool previousWasLine;

		private readonly List<Indent> indents;

		protected TextRendererBase(TextWriter writer)
			: base(writer)
		{
			previousWasLine = true;
			indents = new List<Indent>();
		}

		protected internal void Reset()
		{
			if (base.Writer is StringWriter stringWriter)
			{
				stringWriter.GetStringBuilder().Length = 0;
			}
			else
			{
				ThrowHelper.InvalidOperationException("Cannot reset this TextWriter instance");
			}
			ResetInternal();
		}

		internal void ResetInternal()
		{
			_childrenDepth = 0;
			previousWasLine = true;
			indents.Clear();
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public T Ens

Markdig.Wpf.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Markdig.Extensions.AutoLinks;
using Markdig.Extensions.EmphasisExtras;
using Markdig.Extensions.Tables;
using Markdig.Extensions.TaskLists;
using Markdig.Helpers;
using Markdig.Renderers;
using Markdig.Renderers.Wpf;
using Markdig.Renderers.Wpf.Extensions;
using Markdig.Renderers.Wpf.Inlines;
using Markdig.Renderers.Xaml;
using Markdig.Renderers.Xaml.Inlines;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using Markdig.Wpf;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: ThemeInfo(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Nicolas Musset")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © Nicolas Musset 2016-2021")]
[assembly: AssemblyDescription("A WPF library for lunet-io/markdig")]
[assembly: AssemblyFileVersion("0.5.0.1")]
[assembly: AssemblyInformationalVersion("0.5.0.1+f172c1337eacd80f5fd138b1eb2547e62690b243")]
[assembly: AssemblyProduct("Markdig.Wpf")]
[assembly: AssemblyTitle("Markdig.Wpf")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Kryptos-FR/markdig.wpf.git")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: AssemblyVersion("0.5.0.1")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Markdig.Renderers
{
	public class WpfRenderer : RendererBase
	{
		private readonly Stack<IAddChild> stack = new Stack<IAddChild>();

		private char[] buffer;

		public FlowDocument? Document { get; protected set; }

		public WpfRenderer()
		{
			buffer = new char[1024];
		}

		public WpfRenderer(FlowDocument document)
		{
			buffer = new char[1024];
			LoadDocument(document);
		}

		public virtual void LoadDocument(FlowDocument document)
		{
			Document = document ?? throw new ArgumentNullException("document");
			((FrameworkContentElement)document).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.DocumentStyleKey);
			stack.Push((IAddChild)(object)document);
			LoadRenderers();
		}

		public override object? Render(MarkdownObject markdownObject)
		{
			((RendererBase)this).Write(markdownObject);
			return Document;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void WriteLeafInline(LeafBlock leafBlock)
		{
			if (leafBlock == null)
			{
				throw new ArgumentNullException("leafBlock");
			}
			for (Inline val = (Inline)(object)leafBlock.Inline; val != null; val = val.NextSibling)
			{
				((RendererBase)this).Write((MarkdownObject)(object)val);
			}
		}

		public void WriteLeafRawLines(LeafBlock leafBlock)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			if (leafBlock == null)
			{
				throw new ArgumentNullException("leafBlock");
			}
			if (((StringLineGroup)(ref leafBlock.Lines)).Lines == null)
			{
				return;
			}
			StringLineGroup lines = leafBlock.Lines;
			StringLine[] lines2 = ((StringLineGroup)(ref lines)).Lines;
			for (int i = 0; i < ((StringLineGroup)(ref lines)).Count; i++)
			{
				if (i != 0)
				{
					WriteInline((Inline)new LineBreak());
				}
				WriteText(ref lines2[i].Slice);
			}
		}

		public void Push(IAddChild o)
		{
			stack.Push(o);
		}

		public void Pop()
		{
			IAddChild val = stack.Pop();
			stack.Peek().AddChild((object)val);
		}

		public void WriteBlock(Block block)
		{
			stack.Peek().AddChild((object)block);
		}

		public void WriteInline(Inline inline)
		{
			AddInline(stack.Peek(), inline);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void WriteText(ref StringSlice slice)
		{
			if (((StringSlice)(ref slice)).Start <= ((StringSlice)(ref slice)).End)
			{
				WriteText(slice.Text, ((StringSlice)(ref slice)).Start, ((StringSlice)(ref slice)).Length);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void WriteText(string? text)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			WriteInline((Inline)new Run(text));
		}

		public void WriteText(string? text, int offset, int length)
		{
			if (text != null)
			{
				if (offset == 0 && text.Length == length)
				{
					WriteText(text);
				}
				else if (length > buffer.Length)
				{
					buffer = text.ToCharArray();
					WriteText(new string(buffer, offset, length));
				}
				else
				{
					text.CopyTo(offset, buffer, 0, length);
					WriteText(new string(buffer, 0, length));
				}
			}
		}

		protected virtual void LoadRenderers()
		{
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.CodeBlockRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.ListRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.HeadingRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.ParagraphRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.QuoteBlockRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.ThematicBreakRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.Inlines.AutolinkInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.Inlines.CodeInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.Inlines.DelimiterInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.Inlines.EmphasisInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.Inlines.HtmlEntityInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.Inlines.LineBreakInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.Inlines.LinkInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Wpf.Inlines.LiteralInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new TableRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new TaskListRenderer());
		}

		private static void AddInline(IAddChild parent, Inline inline)
		{
			parent.AddChild((object)inline);
		}
	}
	public class XamlRenderer : TextRendererBase<XamlRenderer>
	{
		public bool EnableHtmlEscape { get; set; }

		public XamlRenderer(TextWriter writer)
			: base(writer)
		{
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.CodeBlockRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.ListRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.HeadingRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new HtmlBlockRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.ParagraphRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.QuoteBlockRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.ThematicBreakRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.Inlines.AutolinkInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.Inlines.CodeInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.Inlines.DelimiterInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.Inlines.EmphasisInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.Inlines.LineBreakInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new HtmlInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.Inlines.HtmlEntityInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.Inlines.LinkInlineRenderer());
			((List<IMarkdownObjectRenderer>)(object)((RendererBase)this).ObjectRenderers).Add((IMarkdownObjectRenderer)(object)new Markdig.Renderers.Xaml.Inlines.LiteralInlineRenderer());
			EnableHtmlEscape = true;
		}

		public override object Render(MarkdownObject markdownObject)
		{
			object result;
			if (markdownObject is MarkdownDocument)
			{
				base.Write("<FlowDocument");
				base.Write(" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"");
				base.Write(" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"");
				base.Write(" xmlns:markdig=\"clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf\"");
				base.Write(" Style=\"{StaticResource {x:Static markdig:Styles.DocumentStyleKey}}\"");
				base.WriteLine(">");
				result = ((TextRendererBase)this).Render(markdownObject);
				base.Write("</FlowDocument>");
			}
			else
			{
				result = ((TextRendererBase)this).Render(markdownObject);
			}
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public XamlRenderer WriteEscape(string? content)
		{
			if (string.IsNullOrEmpty(content))
			{
				return this;
			}
			WriteEscape(content, 0, content.Length);
			return this;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public XamlRenderer WriteEscape(ref StringSlice slice, bool softEscape = false)
		{
			if (((StringSlice)(ref slice)).Start > ((StringSlice)(ref slice)).End)
			{
				return this;
			}
			return WriteEscape(slice.Text, ((StringSlice)(ref slice)).Start, ((StringSlice)(ref slice)).Length, softEscape);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public XamlRenderer WriteEscape(StringSlice slice, bool softEscape = false)
		{
			return WriteEscape(ref slice, softEscape);
		}

		public XamlRenderer WriteEscape(string? content, int offset, int length, bool softEscape = false)
		{
			if (string.IsNullOrEmpty(content) || length == 0)
			{
				return this;
			}
			int num = offset + length;
			int num2 = offset;
			while (offset < num)
			{
				switch (content[offset])
				{
				case '<':
					base.Write(content, num2, offset - num2);
					if (EnableHtmlEscape)
					{
						base.Write("&lt;");
					}
					num2 = offset + 1;
					break;
				case '>':
					if (!softEscape)
					{
						base.Write(content, num2, offset - num2);
						if (EnableHtmlEscape)
						{
							base.Write("&gt;");
						}
						num2 = offset + 1;
					}
					break;
				case '&':
					base.Write(content, num2, offset - num2);
					if (EnableHtmlEscape)
					{
						base.Write("&amp;");
					}
					num2 = offset + 1;
					break;
				case '"':
					if (!softEscape)
					{
						base.Write(content, num2, offset - num2);
						if (EnableHtmlEscape)
						{
							base.Write("&quot;");
						}
						num2 = offset + 1;
					}
					break;
				}
				offset++;
			}
			base.Write(content, num2, num - num2);
			return this;
		}

		public XamlRenderer WriteEscapeUrl(string? content)
		{
			if (content == null)
			{
				return this;
			}
			int num = 0;
			int length = content.Length;
			for (int i = 0; i < length; i++)
			{
				char c = content[i];
				if (c < '\u0080')
				{
					string text = HtmlHelper.EscapeUrlCharacter(c);
					if (text != null)
					{
						base.Write(content, num, i - num);
						num = i + 1;
						base.Write(text);
					}
					continue;
				}
				base.Write(content, num, i - num);
				num = i + 1;
				byte[] bytes;
				if (c >= '\ud800' && c <= '\udfff' && num < length)
				{
					bytes = Encoding.UTF8.GetBytes(new char[2]
					{
						c,
						content[num]
					});
					i++;
					num = i + 1;
				}
				else
				{
					bytes = Encoding.UTF8.GetBytes(new char[1] { c });
				}
				byte[] array = bytes;
				foreach (byte b in array)
				{
					base.Write($"%{b:X2}");
				}
			}
			base.Write(content, num, length - num);
			return this;
		}

		public XamlRenderer WriteLeafRawLines(LeafBlock leafBlock, bool writeEndOfLines, bool escape, bool softEscape = false)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (leafBlock == null)
			{
				throw new ArgumentNullException("leafBlock");
			}
			if (((StringLineGroup)(ref leafBlock.Lines)).Lines != null)
			{
				StringLineGroup lines = leafBlock.Lines;
				StringLine[] lines2 = ((StringLineGroup)(ref lines)).Lines;
				for (int i = 0; i < ((StringLineGroup)(ref lines)).Count; i++)
				{
					if (!writeEndOfLines && i > 0)
					{
						base.WriteLine();
					}
					if (escape)
					{
						WriteEscape(ref lines2[i].Slice, softEscape);
					}
					else
					{
						base.Write(ref lines2[i].Slice);
					}
					if (writeEndOfLines)
					{
						base.WriteLine();
					}
				}
			}
			return this;
		}
	}
}
namespace Markdig.Renderers.Xaml
{
	public class CodeBlockRenderer : XamlObjectRenderer<CodeBlock>
	{
		protected override void Write(XamlRenderer renderer, CodeBlock obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).EnsureLine();
			((TextRendererBase<XamlRenderer>)(object)renderer).Write("<Paragraph xml:space=\"preserve\"");
			((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Style=\"{StaticResource {x:Static markdig:Styles.CodeBlockStyleKey}}\"");
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine(">");
			renderer.WriteLeafRawLines((LeafBlock)(object)obj, writeEndOfLines: true, escape: true);
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("</Paragraph>");
		}
	}
	public class HeadingRenderer : XamlObjectRenderer<HeadingBlock>
	{
		protected override void Write(XamlRenderer renderer, HeadingBlock obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).Write("<Paragraph");
			if (obj.Level > 0 && obj.Level <= 6)
			{
				((TextRendererBase<XamlRenderer>)(object)renderer).Write($" Style=\"{{StaticResource {{x:Static markdig:Styles.Heading{obj.Level}StyleKey}}}}\"");
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine(">");
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLeafInline((LeafBlock)(object)obj);
			((TextRendererBase<XamlRenderer>)(object)renderer).EnsureLine();
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("</Paragraph>");
		}
	}
	public class HtmlBlockRenderer : XamlObjectRenderer<HtmlBlock>
	{
		protected override void Write(XamlRenderer renderer, HtmlBlock obj)
		{
		}
	}
	public class ListRenderer : XamlObjectRenderer<ListBlock>
	{
		protected override void Write(XamlRenderer renderer, ListBlock listBlock)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (listBlock == null)
			{
				throw new ArgumentNullException("listBlock");
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).EnsureLine();
			((TextRendererBase<XamlRenderer>)(object)renderer).Write("<List");
			if (listBlock.IsOrdered)
			{
				((TextRendererBase<XamlRenderer>)(object)renderer).Write(" MarkerStyle=\"Decimal\"");
				if (listBlock.OrderedStart != null && listBlock.DefaultOrderedStart != listBlock.OrderedStart)
				{
					((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)renderer).Write(" StartIndex=\"")).Write(listBlock.OrderedStart)).Write("\"");
				}
			}
			else
			{
				((TextRendererBase<XamlRenderer>)(object)renderer).Write(" MarkerStyle=\"Disc\"");
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine(">");
			Enumerator enumerator = ((ContainerBlock)listBlock).GetEnumerator();
			try
			{
				while (((Enumerator)(ref enumerator)).MoveNext())
				{
					ListItemBlock val = (ListItemBlock)((Enumerator)(ref enumerator)).Current;
					((TextRendererBase<XamlRenderer>)(object)renderer).EnsureLine();
					((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("<ListItem>");
					((RendererBase)renderer).WriteChildren((ContainerBlock)(object)val);
					((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("</ListItem>");
				}
			}
			finally
			{
				((IDisposable)(Enumerator)(ref enumerator)).Dispose();
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("</List>");
		}
	}
	public class ParagraphRenderer : XamlObjectRenderer<ParagraphBlock>
	{
		protected override void Write(XamlRenderer renderer, ParagraphBlock obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			if (!((RendererBase)renderer).IsFirstInContainer)
			{
				((TextRendererBase<XamlRenderer>)(object)renderer).EnsureLine();
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("<Paragraph>");
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLeafInline((LeafBlock)(object)obj);
			((TextRendererBase<XamlRenderer>)(object)renderer).EnsureLine();
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("</Paragraph>");
		}
	}
	public class QuoteBlockRenderer : XamlObjectRenderer<QuoteBlock>
	{
		protected override void Write(XamlRenderer renderer, QuoteBlock obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).EnsureLine();
			((TextRendererBase<XamlRenderer>)(object)renderer).Write("<Section");
			((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Style=\"{StaticResource {x:Static markdig:Styles.QuoteBlockStyleKey}}\"");
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine(">");
			((RendererBase)renderer).WriteChildren((ContainerBlock)(object)obj);
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("</Section>");
		}
	}
	public class ThematicBreakRenderer : XamlObjectRenderer<ThematicBreakBlock>
	{
		protected override void Write(XamlRenderer renderer, ThematicBreakBlock obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).EnsureLine();
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("<Paragraph>");
			((TextRendererBase<XamlRenderer>)(object)renderer).Write("<Line X2=\"1\"");
			((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Style=\"{StaticResource {x:Static markdig:Styles.ThematicBreakStyleKey}}\"");
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine(" />");
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("</Paragraph>");
		}
	}
	public abstract class XamlObjectRenderer<TObject> : MarkdownObjectRenderer<XamlRenderer, TObject> where TObject : MarkdownObject
	{
		protected XamlObjectRenderer()
		{
			((MarkdownObjectRenderer<XamlRenderer, XamlRenderer>)(object)this)..ctor();
		}
	}
}
namespace Markdig.Renderers.Xaml.Inlines
{
	public class AutolinkInlineRenderer : XamlObjectRenderer<AutolinkInline>
	{
		protected override void Write(XamlRenderer renderer, AutolinkInline obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			string text = obj.Url;
			if (obj.IsEmail)
			{
				text = "mailto:" + text;
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).Write("<Hyperlink");
			((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Style=\"{StaticResource {x:Static markdig:Styles.HyperlinkStyleKey}}\"");
			((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Command=\"{x:Static markdig:Commands.Hyperlink}\"");
			((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)renderer).Write(" CommandParameter=\"").WriteEscapeUrl(text)).Write("\"");
			((TextRendererBase<XamlRenderer>)(object)renderer).Write(">");
			renderer.WriteEscapeUrl(obj.Url);
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("</Hyperlink>");
		}
	}
	public class CodeInlineRenderer : XamlObjectRenderer<CodeInline>
	{
		protected override void Write(XamlRenderer renderer, CodeInline obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).Write("<Run");
			((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Style=\"{StaticResource {x:Static markdig:Styles.CodeStyleKey}}\"");
			((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Text=\"").WriteEscape(obj.Content)).Write("\"");
			((TextRendererBase<XamlRenderer>)(object)renderer).Write(" />");
		}
	}
	public class DelimiterInlineRenderer : XamlObjectRenderer<DelimiterInline>
	{
		protected override void Write(XamlRenderer renderer, DelimiterInline obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			renderer.WriteEscape(obj.ToLiteral());
			((RendererBase)renderer).WriteChildren((ContainerInline)(object)obj);
		}
	}
	public class EmphasisInlineRenderer : XamlObjectRenderer<EmphasisInline>
	{
		public delegate string GetTagDelegate(EmphasisInline obj);

		public GetTagDelegate GetTag { get; set; }

		public EmphasisInlineRenderer()
		{
			GetTag = GetDefaultTag;
		}

		protected override void Write(XamlRenderer renderer, EmphasisInline obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			string text = GetTag(obj);
			((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)renderer).Write("<")).Write(text);
			switch (obj.DelimiterChar)
			{
			case '~':
				((TextRendererBase<XamlRenderer>)(object)renderer).Write((obj.DelimiterCount == 2) ? " Style=\"{StaticResource {x:Static markdig:Styles.StrikeThroughStyleKey}}\"" : " Style=\"{StaticResource {x:Static markdig:Styles.SubscriptStyleKey}}\"");
				break;
			case '^':
				((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Style=\"{StaticResource {x:Static markdig:Styles.SuperscriptStyleKey}}\"");
				break;
			case '+':
				((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Style=\"{StaticResource {x:Static markdig:Styles.InsertedStyleKey}}\"");
				break;
			case '=':
				((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Style=\"{StaticResource {x:Static markdig:Styles.MarkedStyleKey}}\"");
				break;
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).Write(">");
			((RendererBase)renderer).WriteChildren((ContainerInline)(object)obj);
			((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)renderer).Write("</")).Write(text)).Write(">");
		}

		public static string GetDefaultTag(EmphasisInline emphasis)
		{
			if (emphasis == null)
			{
				throw new ArgumentNullException("emphasis");
			}
			if (emphasis.DelimiterChar == '*' || emphasis.DelimiterChar == '_')
			{
				if (emphasis.DelimiterCount != 2)
				{
					return "Italic";
				}
				return "Bold";
			}
			return "Span";
		}
	}
	public class HtmlEntityInlineRenderer : XamlObjectRenderer<HtmlEntityInline>
	{
		protected override void Write(XamlRenderer renderer, HtmlEntityInline obj)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			renderer.WriteEscape(obj.Transcoded);
		}
	}
	public class HtmlInlineRenderer : XamlObjectRenderer<HtmlInline>
	{
		protected override void Write(XamlRenderer renderer, HtmlInline obj)
		{
		}
	}
	public class LineBreakInlineRenderer : XamlObjectRenderer<LineBreakInline>
	{
		protected override void Write(XamlRenderer renderer, LineBreakInline obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			if (obj.IsHard)
			{
				((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("<LineBreak />");
			}
			else
			{
				((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine();
			}
		}
	}
	public class LinkInlineRenderer : XamlObjectRenderer<LinkInline>
	{
		protected override void Write(XamlRenderer renderer, LinkInline obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			GetUrlDelegate getDynamicUrl = obj.GetDynamicUrl;
			string content = ((getDynamicUrl != null) ? getDynamicUrl.Invoke() : null) ?? obj.Url;
			if (obj.IsImage)
			{
				((TextRendererBase<XamlRenderer>)(object)renderer).Write("<Image");
				((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Style=\"{StaticResource {x:Static markdig:Styles.ImageStyleKey}}\"");
				((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine(">");
				((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("<Image.Source>");
				((TextRendererBase<XamlRenderer>)(object)renderer).Write("<BitmapImage");
				((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)renderer).Write(" UriSource=\"").WriteEscapeUrl(content)).Write("\"");
				((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine(" />");
				((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("</Image.Source>");
				((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("</Image>");
				return;
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).Write("<Hyperlink");
			((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Style=\"{StaticResource {x:Static markdig:Styles.HyperlinkStyleKey}}\"");
			((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Command=\"{x:Static markdig:Commands.Hyperlink}\"");
			((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)renderer).Write(" CommandParameter=\"").WriteEscapeUrl(content)).Write("\"");
			if (!string.IsNullOrEmpty(obj.Title))
			{
				((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)renderer).Write(" ToolTip=\"")).Write(obj.Title)).Write("\"");
			}
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine(">");
			((RendererBase)renderer).WriteChildren((ContainerInline)(object)obj);
			((TextRendererBase<XamlRenderer>)(object)renderer).EnsureLine();
			((TextRendererBase<XamlRenderer>)(object)renderer).WriteLine("</Hyperlink>");
		}
	}
	public class LiteralInlineRenderer : XamlObjectRenderer<LiteralInline>
	{
		protected override void Write(XamlRenderer renderer, LiteralInline obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			if (!((StringSlice)(ref obj.Content)).IsEmpty)
			{
				((TextRendererBase<XamlRenderer>)(object)renderer).Write("<Run");
				((TextRendererBase<XamlRenderer>)(object)((TextRendererBase<XamlRenderer>)(object)renderer).Write(" Text=\"").WriteEscape(ref obj.Content)).Write("\"");
				((TextRendererBase<XamlRenderer>)(object)renderer).Write(" />");
			}
		}
	}
}
namespace Markdig.Renderers.Wpf
{
	public class CodeBlockRenderer : WpfObjectRenderer<CodeBlock>
	{
		protected override void Write(WpfRenderer renderer, CodeBlock obj)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			Paragraph val = new Paragraph();
			((FrameworkContentElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.CodeBlockStyleKey);
			renderer.Push((IAddChild)(object)val);
			renderer.WriteLeafRawLines((LeafBlock)(object)obj);
			renderer.Pop();
		}
	}
	public class HeadingRenderer : WpfObjectRenderer<HeadingBlock>
	{
		protected override void Write(WpfRenderer renderer, HeadingBlock obj)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Paragraph val = new Paragraph();
			ComponentResourceKey val2 = null;
			switch (obj.Level)
			{
			case 1:
				val2 = Styles.Heading1StyleKey;
				break;
			case 2:
				val2 = Styles.Heading2StyleKey;
				break;
			case 3:
				val2 = Styles.Heading3StyleKey;
				break;
			case 4:
				val2 = Styles.Heading4StyleKey;
				break;
			case 5:
				val2 = Styles.Heading5StyleKey;
				break;
			case 6:
				val2 = Styles.Heading6StyleKey;
				break;
			}
			if (val2 != null)
			{
				((FrameworkContentElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)val2);
			}
			renderer.Push((IAddChild)(object)val);
			renderer.WriteLeafInline((LeafBlock)(object)obj);
			renderer.Pop();
		}
	}
	public class ListRenderer : WpfObjectRenderer<ListBlock>
	{
		protected override void Write(WpfRenderer renderer, ListBlock listBlock)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (listBlock == null)
			{
				throw new ArgumentNullException("listBlock");
			}
			List val = new List();
			if (listBlock.IsOrdered)
			{
				val.MarkerStyle = (TextMarkerStyle)9;
				if (listBlock.OrderedStart != null && listBlock.DefaultOrderedStart != listBlock.OrderedStart)
				{
					val.StartIndex = int.Parse(listBlock.OrderedStart, NumberFormatInfo.InvariantInfo);
				}
			}
			else
			{
				val.MarkerStyle = (TextMarkerStyle)1;
			}
			renderer.Push((IAddChild)(object)val);
			Enumerator enumerator = ((ContainerBlock)listBlock).GetEnumerator();
			try
			{
				while (((Enumerator)(ref enumerator)).MoveNext())
				{
					ListItemBlock val2 = (ListItemBlock)((Enumerator)(ref enumerator)).Current;
					ListItem o = new ListItem();
					renderer.Push((IAddChild)(object)o);
					((RendererBase)renderer).WriteChildren((ContainerBlock)(object)val2);
					renderer.Pop();
				}
			}
			finally
			{
				((IDisposable)(Enumerator)(ref enumerator)).Dispose();
			}
			renderer.Pop();
		}
	}
	public class ParagraphRenderer : WpfObjectRenderer<ParagraphBlock>
	{
		protected override void Write(WpfRenderer renderer, ParagraphBlock obj)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Paragraph val = new Paragraph();
			((FrameworkContentElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.ParagraphStyleKey);
			renderer.Push((IAddChild)(object)val);
			renderer.WriteLeafInline((LeafBlock)(object)obj);
			renderer.Pop();
		}
	}
	public class QuoteBlockRenderer : WpfObjectRenderer<QuoteBlock>
	{
		protected override void Write(WpfRenderer renderer, QuoteBlock obj)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Section val = new Section();
			renderer.Push((IAddChild)(object)val);
			((RendererBase)renderer).WriteChildren((ContainerBlock)(object)obj);
			((FrameworkContentElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.QuoteBlockStyleKey);
			renderer.Pop();
		}
	}
	public class ThematicBreakRenderer : WpfObjectRenderer<ThematicBreakBlock>
	{
		protected override void Write(WpfRenderer renderer, ThematicBreakBlock obj)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0058: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Line val = new Line
			{
				X2 = 1.0
			};
			((FrameworkElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.ThematicBreakStyleKey);
			Paragraph val2 = new Paragraph();
			((TextElementCollection<Inline>)(object)val2.Inlines).Add((Inline)new InlineUIContainer((UIElement)(object)val));
			Paragraph block = val2;
			renderer.WriteBlock((Block)(object)block);
		}
	}
	public abstract class WpfObjectRenderer<TObject> : MarkdownObjectRenderer<WpfRenderer, TObject> where TObject : MarkdownObject
	{
		protected WpfObjectRenderer()
		{
			((MarkdownObjectRenderer<WpfRenderer, WpfRenderer>)(object)this)..ctor();
		}
	}
}
namespace Markdig.Renderers.Wpf.Inlines
{
	public class AutolinkInlineRenderer : WpfObjectRenderer<AutolinkInline>
	{
		protected override void Write(WpfRenderer renderer, AutolinkInline link)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (link == null)
			{
				throw new ArgumentNullException("link");
			}
			string text = link.Url;
			if (link.IsEmail)
			{
				text = "mailto:" + text;
			}
			if (!Uri.IsWellFormedUriString(text, UriKind.RelativeOrAbsolute))
			{
				text = "#";
			}
			Hyperlink val = new Hyperlink
			{
				Command = (ICommand)Commands.Hyperlink,
				CommandParameter = text,
				NavigateUri = new Uri(text, UriKind.RelativeOrAbsolute),
				ToolTip = link.Url
			};
			((FrameworkContentElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.HyperlinkStyleKey);
			renderer.Push((IAddChild)(object)val);
			renderer.WriteText(link.Url);
			renderer.Pop();
		}
	}
	public class CodeInlineRenderer : WpfObjectRenderer<CodeInline>
	{
		protected override void Write(WpfRenderer renderer, CodeInline obj)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Run val = new Run(obj.Content);
			((FrameworkContentElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.CodeStyleKey);
			renderer.WriteInline((Inline)(object)val);
		}
	}
	public class DelimiterInlineRenderer : WpfObjectRenderer<DelimiterInline>
	{
		protected override void Write(WpfRenderer renderer, DelimiterInline obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			renderer.WriteText(obj.ToLiteral());
			((RendererBase)renderer).WriteChildren((ContainerInline)(object)obj);
		}
	}
	public class EmphasisInlineRenderer : WpfObjectRenderer<EmphasisInline>
	{
		protected override void Write(WpfRenderer renderer, EmphasisInline obj)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_006b: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Span val = null;
			switch (obj.DelimiterChar)
			{
			case '*':
			case '_':
				val = (Span)((obj.DelimiterCount == 2) ? new Bold() : new Italic());
				break;
			case '~':
				val = new Span();
				((FrameworkContentElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)((obj.DelimiterCount == 2) ? Styles.StrikeThroughStyleKey : Styles.SubscriptStyleKey));
				break;
			case '^':
				val = new Span();
				((FrameworkContentElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.SuperscriptStyleKey);
				break;
			case '+':
				val = new Span();
				((FrameworkContentElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.InsertedStyleKey);
				break;
			case '=':
				val = new Span();
				((FrameworkContentElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.MarkedStyleKey);
				break;
			}
			if (val != null)
			{
				renderer.Push((IAddChild)(object)val);
				((RendererBase)renderer).WriteChildren((ContainerInline)(object)obj);
				renderer.Pop();
			}
			else
			{
				((RendererBase)renderer).WriteChildren((ContainerInline)(object)obj);
			}
		}
	}
	public class HtmlEntityInlineRenderer : WpfObjectRenderer<HtmlEntityInline>
	{
		protected override void Write(WpfRenderer renderer, HtmlEntityInline obj)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			StringSlice slice = obj.Transcoded;
			renderer.WriteText(ref slice);
		}
	}
	public class LineBreakInlineRenderer : WpfObjectRenderer<LineBreakInline>
	{
		protected override void Write(WpfRenderer renderer, LineBreakInline obj)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			if (obj.IsHard)
			{
				renderer.WriteInline((Inline)new LineBreak());
			}
			else
			{
				renderer.WriteText(" ");
			}
		}
	}
	public class LinkInlineRenderer : WpfObjectRenderer<LinkInline>
	{
		protected override void Write(WpfRenderer renderer, LinkInline link)
		{
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_010b: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (link == null)
			{
				throw new ArgumentNullException("link");
			}
			string text = ((link.GetDynamicUrl != null) ? (link.GetDynamicUrl.Invoke() ?? link.Url) : link.Url);
			if (!Uri.IsWellFormedUriString(text, UriKind.RelativeOrAbsolute))
			{
				text = "#";
			}
			if (link.IsImage)
			{
				ControlTemplate val = new ControlTemplate();
				FrameworkElementFactory val2 = new FrameworkElementFactory(typeof(Image));
				val2.SetValue(Image.SourceProperty, (object)new BitmapImage(new Uri(text, UriKind.RelativeOrAbsolute)));
				val2.SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.ImageStyleKey);
				((FrameworkTemplate)val).VisualTree = val2;
				Button val3 = new Button
				{
					Template = val,
					Command = (ICommand)Commands.Image,
					CommandParameter = text
				};
				renderer.WriteInline((Inline)new InlineUIContainer((UIElement)(object)val3));
			}
			else
			{
				Hyperlink val4 = new Hyperlink
				{
					Command = (ICommand)Commands.Hyperlink,
					CommandParameter = text,
					NavigateUri = new Uri(text, UriKind.RelativeOrAbsolute),
					ToolTip = ((!string.IsNullOrEmpty(link.Title)) ? link.Title : null)
				};
				((FrameworkContentElement)val4).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.HyperlinkStyleKey);
				renderer.Push((IAddChild)(object)val4);
				((RendererBase)renderer).WriteChildren((ContainerInline)(object)link);
				renderer.Pop();
			}
		}
	}
	public class LiteralInlineRenderer : WpfObjectRenderer<LiteralInline>
	{
		protected override void Write(WpfRenderer renderer, LiteralInline obj)
		{
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			if (!((StringSlice)(ref obj.Content)).IsEmpty)
			{
				renderer.WriteText(ref obj.Content);
			}
		}
	}
}
namespace Markdig.Renderers.Wpf.Extensions
{
	public class TableRenderer : WpfObjectRenderer<Table>
	{
		protected override void Write(WpfRenderer renderer, Table table)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Expected I4, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (table == null)
			{
				throw new ArgumentNullException("table");
			}
			Table val = new Table();
			((FrameworkContentElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.TableStyleKey);
			foreach (TableColumnDefinition columnDefinition in table.ColumnDefinitions)
			{
				val.Columns.Add(new TableColumn
				{
					Width = (GridLength)((((columnDefinition != null) ? columnDefinition.Width : 0f) != 0f) ? new GridLength((double)columnDefinition.Width, (GridUnitType)2) : GridLength.Auto)
				});
			}
			TableRowGroup o = new TableRowGroup();
			renderer.Push((IAddChild)(object)val);
			renderer.Push((IAddChild)(object)o);
			Enumerator enumerator2 = ((ContainerBlock)table).GetEnumerator();
			try
			{
				while (((Enumerator)(ref enumerator2)).MoveNext())
				{
					TableRow val2 = (TableRow)((Enumerator)(ref enumerator2)).Current;
					TableRow val3 = new TableRow();
					renderer.Push((IAddChild)(object)val3);
					if (val2.IsHeader)
					{
						((FrameworkContentElement)val3).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.TableHeaderStyleKey);
					}
					for (int i = 0; i < ((ContainerBlock)val2).Count; i++)
					{
						TableCell val4 = (TableCell)((ContainerBlock)val2)[i];
						TableCell val5 = new TableCell
						{
							ColumnSpan = val4.ColumnSpan,
							RowSpan = val4.RowSpan
						};
						((FrameworkContentElement)val5).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.TableCellStyleKey);
						renderer.Push((IAddChild)(object)val5);
						((RendererBase)renderer).Write((MarkdownObject)(object)val4);
						renderer.Pop();
						if (table.ColumnDefinitions.Count <= 0)
						{
							continue;
						}
						int num = ((val4.ColumnIndex < 0 || val4.ColumnIndex >= table.ColumnDefinitions.Count) ? i : val4.ColumnIndex);
						num = ((num >= table.ColumnDefinitions.Count) ? (table.ColumnDefinitions.Count - 1) : num);
						TableColumnAlign? alignment = table.ColumnDefinitions[num].Alignment;
						if (alignment.HasValue)
						{
							switch (alignment)
							{
							case 1L:
								val5.TextAlignment = (TextAlignment)2;
								break;
							case 2L:
								val5.TextAlignment = (TextAlignment)1;
								break;
							case 0L:
								val5.TextAlignment = (TextAlignment)0;
								break;
							}
						}
					}
					renderer.Pop();
				}
			}
			finally
			{
				((IDisposable)(Enumerator)(ref enumerator2)).Dispose();
			}
			renderer.Pop();
			renderer.Pop();
		}
	}
	public class TaskListRenderer : WpfObjectRenderer<TaskList>
	{
		protected override void Write(WpfRenderer renderer, TaskList taskList)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}
			if (taskList == null)
			{
				throw new ArgumentNullException("taskList");
			}
			CheckBox val = new CheckBox
			{
				IsEnabled = false,
				IsChecked = taskList.Checked
			};
			((FrameworkElement)val).SetResourceReference(FrameworkContentElement.StyleProperty, (object)Styles.TaskListStyleKey);
			renderer.WriteInline((Inline)new InlineUIContainer((UIElement)(object)val));
		}
	}
}
namespace Markdig.Wpf
{
	public static class Commands
	{
		public static RoutedCommand Hyperlink { get; } = new RoutedCommand("Hyperlink", typeof(Commands));


		public static RoutedCommand Image { get; } = new RoutedCommand("Image", typeof(Commands));

	}
	public static class Markdown
	{
		public const string Version = "0.4.0";

		public static FlowDocument ToFlowDocument(string markdown, MarkdownPipeline? pipeline = null, WpfRenderer? renderer = null)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (markdown == null)
			{
				throw new ArgumentNullException("markdown");
			}
			pipeline = pipeline ?? new MarkdownPipelineBuilder().Build();
			FlowDocument val = new FlowDocument();
			if (renderer == null)
			{
				renderer = new WpfRenderer(val);
			}
			else
			{
				renderer.LoadDocument(val);
			}
			pipeline.Setup((IMarkdownRenderer)(object)renderer);
			MarkdownDocument val2 = Markdown.Parse(markdown, pipeline, (MarkdownParserContext)null);
			((RendererBase)renderer).Render((MarkdownObject)(object)val2);
			return val;
		}

		public static string ToXaml(string markdown, MarkdownPipeline? pipeline = null)
		{
			if (markdown == null)
			{
				throw new ArgumentNullException("markdown");
			}
			using StringWriter stringWriter = new StringWriter();
			ToXaml(markdown, stringWriter, pipeline);
			return stringWriter.ToString();
		}

		public static MarkdownDocument ToXaml(string markdown, TextWriter writer, MarkdownPipeline? pipeline = null)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (markdown == null)
			{
				throw new ArgumentNullException("markdown");
			}
			if (writer == null)
			{
				throw new ArgumentNullException("writer");
			}
			pipeline = pipeline ?? new MarkdownPipelineBuilder().Build();
			XamlRenderer xamlRenderer = new XamlRenderer(writer);
			pipeline.Setup((IMarkdownRenderer)(object)xamlRenderer);
			MarkdownDocument val = Markdown.Parse(markdown, pipeline, (MarkdownParserContext)null);
			((RendererBase)xamlRenderer).Render((MarkdownObject)(object)val);
			writer.Flush();
			return val;
		}
	}
	public static class MarkdownExtensions
	{
		public static MarkdownPipelineBuilder UseSupportedExtensions(this MarkdownPipelineBuilder pipeline)
		{
			if (pipeline == null)
			{
				throw new ArgumentNullException("pipeline");
			}
			return MarkdownExtensions.UseAutoLinks(MarkdownExtensions.UseTaskLists(MarkdownExtensions.UsePipeTables(MarkdownExtensions.UseGridTables(MarkdownExtensions.UseEmphasisExtras(pipeline, (EmphasisExtraOptions)31)), (PipeTableOptions)null)), (AutoLinkOptions)null);
		}
	}
	public class MarkdownViewer : Control
	{
		protected static readonly MarkdownPipeline DefaultPipeline;

		private static readonly DependencyPropertyKey DocumentPropertyKey;

		public static readonly DependencyProperty DocumentProperty;

		public static readonly DependencyProperty MarkdownProperty;

		public static readonly DependencyProperty PipelineProperty;

		public FlowDocument? Document
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (FlowDocument)((DependencyObject)this).GetValue(DocumentProperty);
			}
			protected set
			{
				((DependencyObject)this).SetValue(DocumentPropertyKey, (object)value);
			}
		}

		public string? Markdown
		{
			get
			{
				return (string)((DependencyObject)this).GetValue(MarkdownProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(MarkdownProperty, (object)value);
			}
		}

		public MarkdownPipeline Pipeline
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (MarkdownPipeline)((DependencyObject)this).GetValue(PipelineProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(PipelineProperty, (object)value);
			}
		}

		static MarkdownViewer()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			DefaultPipeline = MarkdownExtensions.UseSupportedExtensions(new MarkdownPipelineBuilder()).Build();
			DocumentPropertyKey = DependencyProperty.RegisterReadOnly("Document", typeof(FlowDocument), typeof(MarkdownViewer), (PropertyMetadata)new FrameworkPropertyMetadata());
			DocumentProperty = DocumentPropertyKey.DependencyProperty;
			MarkdownProperty = DependencyProperty.Register("Markdown", typeof(string), typeof(MarkdownViewer), (PropertyMetadata)new FrameworkPropertyMetadata(new PropertyChangedCallback(MarkdownChanged)));
			PipelineProperty = DependencyProperty.Register("Pipeline", typeof(MarkdownPipeline), typeof(MarkdownViewer), (PropertyMetadata)new FrameworkPropertyMetadata(new PropertyChangedCallback(PipelineChanged)));
			FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(MarkdownViewer), (PropertyMetadata)new FrameworkPropertyMetadata((object)typeof(MarkdownViewer)));
		}

		private static void MarkdownChanged(object sender, DependencyPropertyChangedEventArgs e)
		{
			((MarkdownViewer)sender).RefreshDocument();
		}

		private static void PipelineChanged(object sender, DependencyPropertyChangedEventArgs e)
		{
			((MarkdownViewer)sender).RefreshDocument();
		}

		protected virtual void RefreshDocument()
		{
			Document = ((Markdown != null) ? Markdig.Wpf.Markdown.ToFlowDocument(Markdown, Pipeline ?? DefaultPipeline) : null);
		}
	}
	public static class Styles
	{
		public static ComponentResourceKey CodeStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"CodeStyleKey");


		public static ComponentResourceKey CodeBlockStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"CodeBlockStyleKey");


		public static ComponentResourceKey DocumentStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"DocumentStyleKey");


		public static ComponentResourceKey Heading1StyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"Heading1StyleKey");


		public static ComponentResourceKey Heading2StyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"Heading2StyleKey");


		public static ComponentResourceKey Heading3StyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"Heading3StyleKey");


		public static ComponentResourceKey Heading4StyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"Heading4StyleKey");


		public static ComponentResourceKey Heading5StyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"Heading5StyleKey");


		public static ComponentResourceKey Heading6StyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"Heading6StyleKey");


		public static ComponentResourceKey HyperlinkStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"HyperlinkStyleKey");


		public static ComponentResourceKey ImageStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"ImageStyleKey");


		public static ComponentResourceKey InsertedStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"InsertedStyleKey");


		public static ComponentResourceKey MarkedStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"MarkedStyleKey");


		public static ComponentResourceKey ParagraphStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"ParagraphStyleKey");


		public static ComponentResourceKey QuoteBlockStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"QuoteBlockStyleKey");


		public static ComponentResourceKey StrikeThroughStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"StrikeThroughStyleKey");


		public static ComponentResourceKey SubscriptStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"SubscriptStyleKey");


		public static ComponentResourceKey SuperscriptStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"SuperscriptStyleKey");


		public static ComponentResourceKey TableStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"TableStyleKey");


		public static ComponentResourceKey TableCellStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"TableCellStyleKey");


		public static ComponentResourceKey TableHeaderStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"TableHeaderStyleKey");


		public static ComponentResourceKey TaskListStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"TaskListStyleKey");


		public static ComponentResourceKey ThematicBreakStyleKey { get; } = new ComponentResourceKey(typeof(Styles), (object)"ThematicBreakStyleKey");

	}
}

MessagePack.Annotations.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("2.5.108.51978")]
[assembly: AssemblyInformationalVersion("2.5.108+cb0ad5dd95")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("neuecc,aarnott")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("© Yoshifumi Kawai and contributors. All rights reserved.")]
[assembly: AssemblyDescription("Attributes and interfaces for .NET types serializable with MessagePack.")]
[assembly: AssemblyProduct("MessagePack.Annotations")]
[assembly: AssemblyTitle("MessagePack.Annotations")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/neuecc/MessagePack-CSharp")]
[assembly: AssemblyVersion("2.5.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
[GeneratedCode("Nerdbank.GitVersioning.Tasks", "3.5.119.9565")]
[ExcludeFromCodeCoverage]
internal static class ThisAssembly
{
	internal const string AssemblyConfiguration = "Release";

	internal const string AssemblyFileVersion = "2.5.108.51978";

	internal const string AssemblyInformationalVersion = "2.5.108+cb0ad5dd95";

	internal const string AssemblyName = "MessagePack.Annotations";

	internal const string AssemblyTitle = "MessagePack.Annotations";

	internal const string AssemblyVersion = "2.5.0.0";

	internal static readonly DateTime GitCommitDate = new DateTime(638145736080000000L, DateTimeKind.Utc);

	internal const string GitCommitId = "cb0ad5dd955cb9b14ca63019938a6aada43ce822";

	internal const bool IsPrerelease = false;

	internal const bool IsPublicRelease = true;

	internal const string PublicKey = "0024000004800000940000000602000000240000525341310004000001000100293894d4e8ad2b53afbea4e949ef54c2a388b08b5ebd143c811da82f22aa20c839ed1c0b4da83e7195e8c1dbe1bf3934e4e8fd7fb93f893439106fbf055a97c7fac0f7f8c39e58e78371dc0e3825e5b9d7e2afff0372f03c4d67ff7df0dbfb58dcadeb1044840de152bf8270de7fc54255ace8efd026c16311760d1a2570c3e8";

	internal const string PublicKeyToken = "b4a0369545f0a1be";

	internal const string RootNamespace = "MessagePack";
}
namespace MessagePack
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]
	public class MessagePackObjectAttribute : Attribute
	{
		public bool KeyAsPropertyName { get; private set; }

		public MessagePackObjectAttribute(bool keyAsPropertyName = false)
		{
			KeyAsPropertyName = keyAsPropertyName;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
	public class KeyAttribute : Attribute
	{
		public int? IntKey { get; private set; }

		public string? StringKey { get; private set; }

		public KeyAttribute(int x)
		{
			IntKey = x;
		}

		public KeyAttribute(string x)
		{
			StringKey = x ?? throw new ArgumentNullException("x");
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
	public class IgnoreMemberAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	public class UnionAttribute : Attribute
	{
		public int Key { get; private set; }

		public Type SubType { get; private set; }

		public UnionAttribute(int key, Type subType)
		{
			Key = key;
			SubType = subType ?? throw new ArgumentNullException("subType");
		}

		public UnionAttribute(int key, string subType)
		{
			Key = key;
			SubType = Type.GetType(subType, throwOnError: true);
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = true)]
	public class SerializationConstructorAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]
	public class MessagePackFormatterAttribute : Attribute
	{
		public Type FormatterType { get; private set; }

		public object?[]? Arguments { get; private set; }

		public MessagePackFormatterAttribute(Type formatterType)
		{
			FormatterType = formatterType ?? throw new ArgumentNullException("formatterType");
		}

		public MessagePackFormatterAttribute(Type formatterType, params object?[]? arguments)
		{
			FormatterType = formatterType ?? throw new ArgumentNullException("formatterType");
			Arguments = arguments;
		}
	}
	public interface IMessagePackSerializationCallbackReceiver
	{
		void OnBeforeSerialize();

		void OnAfterDeserialize();
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
}

MessagePack.dll

Decompiled 5 months ago
using System;
using System.Buffers;
using System.Buffers.Binary;
using System.Buffers.Text;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Dynamic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Numerics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using MessagePack.Formatters;
using MessagePack.ImmutableCollection;
using MessagePack.Internal;
using MessagePack.LZ4;
using MessagePack.Resolvers;
using Microsoft.CodeAnalysis;
using Microsoft.NET.StringTools;
using Nerdbank.Streams;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("2.5.108.51978")]
[assembly: AssemblyInformationalVersion("2.5.108+cb0ad5dd95")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("neuecc,aarnott")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("© Yoshifumi Kawai and contributors. All rights reserved.")]
[assembly: AssemblyDescription("Extremely Fast MessagePack(MsgPack) Serializer for C# (.NET Framework, .NET 6, Unity, Xamarin).")]
[assembly: AssemblyProduct("MessagePack")]
[assembly: AssemblyTitle("MessagePack")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/neuecc/MessagePack-CSharp")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.5.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
[GeneratedCode("Nerdbank.GitVersioning.Tasks", "3.5.119.9565")]
[ExcludeFromCodeCoverage]
internal static class ThisAssembly
{
	internal const string AssemblyConfiguration = "Release";

	internal const string AssemblyFileVersion = "2.5.108.51978";

	internal const string AssemblyInformationalVersion = "2.5.108+cb0ad5dd95";

	internal const string AssemblyName = "MessagePack";

	internal const string AssemblyTitle = "MessagePack";

	internal const string AssemblyVersion = "2.5.0.0";

	internal static readonly DateTime GitCommitDate = new DateTime(638145736080000000L, DateTimeKind.Utc);

	internal const string GitCommitId = "cb0ad5dd955cb9b14ca63019938a6aada43ce822";

	internal const bool IsPrerelease = false;

	internal const bool IsPublicRelease = true;

	internal const string PublicKey = "0024000004800000940000000602000000240000525341310004000001000100293894d4e8ad2b53afbea4e949ef54c2a388b08b5ebd143c811da82f22aa20c839ed1c0b4da83e7195e8c1dbe1bf3934e4e8fd7fb93f893439106fbf055a97c7fac0f7f8c39e58e78371dc0e3825e5b9d7e2afff0372f03c4d67ff7df0dbfb58dcadeb1044840de152bf8270de7fc54255ace8efd026c16311760d1a2570c3e8";

	internal const string PublicKeyToken = "b4a0369545f0a1be";

	internal const string RootNamespace = "MessagePack";
}
namespace Nerdbank.Streams
{
	[DebuggerDisplay("{DebuggerDisplay,nq}")]
	internal class Sequence<T> : IBufferWriter<T>, IDisposable
	{
		private class SequenceSegment : ReadOnlySequenceSegment<T>
		{
			internal static readonly SequenceSegment Empty = new SequenceSegment();

			private static readonly bool MayContainReferences = !typeof(T).GetTypeInfo().IsPrimitive;

			private T[]? array;

			internal int Start { get; private set; }

			internal int End { get; private set; }

			internal Memory<T> RemainingMemory => AvailableMemory.Slice(End);

			internal Span<T> RemainingSpan => AvailableMemory.Span.Slice(End);

			internal IMemoryOwner<T>? MemoryOwner { get; private set; }

			internal Memory<T> AvailableMemory
			{
				get
				{
					T[] array = this.array;
					if (array == null)
					{
						return MemoryOwner?.Memory ?? default(Memory<T>);
					}
					return array;
				}
			}

			internal int Length => checked(End - Start);

			internal int WritableBytes => checked(AvailableMemory.Length - End);

			internal new SequenceSegment? Next
			{
				get
				{
					return (SequenceSegment)base.Next;
				}
				set
				{
					base.Next = value;
				}
			}

			internal bool IsForeignMemory
			{
				get
				{
					if (array == null)
					{
						return MemoryOwner == null;
					}
					return false;
				}
			}

			internal void Assign(IMemoryOwner<T> memoryOwner)
			{
				MemoryOwner = memoryOwner;
				base.Memory = memoryOwner.Memory;
			}

			internal void Assign(T[] array)
			{
				this.array = array;
				base.Memory = array;
			}

			internal void AssignForeign(ReadOnlyMemory<T> memory)
			{
				base.Memory = memory;
				End = memory.Length;
			}

			internal void ResetMemory(ArrayPool<T>? arrayPool)
			{
				ClearReferences(Start, checked(End - Start));
				base.Memory = default(ReadOnlyMemory<T>);
				Next = null;
				base.RunningIndex = 0L;
				Start = 0;
				End = 0;
				if (array != null)
				{
					arrayPool.Return(array);
					array = null;
				}
				else
				{
					MemoryOwner?.Dispose();
					MemoryOwner = null;
				}
			}

			internal void SetNext(SequenceSegment segment)
			{
				Next = segment;
				checked
				{
					segment.RunningIndex = base.RunningIndex + Start + Length;
					if (!IsForeignMemory)
					{
						base.Memory = AvailableMemory.Slice(0, Start + Length);
					}
				}
			}

			internal void Advance(int count)
			{
				checked
				{
					Requires.Range(count >= 0 && End + count <= base.Memory.Length, "count");
					End += count;
				}
			}

			internal void AdvanceTo(int offset)
			{
				ClearReferences(Start, checked(offset - Start));
				Start = offset;
			}

			private void ClearReferences(int startIndex, int length)
			{
				if (MayContainReferences)
				{
					Span<T> span = AvailableMemory.Span;
					span = span.Slice(startIndex, length);
					span.Clear();
				}
			}
		}

		private const int MaximumAutoGrowSize = 32768;

		private static readonly int DefaultLengthFromArrayPool;

		private static readonly ReadOnlySequence<T> Empty;

		private readonly Stack<SequenceSegment> segmentPool = new Stack<SequenceSegment>();

		private readonly MemoryPool<T>? memoryPool;

		private readonly ArrayPool<T>? arrayPool;

		private SequenceSegment? first;

		private SequenceSegment? last;

		public int MinimumSpanLength { get; set; }

		public bool AutoIncreaseMinimumSpanLength { get; set; } = true;


		public ReadOnlySequence<T> AsReadOnlySequence => this;

		public long Length => AsReadOnlySequence.Length;

		private string DebuggerDisplay => $"Length: {AsReadOnlySequence.Length}";

		public Sequence()
			: this(ArrayPool<T>.Create())
		{
		}

		public Sequence(MemoryPool<T> memoryPool)
		{
			Requires.NotNull(memoryPool, "memoryPool");
			this.memoryPool = memoryPool;
		}

		public Sequence(ArrayPool<T> arrayPool)
		{
			Requires.NotNull(arrayPool, "arrayPool");
			this.arrayPool = arrayPool;
		}

		public static implicit operator ReadOnlySequence<T>(Sequence<T> sequence)
		{
			SequenceSegment sequenceSegment = sequence.first;
			if (sequenceSegment != null)
			{
				SequenceSegment sequenceSegment2 = sequence.last;
				if (sequenceSegment2 != null)
				{
					return new ReadOnlySequence<T>(sequenceSegment, sequenceSegment.Start, sequenceSegment2, sequenceSegment2.End);
				}
			}
			return Empty;
		}

		public void AdvanceTo(SequencePosition position)
		{
			SequenceSegment sequenceSegment = (SequenceSegment)position.GetObject();
			if (sequenceSegment != null && (sequenceSegment != SequenceSegment.Empty || Length != 0L))
			{
				int integer = position.GetInteger();
				SequenceSegment next = first;
				while (next != sequenceSegment && next != null)
				{
					next = next.Next;
				}
				Requires.Argument(next != null, "position", "Position does not represent a valid position in this sequence.");
				Requires.Argument(integer >= next.Start, "position", "Position must not be earlier than current position.");
				for (next = first; next != sequenceSegment; next = RecycleAndGetNext(next))
				{
				}
				sequenceSegment.AdvanceTo(integer);
				first = ((sequenceSegment.Length == 0) ? RecycleAndGetNext(sequenceSegment) : sequenceSegment);
				if (first == null)
				{
					last = null;
				}
			}
		}

		public void Advance(int count)
		{
			SequenceSegment? sequenceSegment = last;
			Verify.Operation(sequenceSegment != null, "Cannot advance before acquiring memory.");
			sequenceSegment.Advance(count);
			ConsiderMinimumSizeIncrease();
		}

		public Memory<T> GetMemory(int sizeHint)
		{
			return GetSegment(sizeHint).RemainingMemory;
		}

		public Span<T> GetSpan(int sizeHint)
		{
			return GetSegment(sizeHint).RemainingSpan;
		}

		public void Append(ReadOnlyMemory<T> memory)
		{
			if (memory.Length > 0)
			{
				SequenceSegment sequenceSegment = ((segmentPool.Count > 0) ? segmentPool.Pop() : new SequenceSegment());
				sequenceSegment.AssignForeign(memory);
				Append(sequenceSegment);
			}
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public void Dispose()
		{
			Reset();
		}

		public void Reset()
		{
			for (SequenceSegment sequenceSegment = first; sequenceSegment != null; sequenceSegment = RecycleAndGetNext(sequenceSegment))
			{
			}
			first = (last = null);
		}

		private SequenceSegment GetSegment(int sizeHint)
		{
			Requires.Range(sizeHint >= 0, "sizeHint");
			int? num = null;
			if (sizeHint == 0)
			{
				if (last == null || last.WritableBytes == 0)
				{
					num = -1;
				}
			}
			else if (last == null || last.WritableBytes < sizeHint)
			{
				num = Math.Max(MinimumSpanLength, sizeHint);
			}
			if (num.HasValue)
			{
				SequenceSegment sequenceSegment = ((segmentPool.Count > 0) ? segmentPool.Pop() : new SequenceSegment());
				if (arrayPool != null)
				{
					sequenceSegment.Assign(arrayPool.Rent((num.Value == -1) ? DefaultLengthFromArrayPool : num.Value));
				}
				else
				{
					sequenceSegment.Assign(memoryPool.Rent(num.Value));
				}
				Append(sequenceSegment);
			}
			return last;
		}

		private void Append(SequenceSegment segment)
		{
			if (last == null)
			{
				first = (last = segment);
				return;
			}
			if (last.Length > 0)
			{
				last.SetNext(segment);
			}
			else
			{
				SequenceSegment next = first;
				if (first != last)
				{
					while (next.Next != last)
					{
						next = next.Next;
					}
				}
				else
				{
					first = segment;
				}
				next.SetNext(segment);
				RecycleAndGetNext(last);
			}
			last = segment;
		}

		private SequenceSegment? RecycleAndGetNext(SequenceSegment segment)
		{
			SequenceSegment? next = segment.Next;
			segment.ResetMemory(arrayPool);
			segmentPool.Push(segment);
			return next;
		}

		private void ConsiderMinimumSizeIncrease()
		{
			checked
			{
				if (AutoIncreaseMinimumSpanLength && MinimumSpanLength < 32768)
				{
					int num = Math.Min(32768, (int)Math.Min(2147483647L, unchecked(Length / 2)));
					if (MinimumSpanLength < num)
					{
						MinimumSpanLength = num;
					}
				}
			}
		}

		static Sequence()
		{
			checked
			{
				DefaultLengthFromArrayPool = 1 + unchecked(4095 / Unsafe.SizeOf<T>());
				Empty = new ReadOnlySequence<T>(SequenceSegment.Empty, 0, SequenceSegment.Empty, 0);
			}
		}
	}
	internal static class Requires
	{
		[DebuggerStepThrough]
		public static void Range([DoesNotReturnIf(false)] bool condition, string parameterName, string? message = null)
		{
			if (!condition)
			{
				FailRange(parameterName, message);
			}
		}

		[DebuggerStepThrough]
		public static Exception FailRange(string parameterName, string? message = null)
		{
			if (string.IsNullOrEmpty(message))
			{
				throw new ArgumentOutOfRangeException(parameterName);
			}
			throw new ArgumentOutOfRangeException(parameterName, message);
		}

		[DebuggerStepThrough]
		public static T NotNull<T>([NotNull] T value, string parameterName) where T : class
		{
			if (value == null)
			{
				throw new ArgumentNullException(parameterName);
			}
			return value;
		}

		[DebuggerStepThrough]
		public static void Argument([DoesNotReturnIf(false)] bool condition, string parameterName, string message)
		{
			if (!condition)
			{
				throw new ArgumentException(message, parameterName);
			}
		}

		[DebuggerStepThrough]
		public static void Argument([DoesNotReturnIf(false)] bool condition, string parameterName, string message, object arg1)
		{
			if (!condition)
			{
				throw new ArgumentException(string.Format(message, arg1), parameterName);
			}
		}

		[DebuggerStepThrough]
		public static void Argument([DoesNotReturnIf(false)] bool condition, string parameterName, string message, object arg1, object arg2)
		{
			if (!condition)
			{
				throw new ArgumentException(string.Format(message, arg1, arg2), parameterName);
			}
		}

		[DebuggerStepThrough]
		public static void Argument([DoesNotReturnIf(false)] bool condition, string parameterName, string message, params object[] args)
		{
			if (!condition)
			{
				throw new ArgumentException(string.Format(message, args), parameterName);
			}
		}
	}
	internal static class Verify
	{
		[DebuggerStepThrough]
		internal static void Operation([DoesNotReturnIf(false)] bool condition, string message)
		{
			if (!condition)
			{
				throw new InvalidOperationException(message);
			}
		}
	}
}
namespace MessagePack
{
	public ref struct MessagePackReader
	{
		private SequenceReader<byte> reader;

		public CancellationToken CancellationToken { get; set; }

		public int Depth { get; set; }

		public ReadOnlySequence<byte> Sequence => reader.Sequence;

		public SequencePosition Position => reader.Position;

		public long Consumed => reader.Consumed;

		public bool End => reader.End;

		public bool IsNil => NextCode == 192;

		public MessagePackType NextMessagePackType => MessagePackCode.ToMessagePackType(NextCode);

		public byte NextCode
		{
			get
			{
				ThrowInsufficientBufferUnless(reader.TryPeek(out var value));
				return value;
			}
		}

		public byte ReadByte()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			checked
			{
				switch (value)
				{
				case 204:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value3));
					return value3;
				}
				case 208:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value2));
					return (byte)value2;
				}
				case 205:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ushort value4));
					return (byte)value4;
				}
				case 209:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out short value9));
					return (byte)value9;
				}
				case 206:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out uint value8));
					return (byte)value8;
				}
				case 210:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out int value7));
					return (byte)value7;
				}
				case 207:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ulong value6));
					return (byte)value6;
				}
				case 211:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out long value5));
					return (byte)value5;
				}
				case 224:
				case 225:
				case 226:
				case 227:
				case 228:
				case 229:
				case 230:
				case 231:
				case 232:
				case 233:
				case 234:
				case 235:
				case 236:
				case 237:
				case 238:
				case 239:
				case 240:
				case 241:
				case 242:
				case 243:
				case 244:
				case 245:
				case 246:
				case 247:
				case 248:
				case 249:
				case 250:
				case 251:
				case 252:
				case 253:
				case 254:
				case byte.MaxValue:
					return (byte)unchecked((sbyte)value);
				default:
					if (value >= 0 && value <= 127)
					{
						return value;
					}
					throw ThrowInvalidCode(value);
				}
			}
		}

		public ushort ReadUInt16()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			checked
			{
				switch (value)
				{
				case 204:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value3));
					return value3;
				}
				case 208:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value2));
					return (ushort)value2;
				}
				case 205:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ushort value4));
					return value4;
				}
				case 209:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out short value9));
					return (ushort)value9;
				}
				case 206:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out uint value8));
					return (ushort)value8;
				}
				case 210:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out int value7));
					return (ushort)value7;
				}
				case 207:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ulong value6));
					return (ushort)value6;
				}
				case 211:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out long value5));
					return (ushort)value5;
				}
				case 224:
				case 225:
				case 226:
				case 227:
				case 228:
				case 229:
				case 230:
				case 231:
				case 232:
				case 233:
				case 234:
				case 235:
				case 236:
				case 237:
				case 238:
				case 239:
				case 240:
				case 241:
				case 242:
				case 243:
				case 244:
				case 245:
				case 246:
				case 247:
				case 248:
				case 249:
				case 250:
				case 251:
				case 252:
				case 253:
				case 254:
				case byte.MaxValue:
					return (ushort)unchecked((sbyte)value);
				default:
					if (value >= 0 && value <= 127)
					{
						return value;
					}
					throw ThrowInvalidCode(value);
				}
			}
		}

		public uint ReadUInt32()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			checked
			{
				switch (value)
				{
				case 204:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value3));
					return value3;
				}
				case 208:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value2));
					return (uint)value2;
				}
				case 205:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ushort value4));
					return value4;
				}
				case 209:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out short value9));
					return (uint)value9;
				}
				case 206:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out uint value8));
					return value8;
				}
				case 210:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out int value7));
					return (uint)value7;
				}
				case 207:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ulong value6));
					return (uint)value6;
				}
				case 211:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out long value5));
					return (uint)value5;
				}
				case 224:
				case 225:
				case 226:
				case 227:
				case 228:
				case 229:
				case 230:
				case 231:
				case 232:
				case 233:
				case 234:
				case 235:
				case 236:
				case 237:
				case 238:
				case 239:
				case 240:
				case 241:
				case 242:
				case 243:
				case 244:
				case 245:
				case 246:
				case 247:
				case 248:
				case 249:
				case 250:
				case 251:
				case 252:
				case 253:
				case 254:
				case byte.MaxValue:
					return (uint)unchecked((sbyte)value);
				default:
					if (value >= 0 && value <= 127)
					{
						return value;
					}
					throw ThrowInvalidCode(value);
				}
			}
		}

		public ulong ReadUInt64()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			checked
			{
				switch (value)
				{
				case 204:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value3));
					return value3;
				}
				case 208:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value2));
					return (ulong)value2;
				}
				case 205:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ushort value4));
					return value4;
				}
				case 209:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out short value9));
					return (ulong)value9;
				}
				case 206:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out uint value8));
					return value8;
				}
				case 210:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out int value7));
					return (ulong)value7;
				}
				case 207:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ulong value6));
					return value6;
				}
				case 211:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out long value5));
					return (ulong)value5;
				}
				case 224:
				case 225:
				case 226:
				case 227:
				case 228:
				case 229:
				case 230:
				case 231:
				case 232:
				case 233:
				case 234:
				case 235:
				case 236:
				case 237:
				case 238:
				case 239:
				case 240:
				case 241:
				case 242:
				case 243:
				case 244:
				case 245:
				case 246:
				case 247:
				case 248:
				case 249:
				case 250:
				case 251:
				case 252:
				case 253:
				case 254:
				case byte.MaxValue:
					return (ulong)unchecked((sbyte)value);
				default:
					if (value >= 0 && value <= 127)
					{
						return value;
					}
					throw ThrowInvalidCode(value);
				}
			}
		}

		public sbyte ReadSByte()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			checked
			{
				switch (value)
				{
				case 204:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value3));
					return (sbyte)value3;
				}
				case 208:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value2));
					return value2;
				}
				case 205:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ushort value4));
					return (sbyte)value4;
				}
				case 209:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out short value9));
					return (sbyte)value9;
				}
				case 206:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out uint value8));
					return (sbyte)value8;
				}
				case 210:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out int value7));
					return (sbyte)value7;
				}
				case 207:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ulong value6));
					return (sbyte)value6;
				}
				case 211:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out long value5));
					return (sbyte)value5;
				}
				case 224:
				case 225:
				case 226:
				case 227:
				case 228:
				case 229:
				case 230:
				case 231:
				case 232:
				case 233:
				case 234:
				case 235:
				case 236:
				case 237:
				case 238:
				case 239:
				case 240:
				case 241:
				case 242:
				case 243:
				case 244:
				case 245:
				case 246:
				case 247:
				case 248:
				case 249:
				case 250:
				case 251:
				case 252:
				case 253:
				case 254:
				case byte.MaxValue:
					return unchecked((sbyte)value);
				default:
					if (value >= 0 && value <= 127)
					{
						return (sbyte)value;
					}
					throw ThrowInvalidCode(value);
				}
			}
		}

		public short ReadInt16()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			checked
			{
				switch (value)
				{
				case 204:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value3));
					return value3;
				}
				case 208:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value2));
					return value2;
				}
				case 205:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ushort value4));
					return (short)value4;
				}
				case 209:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out short value9));
					return value9;
				}
				case 206:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out uint value8));
					return (short)value8;
				}
				case 210:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out int value7));
					return (short)value7;
				}
				case 207:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ulong value6));
					return (short)value6;
				}
				case 211:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out long value5));
					return (short)value5;
				}
				case 224:
				case 225:
				case 226:
				case 227:
				case 228:
				case 229:
				case 230:
				case 231:
				case 232:
				case 233:
				case 234:
				case 235:
				case 236:
				case 237:
				case 238:
				case 239:
				case 240:
				case 241:
				case 242:
				case 243:
				case 244:
				case 245:
				case 246:
				case 247:
				case 248:
				case 249:
				case 250:
				case 251:
				case 252:
				case 253:
				case 254:
				case byte.MaxValue:
					return unchecked((sbyte)value);
				default:
					if (value >= 0 && value <= 127)
					{
						return value;
					}
					throw ThrowInvalidCode(value);
				}
			}
		}

		public int ReadInt32()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			checked
			{
				switch (value)
				{
				case 204:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value3));
					return value3;
				}
				case 208:
				{
					ThrowInsufficientBufferUnless(reader.TryRead(out var value2));
					return value2;
				}
				case 205:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ushort value4));
					return value4;
				}
				case 209:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out short value9));
					return value9;
				}
				case 206:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out uint value8));
					return (int)value8;
				}
				case 210:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out int value7));
					return value7;
				}
				case 207:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ulong value6));
					return (int)value6;
				}
				case 211:
				{
					ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out long value5));
					return (int)value5;
				}
				case 224:
				case 225:
				case 226:
				case 227:
				case 228:
				case 229:
				case 230:
				case 231:
				case 232:
				case 233:
				case 234:
				case 235:
				case 236:
				case 237:
				case 238:
				case 239:
				case 240:
				case 241:
				case 242:
				case 243:
				case 244:
				case 245:
				case 246:
				case 247:
				case 248:
				case 249:
				case 250:
				case 251:
				case 252:
				case 253:
				case 254:
				case byte.MaxValue:
					return unchecked((sbyte)value);
				default:
					if (value >= 0 && value <= 127)
					{
						return value;
					}
					throw ThrowInvalidCode(value);
				}
			}
		}

		public long ReadInt64()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			switch (value)
			{
			case 204:
			{
				ThrowInsufficientBufferUnless(reader.TryRead(out var value3));
				return value3;
			}
			case 208:
			{
				ThrowInsufficientBufferUnless(reader.TryRead(out var value2));
				return value2;
			}
			case 205:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ushort value4));
				return value4;
			}
			case 209:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out short value9));
				return value9;
			}
			case 206:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out uint value8));
				return value8;
			}
			case 210:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out int value7));
				return value7;
			}
			case 207:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ulong value6));
				return checked((long)value6);
			}
			case 211:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out long value5));
				return value5;
			}
			case 224:
			case 225:
			case 226:
			case 227:
			case 228:
			case 229:
			case 230:
			case 231:
			case 232:
			case 233:
			case 234:
			case 235:
			case 236:
			case 237:
			case 238:
			case 239:
			case 240:
			case 241:
			case 242:
			case 243:
			case 244:
			case 245:
			case 246:
			case 247:
			case 248:
			case 249:
			case 250:
			case 251:
			case 252:
			case 253:
			case 254:
			case byte.MaxValue:
				return (sbyte)value;
			default:
				if (value >= 0 && value <= 127)
				{
					return value;
				}
				throw ThrowInvalidCode(value);
			}
		}

		public MessagePackReader(ReadOnlyMemory<byte> memory)
		{
			this = default(MessagePackReader);
			reader = new SequenceReader<byte>(memory);
			Depth = 0;
		}

		public MessagePackReader(in ReadOnlySequence<byte> readOnlySequence)
		{
			this = default(MessagePackReader);
			reader = new SequenceReader<byte>(in readOnlySequence);
			Depth = 0;
		}

		public MessagePackReader Clone(in ReadOnlySequence<byte> readOnlySequence)
		{
			MessagePackReader result = new MessagePackReader(in readOnlySequence);
			result.CancellationToken = CancellationToken;
			result.Depth = Depth;
			return result;
		}

		public MessagePackReader CreatePeekReader()
		{
			return this;
		}

		public void Skip()
		{
			ThrowInsufficientBufferUnless(TrySkip());
		}

		internal bool TrySkip()
		{
			if (reader.Remaining == 0L)
			{
				return false;
			}
			byte nextCode = NextCode;
			int length;
			switch (nextCode)
			{
			case 192:
			case 194:
			case 195:
				return reader.TryAdvance(1L);
			case 204:
			case 208:
				return reader.TryAdvance(2L);
			case 205:
			case 209:
				return reader.TryAdvance(3L);
			case 202:
			case 206:
			case 210:
				return reader.TryAdvance(5L);
			case 203:
			case 207:
			case 211:
				return reader.TryAdvance(9L);
			case 222:
			case 223:
				return TrySkipNextMap();
			case 220:
			case 221:
				return TrySkipNextArray();
			case 217:
			case 218:
			case 219:
				if (TryGetStringLengthInBytes(out length))
				{
					return reader.TryAdvance(length);
				}
				return false;
			case 196:
			case 197:
			case 198:
				if (TryGetBytesLength(out length))
				{
					return reader.TryAdvance(length);
				}
				return false;
			case 199:
			case 200:
			case 201:
			case 212:
			case 213:
			case 214:
			case 215:
			case 216:
			{
				if (TryReadExtensionFormatHeader(out var extensionHeader))
				{
					return reader.TryAdvance(extensionHeader.Length);
				}
				return false;
			}
			default:
				if (nextCode < 0 || nextCode > 127)
				{
					break;
				}
				goto case 224;
			case 224:
			case 225:
			case 226:
			case 227:
			case 228:
			case 229:
			case 230:
			case 231:
			case 232:
			case 233:
			case 234:
			case 235:
			case 236:
			case 237:
			case 238:
			case 239:
			case 240:
			case 241:
			case 242:
			case 243:
			case 244:
			case 245:
			case 246:
			case 247:
			case 248:
			case 249:
			case 250:
			case 251:
			case 252:
			case 253:
			case 254:
			case byte.MaxValue:
				return reader.TryAdvance(1L);
			}
			if (nextCode >= 128 && nextCode <= 143)
			{
				return TrySkipNextMap();
			}
			if (nextCode >= 144 && nextCode <= 159)
			{
				return TrySkipNextArray();
			}
			if (nextCode >= 160 && nextCode <= 191)
			{
				if (TryGetStringLengthInBytes(out length))
				{
					return reader.TryAdvance(length);
				}
				return false;
			}
			throw ThrowInvalidCode(nextCode);
		}

		public Nil ReadNil()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			if (value != 192)
			{
				throw ThrowInvalidCode(value);
			}
			return Nil.Default;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool TryReadNil()
		{
			if (NextCode == 192)
			{
				reader.Advance(1L);
				return true;
			}
			return false;
		}

		public ReadOnlySequence<byte> ReadRaw(long length)
		{
			try
			{
				ReadOnlySequence<byte> result = reader.Sequence.Slice(reader.Position, length);
				reader.Advance(length);
				return result;
			}
			catch (ArgumentOutOfRangeException innerException)
			{
				throw ThrowNotEnoughBytesException(innerException);
			}
		}

		public ReadOnlySequence<byte> ReadRaw()
		{
			SequencePosition position = Position;
			Skip();
			return Sequence.Slice(position, Position);
		}

		public int ReadArrayHeader()
		{
			ThrowInsufficientBufferUnless(TryReadArrayHeader(out var count));
			ThrowInsufficientBufferUnless(reader.Remaining >= count);
			return count;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool TryReadArrayHeader(out int count)
		{
			count = -1;
			if (!reader.TryRead(out var value))
			{
				return false;
			}
			switch (value)
			{
			case 220:
			{
				if (!reader.TryReadBigEndian(out short value3))
				{
					return false;
				}
				count = (ushort)value3;
				break;
			}
			case 221:
			{
				if (!reader.TryReadBigEndian(out int value2))
				{
					return false;
				}
				count = value2;
				break;
			}
			case 144:
			case 145:
			case 146:
			case 147:
			case 148:
			case 149:
			case 150:
			case 151:
			case 152:
			case 153:
			case 154:
			case 155:
			case 156:
			case 157:
			case 158:
			case 159:
				count = value & 0xF;
				break;
			default:
				throw ThrowInvalidCode(value);
			}
			return true;
		}

		public int ReadMapHeader()
		{
			ThrowInsufficientBufferUnless(TryReadMapHeader(out var count));
			ThrowInsufficientBufferUnless(reader.Remaining >= checked(count * 2));
			return count;
		}

		public bool TryReadMapHeader(out int count)
		{
			count = -1;
			if (!reader.TryRead(out var value))
			{
				return false;
			}
			switch (value)
			{
			case 222:
			{
				if (!reader.TryReadBigEndian(out short value3))
				{
					return false;
				}
				count = (ushort)value3;
				break;
			}
			case 223:
			{
				if (!reader.TryReadBigEndian(out int value2))
				{
					return false;
				}
				count = value2;
				break;
			}
			case 128:
			case 129:
			case 130:
			case 131:
			case 132:
			case 133:
			case 134:
			case 135:
			case 136:
			case 137:
			case 138:
			case 139:
			case 140:
			case 141:
			case 142:
			case 143:
				count = checked((byte)(value & 0xF));
				break;
			default:
				throw ThrowInvalidCode(value);
			}
			return true;
		}

		public bool ReadBoolean()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			return value switch
			{
				195 => true, 
				194 => false, 
				_ => throw ThrowInvalidCode(value), 
			};
		}

		public char ReadChar()
		{
			return (char)ReadUInt16();
		}

		public float ReadSingle()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			switch (value)
			{
			case 202:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out float value3));
				return value3;
			}
			case 203:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out double value2));
				return (float)value2;
			}
			case 208:
			{
				ThrowInsufficientBufferUnless(reader.TryRead(out var value4));
				return value4;
			}
			case 209:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out short value11));
				return value11;
			}
			case 210:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out int value10));
				return value10;
			}
			case 211:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out long value9));
				return value9;
			}
			case 204:
			{
				ThrowInsufficientBufferUnless(reader.TryRead(out var value8));
				return (int)value8;
			}
			case 205:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ushort value7));
				return (int)value7;
			}
			case 206:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out uint value6));
				return value6;
			}
			case 207:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out ulong value5));
				return value5;
			}
			case 224:
			case 225:
			case 226:
			case 227:
			case 228:
			case 229:
			case 230:
			case 231:
			case 232:
			case 233:
			case 234:
			case 235:
			case 236:
			case 237:
			case 238:
			case 239:
			case 240:
			case 241:
			case 242:
			case 243:
			case 244:
			case 245:
			case 246:
			case 247:
			case 248:
			case 249:
			case 250:
			case 251:
			case 252:
			case 253:
			case 254:
			case byte.MaxValue:
				return (sbyte)value;
			default:
				if (value >= 0 && value <= 127)
				{
					return (int)value;
				}
				throw ThrowInvalidCode(value);
			}
		}

		public double ReadDouble()
		{
			ThrowInsufficientBufferUnless(reader.TryRead(out var value));
			byte value4;
			short value7;
			int value6;
			long value5;
			switch (value)
			{
			case 203:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out double value3));
				return value3;
			}
			case 202:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out float value2));
				return value2;
			}
			case 208:
				ThrowInsufficientBufferUnless(reader.TryRead(out value4));
				return (sbyte)value4;
			case 209:
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out value7));
				return value7;
			case 210:
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out value6));
				return value6;
			case 211:
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out value5));
				return value5;
			case 204:
				ThrowInsufficientBufferUnless(reader.TryRead(out value4));
				return (int)value4;
			case 205:
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out value7));
				return (int)(ushort)value7;
			case 206:
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out value6));
				return (uint)value6;
			case 207:
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out value5));
				return (ulong)value5;
			case 224:
			case 225:
			case 226:
			case 227:
			case 228:
			case 229:
			case 230:
			case 231:
			case 232:
			case 233:
			case 234:
			case 235:
			case 236:
			case 237:
			case 238:
			case 239:
			case 240:
			case 241:
			case 242:
			case 243:
			case 244:
			case 245:
			case 246:
			case 247:
			case 248:
			case 249:
			case 250:
			case 251:
			case 252:
			case 253:
			case 254:
			case byte.MaxValue:
				return (sbyte)value;
			default:
				if (value >= 0 && value <= 127)
				{
					return (int)value;
				}
				throw ThrowInvalidCode(value);
			}
		}

		public DateTime ReadDateTime()
		{
			return ReadDateTime(ReadExtensionFormatHeader());
		}

		public DateTime ReadDateTime(ExtensionHeader header)
		{
			if (header.TypeCode != -1)
			{
				throw new MessagePackSerializationException($"Extension TypeCode is invalid. typeCode: {header.TypeCode}");
			}
			int value;
			long value2;
			switch (header.Length)
			{
			case 4u:
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out value));
				return DateTimeConstants.UnixEpoch.AddSeconds((uint)value);
			case 8u:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out value2));
				long num2 = value2;
				long num;
				checked
				{
					num = (long)(unchecked((ulong)num2) >> 34);
				}
				ulong num3 = (ulong)num2 & 0x3FFFFFFFFuL;
				return DateTimeConstants.UnixEpoch.AddSeconds(num3).AddTicks(num / 100);
			}
			case 12u:
			{
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out value));
				long num = (uint)value;
				ThrowInsufficientBufferUnless(reader.TryReadBigEndian(out value2));
				return DateTimeConstants.UnixEpoch.AddSeconds(value2).AddTicks(num / 100);
			}
			default:
				throw new MessagePackSerializationException($"Length of extension was {header.Length}. Either 4 or 8 were expected.");
			}
		}

		public ReadOnlySequence<byte>? ReadBytes()
		{
			if (TryReadNil())
			{
				return null;
			}
			int bytesLength = GetBytesLength();
			ThrowInsufficientBufferUnless(reader.Remaining >= bytesLength);
			ReadOnlySequence<byte> value = reader.Sequence.Slice(reader.Position, bytesLength);
			reader.Advance(bytesLength);
			return value;
		}

		public ReadOnlySequence<byte>? ReadStringSequence()
		{
			if (TryReadNil())
			{
				return null;
			}
			int stringLengthInBytes = GetStringLengthInBytes();
			ThrowInsufficientBufferUnless(reader.Remaining >= stringLengthInBytes);
			ReadOnlySequence<byte> value = reader.Sequence.Slice(reader.Position, stringLengthInBytes);
			reader.Advance(stringLengthInBytes);
			return value;
		}

		public bool TryReadStringSpan(out ReadOnlySpan<byte> span)
		{
			if (IsNil)
			{
				span = default(ReadOnlySpan<byte>);
				return false;
			}
			long consumed = reader.Consumed;
			int stringLengthInBytes = GetStringLengthInBytes();
			ThrowInsufficientBufferUnless(reader.Remaining >= stringLengthInBytes);
			checked
			{
				int num = reader.CurrentSpanIndex + stringLengthInBytes;
				ReadOnlySpan<byte> currentSpan = reader.CurrentSpan;
				if (num <= currentSpan.Length)
				{
					currentSpan = reader.CurrentSpan;
					span = currentSpan.Slice(reader.CurrentSpanIndex, stringLengthInBytes);
					reader.Advance(stringLengthInBytes);
					return true;
				}
				reader.Rewind(reader.Consumed - consumed);
				span = default(ReadOnlySpan<byte>);
				return false;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public string? ReadString()
		{
			if (TryReadNil())
			{
				return null;
			}
			int stringLengthInBytes = GetStringLengthInBytes();
			ReadOnlySpan<byte> unreadSpan = reader.UnreadSpan;
			if (unreadSpan.Length >= stringLengthInBytes)
			{
				string @string = StringEncoding.UTF8.GetString(unreadSpan.Slice(0, stringLengthInBytes));
				reader.Advance(stringLengthInBytes);
				return @string;
			}
			return ReadStringSlow(stringLengthInBytes);
		}

		public ExtensionHeader ReadExtensionFormatHeader()
		{
			ThrowInsufficientBufferUnless(TryReadExtensionFormatHeader(out var extensionHeader));
			ThrowInsufficientBufferUnless(reader.Remaining >= extensionHeader.Length);
			return extensionHeader;
		}

		public bool TryReadExtensionFormatHeader(out ExtensionHeader extensionHeader)
		{
			extensionHeader = default(ExtensionHeader);
			if (!reader.TryRead(out var value))
			{
				return false;
			}
			uint length;
			switch (value)
			{
			case 212:
				length = 1u;
				break;
			case 213:
				length = 2u;
				break;
			case 214:
				length = 4u;
				break;
			case 215:
				length = 8u;
				break;
			case 216:
				length = 16u;
				break;
			case 199:
			{
				if (!reader.TryRead(out var value4))
				{
					return false;
				}
				length = value4;
				break;
			}
			case 200:
			{
				if (!reader.TryReadBigEndian(out short value3))
				{
					return false;
				}
				length = (ushort)value3;
				break;
			}
			case 201:
			{
				if (!reader.TryReadBigEndian(out int value2))
				{
					return false;
				}
				length = (uint)value2;
				break;
			}
			default:
				throw ThrowInvalidCode(value);
			}
			if (!reader.TryRead(out var value5))
			{
				return false;
			}
			extensionHeader = new ExtensionHeader((sbyte)value5, length);
			return true;
		}

		public ExtensionResult ReadExtensionFormat()
		{
			ExtensionHeader extensionHeader = ReadExtensionFormatHeader();
			try
			{
				ReadOnlySequence<byte> data = reader.Sequence.Slice(reader.Position, extensionHeader.Length);
				reader.Advance(extensionHeader.Length);
				return new ExtensionResult(extensionHeader.TypeCode, data);
			}
			catch (ArgumentOutOfRangeException innerException)
			{
				throw ThrowNotEnoughBytesException(innerException);
			}
		}

		private static EndOfStreamException ThrowNotEnoughBytesException()
		{
			throw new EndOfStreamException();
		}

		private static EndOfStreamException ThrowNotEnoughBytesException(Exception innerException)
		{
			throw new EndOfStreamException(new EndOfStreamException().Message, innerException);
		}

		[DoesNotReturn]
		private static Exception ThrowInvalidCode(byte code)
		{
			throw new MessagePackSerializationException($"Unexpected msgpack code {code} ({MessagePackCode.ToFormatName(code)}) encountered.");
		}

		private static void ThrowInsufficientBufferUnless(bool condition)
		{
			if (!condition)
			{
				ThrowNotEnoughBytesException();
			}
		}

		private int GetBytesLength()
		{
			ThrowInsufficientBufferUnless(TryGetBytesLength(out var length));
			return length;
		}

		private bool TryGetBytesLength(out int length)
		{
			if (!reader.TryRead(out var value))
			{
				length = 0;
				return false;
			}
			switch (value)
			{
			case 196:
			{
				if (reader.TryRead(out var value2))
				{
					length = value2;
					return true;
				}
				break;
			}
			case 197:
			case 218:
			{
				if (reader.TryReadBigEndian(out short value3))
				{
					length = (ushort)value3;
					return true;
				}
				break;
			}
			case 198:
			case 219:
				if (reader.TryReadBigEndian(out length))
				{
					return true;
				}
				break;
			case 160:
			case 161:
			case 162:
			case 163:
			case 164:
			case 165:
			case 166:
			case 167:
			case 168:
			case 169:
			case 170:
			case 171:
			case 172:
			case 173:
			case 174:
			case 175:
			case 176:
			case 177:
			case 178:
			case 179:
			case 180:
			case 181:
			case 182:
			case 183:
			case 184:
			case 185:
			case 186:
			case 187:
			case 188:
			case 189:
			case 190:
			case 191:
				length = value & 0x1F;
				return true;
			default:
				throw ThrowInvalidCode(value);
			}
			length = 0;
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private bool TryGetStringLengthInBytes(out int length)
		{
			if (!reader.TryRead(out var value))
			{
				length = 0;
				return false;
			}
			if (value >= 160 && value <= 191)
			{
				length = value & 0x1F;
				return true;
			}
			return TryGetStringLengthInBytesSlow(value, out length);
		}

		private int GetStringLengthInBytes()
		{
			ThrowInsufficientBufferUnless(TryGetStringLengthInBytes(out var length));
			return length;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private bool TryGetStringLengthInBytesSlow(byte code, out int length)
		{
			switch (code)
			{
			case 217:
			{
				if (reader.TryRead(out var value2))
				{
					length = value2;
					return true;
				}
				break;
			}
			case 218:
			{
				if (reader.TryReadBigEndian(out short value3))
				{
					length = (ushort)value3;
					return true;
				}
				break;
			}
			case 219:
			{
				if (reader.TryReadBigEndian(out int value))
				{
					length = value;
					return true;
				}
				break;
			}
			case 160:
			case 161:
			case 162:
			case 163:
			case 164:
			case 165:
			case 166:
			case 167:
			case 168:
			case 169:
			case 170:
			case 171:
			case 172:
			case 173:
			case 174:
			case 175:
			case 176:
			case 177:
			case 178:
			case 179:
			case 180:
			case 181:
			case 182:
			case 183:
			case 184:
			case 185:
			case 186:
			case 187:
			case 188:
			case 189:
			case 190:
			case 191:
				length = code & 0x1F;
				return true;
			default:
				throw ThrowInvalidCode(code);
			}
			length = 0;
			return false;
		}

		private string ReadStringSlow(int byteLength)
		{
			ThrowInsufficientBufferUnless(reader.Remaining >= byteLength);
			int maxCharCount = StringEncoding.UTF8.GetMaxCharCount(byteLength);
			char[] array = ArrayPool<char>.Shared.Rent(maxCharCount);
			Decoder decoder = StringEncoding.UTF8.GetDecoder();
			int num = byteLength;
			int num2 = 0;
			checked
			{
				while (num > 0)
				{
					int num3 = Math.Min(num, reader.UnreadSpan.Length);
					num -= num3;
					bool flush = num == 0;
					num2 += decoder.GetChars(reader.UnreadSpan.Slice(0, num3), array.AsSpan(num2), flush);
					reader.Advance(num3);
				}
				string result = new string(array, 0, num2);
				ArrayPool<char>.Shared.Return(array);
				return result;
			}
		}

		private bool TrySkipNextArray()
		{
			if (TryReadArrayHeader(out var count))
			{
				return TrySkip(count);
			}
			return false;
		}

		private bool TrySkipNextMap()
		{
			if (TryReadMapHeader(out var count))
			{
				return TrySkip(checked(count * 2));
			}
			return false;
		}

		private bool TrySkip(int count)
		{
			for (int i = 0; i < count; i = checked(i + 1))
			{
				if (!TrySkip())
				{
					return false;
				}
			}
			return true;
		}
	}
	public static class MessagePackSerializer
	{
		public static class Typeless
		{
			public static MessagePackSerializerOptions DefaultOptions { get; set; } = TypelessContractlessStandardResolver.Options;


			public static void Serialize(ref MessagePackWriter writer, object? obj, MessagePackSerializerOptions? options = null)
			{
				MessagePackSerializer.Serialize(ref writer, obj, options ?? DefaultOptions);
			}

			public static void Serialize(IBufferWriter<byte> writer, object? obj, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
			{
				MessagePackSerializer.Serialize(writer, obj, options ?? DefaultOptions, cancellationToken);
			}

			public static byte[] Serialize(object? obj, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
			{
				return MessagePackSerializer.Serialize(obj, options ?? DefaultOptions, cancellationToken);
			}

			public static void Serialize(Stream stream, object? obj, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
			{
				MessagePackSerializer.Serialize(stream, obj, options ?? DefaultOptions, cancellationToken);
			}

			public static Task SerializeAsync(Stream stream, object? obj, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
			{
				return MessagePackSerializer.SerializeAsync(stream, obj, options ?? DefaultOptions, cancellationToken);
			}

			public static object? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions? options = null)
			{
				return Deserialize<object>(ref reader, options ?? DefaultOptions);
			}

			public static object? Deserialize(in ReadOnlySequence<byte> byteSequence, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
			{
				return Deserialize<object>(in byteSequence, options ?? DefaultOptions, cancellationToken);
			}

			public static object? Deserialize(Stream stream, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
			{
				return Deserialize<object>(stream, options ?? DefaultOptions, cancellationToken);
			}

			public static object? Deserialize(Memory<byte> bytes, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
			{
				return Deserialize<object>(bytes, options ?? DefaultOptions, cancellationToken);
			}

			public static ValueTask<object?> DeserializeAsync(Stream stream, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
			{
				return DeserializeAsync<object>(stream, options ?? DefaultOptions, cancellationToken);
			}
		}

		private delegate int LZ4Transform(ReadOnlySpan<byte> input, Span<byte> output);

		private static class PrimitiveChecker<T>
		{
			public static readonly bool IsMessagePackFixedSizePrimitive;

			static PrimitiveChecker()
			{
				IsMessagePackFixedSizePrimitive = IsMessagePackFixedSizePrimitiveTypeHelper(typeof(T));
			}
		}

		private class CompiledMethods
		{
			internal delegate void MessagePackWriterSerialize(ref MessagePackWriter writer, object? value, MessagePackSerializerOptions? options);

			internal delegate object? MessagePackReaderDeserialize(ref MessagePackReader reader, MessagePackSerializerOptions? options);

			private const bool PreferInterpretation = false;

			internal readonly Func<object?, MessagePackSerializerOptions?, CancellationToken, byte[]> Serialize_T_Options;

			internal readonly Action<Stream, object?, MessagePackSerializerOptions?, CancellationToken> Serialize_Stream_T_Options_CancellationToken;

			internal readonly Func<Stream, object?, MessagePackSerializerOptions?, CancellationToken, Task> SerializeAsync_Stream_T_Options_CancellationToken;

			internal readonly MessagePackWriterSerialize Serialize_MessagePackWriter_T_Options;

			internal readonly Action<IBufferWriter<byte>, object?, MessagePackSerializerOptions?, CancellationToken> Serialize_IBufferWriter_T_Options_CancellationToken;

			internal readonly MessagePackReaderDeserialize Deserialize_MessagePackReader_Options;

			internal readonly Func<Stream, MessagePackSerializerOptions?, CancellationToken, object?> Deserialize_Stream_Options_CancellationToken;

			internal readonly Func<Stream, MessagePackSerializerOptions?, CancellationToken, ValueTask<object?>> DeserializeAsync_Stream_Options_CancellationToken;

			internal readonly Func<ReadOnlyMemory<byte>, MessagePackSerializerOptions?, CancellationToken, object?> Deserialize_ReadOnlyMemory_Options;

			internal readonly Func<ReadOnlySequence<byte>, MessagePackSerializerOptions?, CancellationToken, object?> Deserialize_ReadOnlySequence_Options_CancellationToken;

			internal CompiledMethods(Type type)
			{
				TypeInfo typeInfo = type.GetTypeInfo();
				MethodInfo method = GetMethod("Serialize", type, new Type[3]
				{
					null,
					typeof(MessagePackSerializerOptions),
					typeof(CancellationToken)
				});
				ParameterExpression parameterExpression = Expression.Parameter(typeof(object), "obj");
				ParameterExpression parameterExpression2 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options");
				ParameterExpression parameterExpression3 = Expression.Parameter(typeof(CancellationToken), "cancellationToken");
				Serialize_T_Options = Expression.Lambda<Func<object, MessagePackSerializerOptions, CancellationToken, byte[]>>(Expression.Call(null, method, typeInfo.IsValueType ? Expression.Unbox(parameterExpression, type) : Expression.Convert(parameterExpression, type), parameterExpression2, parameterExpression3), new ParameterExpression[3] { parameterExpression, parameterExpression2, parameterExpression3 }).Compile(preferInterpretation: false);
				MethodInfo method2 = GetMethod("Serialize", type, new Type[4]
				{
					typeof(Stream),
					null,
					typeof(MessagePackSerializerOptions),
					typeof(CancellationToken)
				});
				ParameterExpression parameterExpression4 = Expression.Parameter(typeof(Stream), "stream");
				ParameterExpression parameterExpression5 = Expression.Parameter(typeof(object), "obj");
				ParameterExpression parameterExpression6 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options");
				ParameterExpression parameterExpression7 = Expression.Parameter(typeof(CancellationToken), "cancellationToken");
				Action<Stream, object, MessagePackSerializerOptions, CancellationToken> serialize_Stream_T_Options_CancellationToken = Expression.Lambda<Action<Stream, object, MessagePackSerializerOptions, CancellationToken>>(Expression.Call(null, method2, parameterExpression4, typeInfo.IsValueType ? Expression.Unbox(parameterExpression5, type) : Expression.Convert(parameterExpression5, type), parameterExpression6, parameterExpression7), new ParameterExpression[4] { parameterExpression4, parameterExpression5, parameterExpression6, parameterExpression7 }).Compile(preferInterpretation: false);
				Serialize_Stream_T_Options_CancellationToken = serialize_Stream_T_Options_CancellationToken;
				MethodInfo method3 = GetMethod("SerializeAsync", type, new Type[4]
				{
					typeof(Stream),
					null,
					typeof(MessagePackSerializerOptions),
					typeof(CancellationToken)
				});
				ParameterExpression parameterExpression8 = Expression.Parameter(typeof(Stream), "stream");
				ParameterExpression parameterExpression9 = Expression.Parameter(typeof(object), "obj");
				ParameterExpression parameterExpression10 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options");
				ParameterExpression parameterExpression11 = Expression.Parameter(typeof(CancellationToken), "cancellationToken");
				Func<Stream, object, MessagePackSerializerOptions, CancellationToken, Task> serializeAsync_Stream_T_Options_CancellationToken = Expression.Lambda<Func<Stream, object, MessagePackSerializerOptions, CancellationToken, Task>>(Expression.Call(null, method3, parameterExpression8, typeInfo.IsValueType ? Expression.Unbox(parameterExpression9, type) : Expression.Convert(parameterExpression9, type), parameterExpression10, parameterExpression11), new ParameterExpression[4] { parameterExpression8, parameterExpression9, parameterExpression10, parameterExpression11 }).Compile(preferInterpretation: false);
				SerializeAsync_Stream_T_Options_CancellationToken = serializeAsync_Stream_T_Options_CancellationToken;
				MethodInfo method4 = GetMethod("Serialize", type, new Type[4]
				{
					typeof(IBufferWriter<byte>),
					null,
					typeof(MessagePackSerializerOptions),
					typeof(CancellationToken)
				});
				ParameterExpression parameterExpression12 = Expression.Parameter(typeof(IBufferWriter<byte>), "writer");
				ParameterExpression parameterExpression13 = Expression.Parameter(typeof(object), "obj");
				ParameterExpression parameterExpression14 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options");
				ParameterExpression parameterExpression15 = Expression.Parameter(typeof(CancellationToken), "cancellationToken");
				Action<IBufferWriter<byte>, object, MessagePackSerializerOptions, CancellationToken> serialize_IBufferWriter_T_Options_CancellationToken = Expression.Lambda<Action<IBufferWriter<byte>, object, MessagePackSerializerOptions, CancellationToken>>(Expression.Call(null, method4, parameterExpression12, typeInfo.IsValueType ? Expression.Unbox(parameterExpression13, type) : Expression.Convert(parameterExpression13, type), parameterExpression14, parameterExpression15), new ParameterExpression[4] { parameterExpression12, parameterExpression13, parameterExpression14, parameterExpression15 }).Compile(preferInterpretation: false);
				Serialize_IBufferWriter_T_Options_CancellationToken = serialize_IBufferWriter_T_Options_CancellationToken;
				MethodInfo method5 = GetMethod("SerializeSemiGeneric", type, new Type[3]
				{
					typeof(MessagePackWriter).MakeByRefType(),
					typeof(object),
					typeof(MessagePackSerializerOptions)
				});
				Serialize_MessagePackWriter_T_Options = (MessagePackWriterSerialize)method5.CreateDelegate(typeof(MessagePackWriterSerialize));
				MethodInfo method6 = GetMethod("DeserializeSemiGeneric", type, new Type[2]
				{
					typeof(MessagePackReader).MakeByRefType(),
					typeof(MessagePackSerializerOptions)
				});
				Deserialize_MessagePackReader_Options = (MessagePackReaderDeserialize)method6.CreateDelegate(typeof(MessagePackReaderDeserialize));
				MethodInfo method7 = GetMethod("Deserialize", type, new Type[3]
				{
					typeof(Stream),
					typeof(MessagePackSerializerOptions),
					typeof(CancellationToken)
				});
				ParameterExpression parameterExpression16 = Expression.Parameter(typeof(Stream), "stream");
				ParameterExpression parameterExpression17 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options");
				ParameterExpression parameterExpression18 = Expression.Parameter(typeof(CancellationToken), "cancellationToken");
				Func<Stream, MessagePackSerializerOptions, CancellationToken, object> deserialize_Stream_Options_CancellationToken = Expression.Lambda<Func<Stream, MessagePackSerializerOptions, CancellationToken, object>>(Expression.Convert(Expression.Call(null, method7, parameterExpression16, parameterExpression17, parameterExpression18), typeof(object)), new ParameterExpression[3] { parameterExpression16, parameterExpression17, parameterExpression18 }).Compile(preferInterpretation: false);
				Deserialize_Stream_Options_CancellationToken = deserialize_Stream_Options_CancellationToken;
				MethodInfo method8 = GetMethod("DeserializeObjectAsync", type, new Type[3]
				{
					typeof(Stream),
					typeof(MessagePackSerializerOptions),
					typeof(CancellationToken)
				});
				ParameterExpression parameterExpression19 = Expression.Parameter(typeof(Stream), "stream");
				ParameterExpression parameterExpression20 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options");
				ParameterExpression parameterExpression21 = Expression.Parameter(typeof(CancellationToken), "cancellationToken");
				Func<Stream, MessagePackSerializerOptions, CancellationToken, ValueTask<object>> deserializeAsync_Stream_Options_CancellationToken = Expression.Lambda<Func<Stream, MessagePackSerializerOptions, CancellationToken, ValueTask<object>>>(Expression.Convert(Expression.Call(null, method8, parameterExpression19, parameterExpression20, parameterExpression21), typeof(ValueTask<object>)), new ParameterExpression[3] { parameterExpression19, parameterExpression20, parameterExpression21 }).Compile(preferInterpretation: false);
				DeserializeAsync_Stream_Options_CancellationToken = deserializeAsync_Stream_Options_CancellationToken;
				MethodInfo method9 = GetMethod("Deserialize", type, new Type[3]
				{
					typeof(ReadOnlyMemory<byte>),
					typeof(MessagePackSerializerOptions),
					typeof(CancellationToken)
				});
				ParameterExpression parameterExpression22 = Expression.Parameter(typeof(ReadOnlyMemory<byte>), "bytes");
				ParameterExpression parameterExpression23 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options");
				ParameterExpression parameterExpression24 = Expression.Parameter(typeof(CancellationToken), "cancellationToken");
				Func<ReadOnlyMemory<byte>, MessagePackSerializerOptions, CancellationToken, object> deserialize_ReadOnlyMemory_Options = Expression.Lambda<Func<ReadOnlyMemory<byte>, MessagePackSerializerOptions, CancellationToken, object>>(Expression.Convert(Expression.Call(null, method9, parameterExpression22, parameterExpression23, parameterExpression24), typeof(object)), new ParameterExpression[3] { parameterExpression22, parameterExpression23, parameterExpression24 }).Compile(preferInterpretation: false);
				Deserialize_ReadOnlyMemory_Options = deserialize_ReadOnlyMemory_Options;
				MethodInfo method10 = GetMethod("Deserialize", type, new Type[3]
				{
					typeof(ReadOnlySequence<byte>).MakeByRefType(),
					typeof(MessagePackSerializerOptions),
					typeof(CancellationToken)
				});
				ParameterExpression parameterExpression25 = Expression.Parameter(typeof(ReadOnlySequence<byte>), "bytes");
				ParameterExpression parameterExpression26 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options");
				ParameterExpression parameterExpression27 = Expression.Parameter(typeof(CancellationToken), "cancellationToken");
				Func<ReadOnlySequence<byte>, MessagePackSerializerOptions, CancellationToken, object> deserialize_ReadOnlySequence_Options_CancellationToken = Expression.Lambda<Func<ReadOnlySequence<byte>, MessagePackSerializerOptions, CancellationToken, object>>(Expression.Convert(Expression.Call(null, method10, parameterExpression25, parameterExpression26, parameterExpression27), typeof(object)), new ParameterExpression[3] { parameterExpression25, parameterExpression26, parameterExpression27 }).Compile(preferInterpretation: false);
				Deserialize_ReadOnlySequence_Options_CancellationToken = deserialize_ReadOnlySequence_Options_CancellationToken;
			}

			private static void ThrowRefStructNotSupported()
			{
				throw new NotSupportedException("MessagePackWriter/Reader overload is not supported in MessagePackSerializer.NonGenerics.");
			}

			private static MethodInfo GetMethod(string methodName, Type type, Type?[] parameters)
			{
				string methodName2 = methodName;
				Type?[] parameters2 = parameters;
				return typeof(MessagePackSerializer).GetRuntimeMethods().Single(delegate(MethodInfo x)
				{
					if (methodName2 != x.Name)
					{
						return false;
					}
					ParameterInfo[] parameters3 = x.GetParameters();
					if (parameters3.Length != parameters2.Length)
					{
						return false;
					}
					for (int i = 0; i < parameters3.Length; i = checked(i + 1))
					{
						if ((!(parameters2[i] == null) || !parameters3[i].ParameterType.IsGenericParameter) && parameters3[i].ParameterType != parameters2[i])
						{
							return false;
						}
					}
					return true;
				}).MakeGenericMethod(type);
			}
		}

		private static MessagePackSerializerOptions? defaultOptions;

		[ThreadStatic]
		private static byte[]? scratchArray;

		private static readonly LZ4Transform LZ4CodecEncode;

		private static readonly LZ4Transform LZ4CodecDecode;

		private static readonly Func<Type, CompiledMethods> CreateCompiledMethods;

		private static readonly ThreadsafeTypeKeyHashTable<CompiledMethods> Serializes;

		public static MessagePackSerializerOptions DefaultOptions
		{
			get
			{
				return defaultOptions ?? (defaultOptions = MessagePackSerializerOptions.Standard);
			}
			set
			{
				defaultOptions = value;
			}
		}

		public static void Serialize<T>(IBufferWriter<byte> writer, T value, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			MessagePackWriter messagePackWriter = new MessagePackWriter(writer);
			messagePackWriter.CancellationToken = cancellationToken;
			MessagePackWriter writer2 = messagePackWriter;
			Serialize(ref writer2, value, options);
			writer2.Flush();
		}

		public static void Serialize<T>(ref MessagePackWriter writer, T value, MessagePackSerializerOptions? options = null)
		{
			options = options ?? DefaultOptions;
			bool oldSpec = writer.OldSpec;
			if (options.OldSpec.HasValue)
			{
				writer.OldSpec = options.OldSpec.Value;
			}
			try
			{
				if (options.Compression.IsCompression() && !PrimitiveChecker<T>.IsMessagePackFixedSizePrimitive)
				{
					using (SequencePool.Rental rental = options.SequencePool.Rent())
					{
						Sequence<byte> value2 = rental.Value;
						MessagePackWriter writer2 = writer.Clone(value2);
						options.Resolver.GetFormatterWithVerify<T>().Serialize(ref writer2, value, options);
						writer2.Flush();
						ReadOnlySequence<byte> msgpackUncompressedData = value2;
						ToLZ4BinaryCore(in msgpackUncompressedData, ref writer, options.Compression, options.CompressionMinLength);
						return;
					}
				}
				options.Resolver.GetFormatterWithVerify<T>().Serialize(ref writer, value, options);
			}
			catch (Exception inner)
			{
				throw new MessagePackSerializationException("Failed to serialize " + typeof(T).FullName + " value.", inner);
			}
			finally
			{
				writer.OldSpec = oldSpec;
			}
		}

		public static byte[] Serialize<T>(T value, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			byte[] array = scratchArray;
			if (array == null)
			{
				array = (scratchArray = new byte[65536]);
			}
			options = options ?? DefaultOptions;
			MessagePackWriter messagePackWriter = new MessagePackWriter(options.SequencePool, array);
			messagePackWriter.CancellationToken = cancellationToken;
			MessagePackWriter writer = messagePackWriter;
			Serialize(ref writer, value, options);
			return writer.FlushAndGetArray();
		}

		public static void Serialize<T>(Stream stream, T value, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			options = options ?? DefaultOptions;
			cancellationToken.ThrowIfCancellationRequested();
			using SequencePool.Rental rental = options.SequencePool.Rent();
			Serialize(rental.Value, value, options, cancellationToken);
			try
			{
				ReadOnlySequence<byte>.Enumerator enumerator = rental.Value.AsReadOnlySequence.GetEnumerator();
				while (enumerator.MoveNext())
				{
					ReadOnlyMemory<byte> current = enumerator.Current;
					cancellationToken.ThrowIfCancellationRequested();
					stream.Write(current.Span);
				}
			}
			catch (Exception inner)
			{
				throw new MessagePackSerializationException("Error occurred while writing the serialized data to the stream.", inner);
			}
		}

		public static async Task SerializeAsync<T>(Stream stream, T value, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			options = options ?? DefaultOptions;
			cancellationToken.ThrowIfCancellationRequested();
			using SequencePool.Rental sequenceRental = options.SequencePool.Rent();
			Serialize(sequenceRental.Value, value, options, cancellationToken);
			try
			{
				ReadOnlySequence<byte>.Enumerator enumerator = sequenceRental.Value.AsReadOnlySequence.GetEnumerator();
				while (enumerator.MoveNext())
				{
					ReadOnlyMemory<byte> current = enumerator.Current;
					cancellationToken.ThrowIfCancellationRequested();
					await stream.WriteAsync(current, cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
				}
			}
			catch (Exception inner)
			{
				throw new MessagePackSerializationException("Error occurred while writing the serialized data to the stream.", inner);
			}
		}

		public static T Deserialize<T>(in ReadOnlySequence<byte> byteSequence, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			MessagePackReader messagePackReader = new MessagePackReader(in byteSequence);
			messagePackReader.CancellationToken = cancellationToken;
			MessagePackReader reader = messagePackReader;
			return Deserialize<T>(ref reader, options);
		}

		public static T Deserialize<T>(ref MessagePackReader reader, MessagePackSerializerOptions? options = null)
		{
			options = options ?? DefaultOptions;
			try
			{
				if (options.Compression.IsCompression())
				{
					using (SequencePool.Rental rental = options.SequencePool.Rent())
					{
						Sequence<byte> value = rental.Value;
						if (TryDecompress(ref reader, value))
						{
							ReadOnlySequence<byte> readOnlySequence = value.AsReadOnlySequence;
							MessagePackReader reader2 = reader.Clone(in readOnlySequence);
							return options.Resolver.GetFormatterWithVerify<T>().Deserialize(ref reader2, options);
						}
						return options.Resolver.GetFormatterWithVerify<T>().Deserialize(ref reader, options);
					}
				}
				return options.Resolver.GetFormatterWithVerify<T>().Deserialize(ref reader, options);
			}
			catch (Exception inner)
			{
				throw new MessagePackSerializationException("Failed to deserialize " + typeof(T).FullName + " value.", inner);
			}
		}

		public static T Deserialize<T>(ReadOnlyMemory<byte> buffer, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			MessagePackReader messagePackReader = new MessagePackReader(buffer);
			messagePackReader.CancellationToken = cancellationToken;
			MessagePackReader reader = messagePackReader;
			return Deserialize<T>(ref reader, options);
		}

		public static T Deserialize<T>(ReadOnlyMemory<byte> buffer, out int bytesRead, CancellationToken cancellationToken = default(CancellationToken))
		{
			return Deserialize<T>(buffer, null, out bytesRead, cancellationToken);
		}

		public static T Deserialize<T>(ReadOnlyMemory<byte> buffer, MessagePackSerializerOptions? options, out int bytesRead, CancellationToken cancellationToken = default(CancellationToken))
		{
			MessagePackReader messagePackReader = new MessagePackReader(buffer);
			messagePackReader.CancellationToken = cancellationToken;
			MessagePackReader reader = messagePackReader;
			T result = Deserialize<T>(ref reader, options);
			bytesRead = buffer.Slice(0, checked((int)reader.Consumed)).Length;
			return result;
		}

		public static T Deserialize<T>(Stream stream, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			options = options ?? DefaultOptions;
			if (TryDeserializeFromMemoryStream<T>(stream, options, cancellationToken, out var result))
			{
				return result;
			}
			using SequencePool.Rental rental = options.SequencePool.Rent();
			Sequence<byte> value = rental.Value;
			try
			{
				int num;
				do
				{
					cancellationToken.ThrowIfCancellationRequested();
					Span<byte> span = value.GetSpan(stream.CanSeek ? checked((int)Math.Min(options.SuggestedContiguousMemorySize, stream.Length - stream.Position)) : 0);
					num = stream.Read(span);
					value.Advance(num);
				}
				while (num > 0);
			}
			catch (Exception inner)
			{
				throw new MessagePackSerializationException("Error occurred while reading from the stream.", inner);
			}
			return DeserializeFromSequenceAndRewindStreamIfPossible<T>(stream, options, value, cancellationToken);
		}

		public static async ValueTask<T> DeserializeAsync<T>(Stream stream, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			if (options == null)
			{
				options = DefaultOptions;
			}
			if (TryDeserializeFromMemoryStream<T>(stream, options, cancellationToken, out var result))
			{
				return result;
			}
			using SequencePool.Rental sequenceRental = options.SequencePool.Rent();
			Sequence<byte> sequence = sequenceRental.Value;
			try
			{
				int num;
				do
				{
					Memory<byte> memory = sequence.GetMemory(stream.CanSeek ? checked((int)Math.Min(options.SuggestedContiguousMemorySize, stream.Length - stream.Position)) : 0);
					num = await stream.ReadAsync(memory, cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
					sequence.Advance(num);
				}
				while (num > 0);
			}
			catch (Exception inner)
			{
				throw new MessagePackSerializationException("Error occurred while reading from the stream.", inner);
			}
			return DeserializeFromSequenceAndRewindStreamIfPossible<T>(stream, options, sequence, cancellationToken);
		}

		private static bool TryDeserializeFromMemoryStream<T>(Stream stream, MessagePackSerializerOptions options, CancellationToken cancellationToken, [MaybeNullWhen(false)] out T result)
		{
			cancellationToken.ThrowIfCancellationRequested();
			if (stream is MemoryStream memoryStream && memoryStream.TryGetBuffer(out var buffer))
			{
				result = Deserialize<T>(buffer.AsMemory(checked((int)memoryStream.Position)), options, out var bytesRead, cancellationToken);
				memoryStream.Seek(bytesRead, SeekOrigin.Current);
				return true;
			}
			result = default(T);
			return false;
		}

		private static T DeserializeFromSequenceAndRewindStreamIfPossible<T>(Stream streamToRewind, MessagePackSerializerOptions? options, ReadOnlySequence<byte> sequence, CancellationToken cancellationToken)
		{
			if (streamToRewind == null)
			{
				throw new ArgumentNullException("streamToRewind");
			}
			MessagePackReader messagePackReader = new MessagePackReader(in sequence);
			messagePackReader.CancellationToken = cancellationToken;
			MessagePackReader reader = messagePackReader;
			T result = Deserialize<T>(ref reader, options);
			checked
			{
				if (streamToRewind.CanSeek && !reader.End)
				{
					int num = (int)reader.Sequence.Slice(reader.Position).Length;
					streamToRewind.Seek(-num, SeekOrigin.Current);
				}
				return result;
			}
		}

		private static int LZ4Operation(in ReadOnlySequence<byte> input, Span<byte> output, LZ4Transform lz4Operation)
		{
			byte[] array = null;
			checked
			{
				ReadOnlySpan<byte> input2;
				if (input.IsSingleSegment)
				{
					input2 = input.First.Span;
				}
				else
				{
					array = ArrayPool<byte>.Shared.Rent((int)input.Length);
					BuffersExtensions.CopyTo(in input, array);
					input2 = array.AsSpan(0, (int)input.Length);
				}
				try
				{
					return lz4Operation(input2, output);
				}
				finally
				{
					if (array != null)
					{
						ArrayPool<byte>.Shared.Return(array);
					}
				}
			}
		}

		private static bool TryDecompress(ref MessagePackReader reader, IBufferWriter<byte> writer)
		{
			checked
			{
				if (!reader.End)
				{
					Span<byte> span;
					if (reader.NextMessagePackType == MessagePackType.Extension && reader.CreatePeekReader().ReadExtensionFormatHeader().TypeCode == 99)
					{
						ReadOnlySequence<byte> readOnlySequence = reader.ReadExtensionFormat().Data;
						MessagePackReader messagePackReader = new MessagePackReader(in readOnlySequence);
						int num = messagePackReader.ReadInt32();
						readOnlySequence = messagePackReader.Sequence;
						ReadOnlySequence<byte> input = readOnlySequence.Slice(messagePackReader.Position);
						span = writer.GetSpan(num);
						Span<byte> output = span.Slice(0, num);
						int count = LZ4Operation(in input, output, LZ4CodecDecode);
						writer.Advance(count);
						return true;
					}
					if (reader.NextMessagePackType == MessagePackType.Array)
					{
						MessagePackReader messagePackReader2 = reader.CreatePeekReader();
						int num2 = messagePackReader2.ReadArrayHeader();
						if (num2 != 0 && messagePackReader2.NextMessagePackType == MessagePackType.Extension && messagePackReader2.ReadExtensionFormatHeader().TypeCode == 98)
						{
							reader = messagePackReader2;
							int num3 = num2 - 1;
							int[] array = ArrayPool<int>.Shared.Rent(num3);
							try
							{
								for (int i = 0; i < num3; i++)
								{
									array[i] = reader.ReadInt32();
								}
								for (int j = 0; j < num3; j++)
								{
									int num4 = array[j];
									ReadOnlySequence<byte> input2 = reader.ReadBytes() ?? throw MessagePackSerializationException.ThrowUnexpectedNilWhileDeserializing<ReadOnlySequence<byte>>();
									span = writer.GetSpan(num4);
									Span<byte> output2 = span.Slice(0, num4);
									int count2 = LZ4Operation(in input2, output2, LZ4CodecDecode);
									writer.Advance(count2);
								}
								return true;
							}
							finally
							{
								ArrayPool<int>.Shared.Return(array);
							}
						}
					}
				}
				return false;
			}
		}

		private static void ToLZ4BinaryCore(in ReadOnlySequence<byte> msgpackUncompressedData, ref MessagePackWriter writer, MessagePackCompression compression, int minCompressionSize)
		{
			if (msgpackUncompressedData.Length < minCompressionSize)
			{
				writer.WriteRaw(in msgpackUncompressedData);
				return;
			}
			checked
			{
				switch (compression)
				{
				case MessagePackCompression.Lz4Block:
				{
					int minimumLength = LZ4Codec.MaximumOutputLength((int)msgpackUncompressedData.Length);
					byte[] array = ArrayPool<byte>.Shared.Rent(minimumLength);
					try
					{
						int num5 = LZ4Operation(in msgpackUncompressedData, array, LZ4CodecEncode);
						writer.WriteExtensionFormatHeader(new ExtensionHeader(99, 5 + (uint)num5));
						writer.WriteInt32((int)msgpackUncompressedData.Length);
						writer.WriteRaw(array.AsSpan(0, num5));
						break;
					}
					finally
					{
						ArrayPool<byte>.Shared.Return(array);
					}
				}
				case MessagePackCompression.Lz4BlockArray:
				{
					int num = 0;
					int num2 = 0;
					ReadOnlySequence<byte>.Enumerator enumerator = msgpackUncompressedData.GetEnumerator();
					while (enumerator.MoveNext())
					{
						ReadOnlyMemory<byte> current = enumerator.Current;
						num++;
						num2 += GetUInt32WriteSize((uint)current.Length);
					}
					writer.WriteArrayHeader(num + 1);
					writer.WriteExtensionFormatHeader(new ExtensionHeader(98, num2));
					enumerator = msgpackUncompressedData.GetEnumerator();
					while (enumerator.MoveNext())
					{
						writer.Write(enumerator.Current.Length);
					}
					enumerator = msgpackUncompressedData.GetEnumerator();
					while (enumerator.MoveNext())
					{
						ReadOnlyMemory<byte> current2 = enumerator.Current;
						int num3 = LZ4Codec.MaximumOutputLength(current2.Length);
						Span<byte> span = writer.GetSpan(num3 + 5);
						int num4 = LZ4Codec.Encode(current2.Span, span.Slice(5, span.Length - 5));
						WriteBin32Header((uint)num4, span);
						writer.Advance(num4 + 5);
					}
					break;
				}
				default:
					throw new ArgumentException("Invalid MessagePackCompression Code. Code:" + compression);
				}
			}
		}

		private static int GetUInt32WriteSize(uint value)
		{
			if (value <= 127)
			{
				return 1;
			}
			if (value <= 255)
			{
				return 2;
			}
			if (value <= 65535)
			{
				return 3;
			}
			return 5;
		}

		private static void WriteBin32Header(uint value, Span<byte> span)
		{
			span[0] = 198;
			span[4] = (byte)value;
			span[3] = (byte)(value >> 8);
			span[2] = (byte)(value >> 16);
			span[1] = (byte)(value >> 24);
		}

		private static bool IsMessagePackFixedSizePrimitiveTypeHelper(Type type)
		{
			if (!(type == typeof(short)) && !(type == typeof(int)) && !(type == typeof(long)) && !(type == typeof(ushort)) && !(type == typeof(uint)) && !(type == typeof(ulong)) && !(type == typeof(float)) && !(type == typeof(double)) && !(type == typeof(bool)) && !(type == typeof(byte)) && !(type == typeof(sbyte)))
			{
				return type == typeof(char);
			}
			return true;
		}

		public static void SerializeToJson<T>(TextWriter textWriter, T obj, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			options = options ?? DefaultOptions;
			using SequencePool.Rental rental = options.SequencePool.Rent();
			MessagePackWriter messagePackWriter = new MessagePackWriter(rental.Value);
			messagePackWriter.CancellationToken = cancellationToken;
			MessagePackWriter writer = messagePackWriter;
			Serialize(ref writer, obj, options);
			writer.Flush();
			ReadOnlySequence<byte> readOnlySequence = rental.Value;
			MessagePackReader messagePackReader = new MessagePackReader(in readOnlySequence);
			messagePackReader.CancellationToken = cancellationToken;
			MessagePackReader reader = messagePackReader;
			ConvertToJson(ref reader, textWriter, options);
		}

		public static string SerializeToJson<T>(T obj, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			StringWriter stringWriter = new StringWriter();
			SerializeToJson(stringWriter, obj, options, cancellationToken);
			return stringWriter.ToString();
		}

		public static string ConvertToJson(ReadOnlyMemory<byte> bytes, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			ReadOnlySequence<byte> bytes2 = new ReadOnlySequence<byte>(bytes);
			return ConvertToJson(in bytes2, options, cancellationToken);
		}

		public static string ConvertToJson(in ReadOnlySequence<byte> bytes, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			StringWriter stringWriter = new StringWriter();
			MessagePackReader messagePackReader = new MessagePackReader(in bytes);
			messagePackReader.CancellationToken = cancellationToken;
			MessagePackReader reader = messagePackReader;
			ConvertToJson(ref reader, stringWriter, options);
			return stringWriter.ToString();
		}

		public static void ConvertToJson(ref MessagePackReader reader, TextWriter jsonWriter, MessagePackSerializerOptions? options = null)
		{
			if (reader.End)
			{
				return;
			}
			options = options ?? DefaultOptions;
			try
			{
				if (options.Compression.IsCompression())
				{
					using (SequencePool.Rental rental = options.SequencePool.Rent())
					{
						if (TryDecompress(ref reader, rental.Value))
						{
							ReadOnlySequence<byte> readOnlySequence = rental.Value;
							MessagePackReader messagePackReader = new MessagePackReader(in readOnlySequence);
							messagePackReader.CancellationToken = reader.CancellationToken;
							MessagePackReader reader2 = messagePackReader;
							if (!reader2.End)
							{
								ToJsonCore(ref reader2, jsonWriter, options);
							}
						}
						else
						{
							ToJsonCore(ref reader, jsonWriter, options);
						}
						return;
					}
				}
				ToJsonCore(ref reader, jsonWriter, options);
			}
			catch (Exception inner)
			{
				throw new MessagePackSerializationException("Error occurred while translating msgpack to JSON.", inner);
			}
		}

		public static void ConvertFromJson(string str, ref MessagePackWriter writer, MessagePackSerializerOptions? options = null)
		{
			using StringReader reader = new StringReader(str);
			ConvertFromJson(reader, ref writer, options);
		}

		public static byte[] ConvertFromJson(string str, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			options = options ?? DefaultOptions;
			using SequencePool.Rental rental = options.SequencePool.Rent();
			MessagePackWriter messagePackWriter = new MessagePackWriter(rental.Value);
			messagePackWriter.CancellationToken = cancellationToken;
			MessagePackWriter writer = messagePackWriter;
			using (StringReader reader = new StringReader(str))
			{
				ConvertFromJson(reader, ref writer, options);
			}
			writer.Flush();
			ReadOnlySequence<byte> sequence = rental.Value.AsReadOnlySequence;
			return BuffersExtensions.ToArray(in sequence);
		}

		public static void ConvertFromJson(TextReader reader, ref MessagePackWriter writer, MessagePackSerializerOptions? options = null)
		{
			options = options ?? DefaultOptions;
			if (options.Compression.IsCompression())
			{
				using (SequencePool.Rental rental = options.SequencePool.Rent())
				{
					MessagePackWriter writer2 = writer.Clone(rental.Value);
					using (TinyJsonReader jr = new TinyJsonReader(reader, disposeInnerReader: false))
					{
						FromJsonCore(jr, ref writer2, options);
					}
					writer2.Flush();
					ReadOnlySequence<byte> msgpackUncompressedData = rental.Value;
					ToLZ4BinaryCore(in msgpackUncompressedData, ref writer, options.Compression, options.CompressionMinLength);
					return;
				}
			}
			using TinyJsonReader jr2 = new TinyJsonReader(reader, disposeInnerReader: false);
			FromJsonCore(jr2, ref writer, options);
		}

		private static uint FromJsonCore(TinyJsonReader jr, ref MessagePackWriter writer, MessagePackSerializerOptions options)
		{
			uint num = 0u;
			checked
			{
				while (jr.Read())
				{
					switch (jr.TokenType)
					{
					case TinyJsonToken.StartObject:
					{
						using (SequencePool.Rental rental2 = options.SequencePool.Rent())
						{
							MessagePackWriter writer3 = writer.Clone(rental2.Value);
							uint num2 = FromJsonCore(jr, ref writer3, options);
							writer3.Flush();
							num2 = unchecked(num2 / 2);
							writer.WriteMapHeader(num2);
							ReadOnlySequence<byte> rawMessagePackBlock = rental2.Value;
							writer.WriteRaw(in rawMessagePackBlock);
						}
						num++;
						break;
					}
					case TinyJsonToken.EndObject:
						return num;
					case TinyJsonToken.StartArray:
					{
						using (SequencePool.Rental rental = options.SequencePool.Rent())
						{
							MessagePackWriter writer2 = writer.Clone(rental.Value);
							uint count = FromJsonCore(jr, ref writer2, options);
							writer2.Flush();
							writer.WriteArrayHeader(count);
							ReadOnlySequence<byte> rawMessagePackBlock = rental.Value;
							writer.WriteRaw(in rawMessagePackBlock);
						}
						num++;
						break;
					}
					case TinyJsonToken.EndArray:
						return num;
					case TinyJsonToken.Number:
						switch (jr.ValueType)
						{
						case ValueType.Double:
							writer.Write(jr.DoubleValue);
							break;
						case ValueType.Long:
							writer.Write(jr.LongValue);
							break;
						case ValueType.ULong:
							writer.Write(jr.ULongValue);
							break;
						case ValueType.Decimal:
							DecimalFormatter.Instance.Serialize(ref writer, jr.DecimalValue, options);
							break;
						}
						num++;
						break;
					case TinyJsonToken.String:
						writer.Write(jr.StringValue);
						num++;
						break;
					case TinyJsonToken.True:
						writer.Write(value: true);
						num++;
						break;
					case TinyJsonToken.False:
						writer.Write(value: false);
						num++;
						break;
					case TinyJsonToken.Null:
						writer.WriteNil();
						num++;
						break;
					}
				}
				return num;
			}
		}

		private static void ToJsonCore(ref MessagePackReader reader, TextWriter writer, MessagePackSerializerOptions options)
		{
			checked
			{
				switch (reader.NextMessagePackType)
				{
				case MessagePackType.Integer:
					if (MessagePackCode.IsSignedInteger(reader.NextCode))
					{
						writer.Write(reader.ReadInt64().ToString(CultureInfo.InvariantCulture));
					}
					else
					{
						writer.Write(reader.ReadUInt64().ToString(CultureInfo.InvariantCulture));
					}
					break;
				case MessagePackType.Boolean:
					writer.Write(reader.ReadBoolean() ? "true" : "false");
					break;
				case MessagePackType.Float:
					if (reader.NextCode == 202)
					{
						writer.Write(reader.ReadSingle().ToString(CultureInfo.InvariantCulture));
					}
					else
					{
						writer.Write(reader.ReadDouble().ToString(CultureInfo.InvariantCulture));
					}
					break;
				case MessagePackType.String:
					WriteJsonString(reader.ReadString(), writer);
					break;
				case MessagePackType.Binary:
				{
					ArraySegment<byte> arraySegment = ByteArraySegmentFormatter.Instance.Deserialize(ref reader, options);
					writer.Write("\"" + Convert.ToBase64String(arraySegment.Array ?? Array.Empty<byte>(), arraySegment.Offset, arraySegment.Count) + "\"");
					break;
				}
				case MessagePackType.Array:
				{
					int num2 = reader.ReadArrayHeader();
					options.Security.DepthStep(ref reader);
					try
					{
						writer.Write("[");
						for (int i = 0; i < num2; i++)
						{
							ToJsonCore(ref reader, writer, options);
							if (i != num2 - 1)
							{
								writer.Write(",");
							}
						}
						writer.Write("]");
						break;
					}
					finally
					{
						reader.Depth--;
					}
				}
				case MessagePackType.Map:
				{
					int num3 = reader.ReadMapHeader();
					options.Security.DepthStep(ref reader);
					try
					{
						writer.Write("{");
						for (int j = 0; j < num3; j++)
						{
							MessagePackType nextMessagePackType2 = reader.NextMessagePackType;
							if (nextMessagePackType2 == MessagePackType.String || nextMessagePackType2 == MessagePackType.Binary)
							{
								ToJsonCore(ref reader, writer, options);
							}
							else
							{
								writer.Write("\"");
								ToJsonCore(ref reader, writer, options);
								writer.Write("\"");
							}
							writer.Write(":");
							ToJsonCore(ref reader, writer, options);
							if (j != num3 - 1)
							{
								writer.Write(",");
							}
						}
						writer.Write("}");
						break;
					}
					finally
					{
						reader.Depth--;
					}
				}
				case MessagePackType.Extension:
				{
					ExtensionHeader header = reader.ReadExtensionFormatHeader();
					if (header.TypeCode == -1)
					{
						DateTime dateTime = reader.ReadDateTime(header);
						writer.Write("\"");
						writer.Write(dateTime.ToString("o", CultureInfo.InvariantCulture));
						writer.Write("\"");
					}
					else if (header.TypeCode == 100)
					{
						StringBuilder stringBuilder = new StringBuilder();
						StringBuilder stringBuilder2 = new StringBuilder();
						SequencePosition position = reader.Position;
						ToJsonCore(ref reader, new StringWriter(stringBuilder2), options);
						int num = (int)reader.Sequence.Slice(position, reader.Position).Length;
						if (header.Length > num)
						{
							MessagePackType nextMessagePackType = reader.NextMessagePackType;
							if (nextMessagePackType != MessagePackType.Array && nextMessagePackType != MessagePackType.Map)
							{
								stringBuilder.Append("{");
							}
							ToJsonCore(ref reader, new StringWriter(stringBuilder), options);
							if (nextMessagePackType != MessagePackType.Array)
							{
								stringBuilder2.Insert(0, "\"$type\":");
							}
							if (nextMessagePackType != MessagePackType.Array && nextMessagePackType != MessagePackType.Map)
							{
								stringBuilder.Append("}");
							}
							if (stringBuilder.Length > 2)
							{
								stringBuilder2.Append(",");
							}
							stringBuilder.Insert(1, stringBuilder2.ToString());
							writer.Write(stringBuilder.ToString());
						}
						else
						{
							writer.Write("{\"$type\":" + stringBuilder2.ToString() + "}");
						}
					}
					else
					{
						ReadOnlySequence<byte> sequence = reader.ReadRaw(header.Length);
						writer.Write("[");
						writer.Write(header.TypeCode);
						writer.Write(",");
						writer.Write("\"");
						writer.Write(Convert.ToBase64String(BuffersExtensions.ToArray(in sequence)));
						writer.Write("\"");
						writer.Write("]");
					}
					break;
				}
				case MessagePackType.Nil:
					reader.Skip();
					writer.Write("null");
					break;
				default:
					throw new MessagePackSerializationException($"code is invalid. code: {reader.NextCode} format: {MessagePackCode.ToFormatName(reader.NextCode)}");
				}
			}
		}

		private static void WriteJsonString(string value, TextWriter builder)
		{
			builder.Write('"');
			int length = value.Length;
			for (int i = 0; i < length; i = checked(i + 1))
			{
				char c = value[i];
				switch (c)
				{
				case '"':
					builder.Write("\\\"");
					break;
				case '\\':
					builder.Write("\\\\");
					break;
				case '\b':
					builder.Write("\\b");
					break;
				case '\f':
					builder.Write("\\f");
					break;
				case '\n':
					builder.Write("\\n");
					break;
				case '\r':
					builder.Write("\\r");
					break;
				case '\t':
					builder.Write("\\t");
					break;
				default:
					builder.Write(c);
					break;
				}
			}
			builder.Write('"');
		}

		static MessagePackSerializer()
		{
			LZ4CodecEncode = LZ4Codec.Encode;
			LZ4CodecDecode = LZ4Codec.Decode;
			Serializes = new ThreadsafeTypeKeyHashTable<CompiledMethods>(64);
			CreateCompiledMethods = (Type t) => new CompiledMethods(t);
		}

		public static void Serialize(Type type, ref MessagePackWriter writer, object? obj, MessagePackSerializerOptions? options = null)
		{
			GetOrAdd(type).Serialize_MessagePackWriter_T_Options(ref writer, obj, options);
		}

		public static void Serialize(Type type, IBufferWriter<byte> writer, object? obj, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			GetOrAdd(type).Serialize_IBufferWriter_T_Options_CancellationToken(writer, obj, options, cancellationToken);
		}

		public static byte[] Serialize(Type type, object? obj, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			return GetOrAdd(type).Serialize_T_Options(obj, options, cancellationToken);
		}

		public static void Serialize(Type type, Stream stream, object? obj, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			GetOrAdd(type).Serialize_Stream_T_Options_CancellationToken(stream, obj, options, cancellationToken);
		}

		public static Task SerializeAsync(Type type, Stream stream, object? obj, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			return GetOrAdd(type).SerializeAsync_Stream_T_Options_CancellationToken(stream, obj, options, cancellationToken);
		}

		public static object? Deserialize(Type type, ref MessagePackReader reader, MessagePackSerializerOptions? options = null)
		{
			return GetOrAdd(type).Deserialize_MessagePackReader_Options(ref reader, options);
		}

		public static object? Deserialize(Type type, Stream stream, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			return GetOrAdd(type).Deserialize_Stream_Options_CancellationToken(stream, options, cancellationToken);
		}

		public static ValueTask<object?> DeserializeAsync(Type type, Stream stream, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			return GetOrAdd(type).DeserializeAsync_Stream_Options_CancellationToken(stream, options, cancellationToken);
		}

		public static object? Deserialize(Type type, ReadOnlyMemory<byte> bytes, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			return GetOrAdd(type).Deserialize_ReadOnlyMemory_Options(bytes, options, cancellationToken);
		}

		public static object? Deserialize(Type type, ReadOnlySequence<byte> bytes, MessagePackSerializerOptions? options = null, CancellationToken cancellationToken = default(CancellationToken))
		{
			return GetOrAdd(type).Deserialize_ReadOnlySequence_Options_CancellationToken(bytes, options, cancellationToken);
		}

		private static void SerializeSemiGeneric<T>(ref MessagePackWriter writer, object valueObject, MessagePackSerializerOptions? options = null)
		{
			Serialize(ref writer, (T)valueObject, options);
		}

		private static object? DeserializeSemiGeneric<T>(ref MessagePackReader reader, MessagePackSerializerOptions? options = null)
		{
			return Deserialize<T>(ref reader, options);
		}

		private static async ValueTask<object?> DeserializeObjectAsync<T>(Stream stream, MessagePackSerializerOptions options, CancellationToken cancellationToken)
		{
			return await DeserializeAsync<T>(stream, options, cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
		}

		private static CompiledMethods GetOrAdd(Type type)
		{
			return Serializes.GetOrAdd(type, CreateCompiledMethods);
		}
	}
	public class MessagePackStreamReader : IDisposable
	{
		private readonly Stream stream;

		private readonly bool leaveOpen;

		private SequencePool.Rental sequenceRental;

		private SequencePosition? endOfLastMessage;

		public ReadOnlySequence<byte> RemainingBytes
		{
			get
			{
				if (!endOfLastMessage.HasValue)
				{
					return ReadData.AsReadOnlySequence;
				}
				return ReadData.AsReadOnlySequence.Slice(endOfLastMessage.Value);
			}
		}

		private Sequence<byte> ReadData => sequenceRental.Value;

		public async ValueTask<int> ReadArrayHeaderAsync(CancellationToken cancellationToken)
		{
			RecycleLastMessage();
			cancellationToken.ThrowIfCancellationRequested();
			int length;
			while (!TryReadArrayHeader(out length))
			{
				if (!(await TryReadMoreDataAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
				{
					throw new EndOfStreamException("The stream ended before a map header could be found.");
				}
			}
			return length;
		}

		public async IAsyncEnumerable<ReadOnlySequence<byte>> ReadArrayAsync([EnumeratorCancellation] CancellationToken cancellationToken)
		{
			RecycleLastMessage();
			cancellationToken.ThrowIfCancellationRequested();
			int length;
			while (!TryReadArrayHeader(out length))
			{
				if (!(await TryReadMoreDataAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
				{
					throw new EndOfStreamException("The stream ended before an array header could be found.");
				}
			}
			for (int i = 0; i < length; i = checked(i + 1))
			{
				ReadOnlySequence<byte>? readOnlySequence = await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
				if (!readOnlySequence.HasValue)
				{
					throw new EndOfStreamException("Stream ended before all elements were read.");
				}
				yield return readOnlySequence.Value;
			}
		}

		private bool TryReadArrayHeader(out int length)
		{
			if (ReadData.Length > 0)
			{
				ReadOnlySequence<byte> readOnlySequence = ReadData;
				MessagePackReader messagePackReader = new MessagePackReader(in readOnlySequence);
				if (messagePackReader.TryReadArrayHeader(out length))
				{
					endOfLastMessage = messagePackReader.Position;
					return true;
				}
			}
			length = 0;
			return false;
		}

		public async ValueTask<int> ReadMapHeaderAsync(CancellationToken cancellationToken)
		{
			RecycleLastMessage();
			cancellationToken.ThrowIfCancellationRequested();
			int count;
			while (!TryReadMapHeader(out count))
			{
				if (!(await TryReadMoreDataAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
				{
					throw new EndOfStreamException("The stream ended before a map header could be found.");
				}
			}
			return count;
		}

		private bool TryReadMapHeader(out int count)
		{
			if (ReadData.Length > 0)
			{
				ReadOnlySequence<byte> readOnlySequence = ReadData;
				MessagePackReader messagePackReader = new MessagePackReader(in readOnlySequence);
				if (messagePackReader.TryReadMapHeader(out count))
				{
					endOfLastMessage = messagePackReader.Position;
					return true;
				}
			}
			count = 0;
			return false;
		}

		public MessagePackStreamReader(Stream stream)
			: this(stream, leaveOpen: false)
		{
		}

		public MessagePackStreamReader(Stream stream, bool leaveOpen)
			: this(stream, leaveOpen, SequencePool.Shared)
		{
		}

		public MessagePackStreamReader(Stream stream, bool leaveOpen, SequencePool sequencePool)
		{
			if (sequencePool == null)
			{
				throw new ArgumentNullException("sequencePool");
			}
			this.stream = stream ?? throw new ArgumentNullException("stream");
			this.leaveOpen = leaveOpen;
			sequenceRental = sequencePool.Rent();
		}

		public async ValueTask<ReadOnlySequence<byte>?> ReadAsync(CancellationToken cancellationToken)
		{
			RecycleLastMessage();
			do
			{
				cancellationToken.ThrowIfCancellationRequested();
				if (TryReadNextMessage(out var completeMessage))
				{
					return completeMessage;
				}
			}
			while (await TryReadMoreDataAsync(cancellationToken)

Microsoft.Extensions.DependencyInjection.Abstractions.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using FxResources.Microsoft.Extensions.DependencyInjection.Abstractions;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Internal;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyInjection.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.DependencyInjection.Abstractions")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Abstractions for dependency injection.\r\n\r\nCommonly Used Types:\r\nMicrosoft.Extensions.DependencyInjection.IServiceCollection")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.DependencyInjection.Abstractions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FxResources.Microsoft.Extensions.DependencyInjection.Abstractions
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		[DoesNotReturn]
		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

		internal static string AmbiguousConstructorMatch => GetResourceString("AmbiguousConstructorMatch");

		internal static string CannotResolveService => GetResourceString("CannotResolveService");

		internal static string NoConstructorMatch => GetResourceString("NoConstructorMatch");

		internal static string NoServiceRegistered => GetResourceString("NoServiceRegistered");

		internal static string ServiceCollectionReadOnly => GetResourceString("ServiceCollectionReadOnly");

		internal static string TryAddIndistinguishableTypeToEnumerable => GetResourceString("TryAddIndistinguishableTypeToEnumerable");

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

		internal static string GetResourceString(string resourceKey)
		{
			if (UsingResourceKeys())
			{
				return resourceKey;
			}
			string result = null;
			try
			{
				result = ResourceManager.GetString(resourceKey);
			}
			catch (MissingManifestResourceException)
			{
			}
			return result;
		}

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		public string Message { get; }

		public string? Url { get; set; }

		public RequiresDynamicCodeAttribute(string message)
		{
			Message = message;
		}
	}
}
namespace Microsoft.Extensions.Internal
{
	internal static class ParameterDefaultValue
	{
		public static bool TryGetDefaultValue(ParameterInfo parameter, out object? defaultValue)
		{
			bool tryToGetDefaultValue;
			bool flag = CheckHasDefaultValue(parameter, out tryToGetDefaultValue);
			defaultValue = null;
			if (flag)
			{
				if (tryToGetDefaultValue)
				{
					defaultValue = parameter.DefaultValue;
				}
				bool flag2 = parameter.ParameterType.IsGenericType && parameter.ParameterType.GetGenericTypeDefinition() == typeof(Nullable<>);
				if (defaultValue == null && parameter.ParameterType.IsValueType && !flag2)
				{
					defaultValue = CreateValueType(parameter.ParameterType);
				}
				if (defaultValue != null && flag2)
				{
					Type underlyingType = Nullable.GetUnderlyingType(parameter.ParameterType);
					if (underlyingType != null && underlyingType.IsEnum)
					{
						defaultValue = Enum.ToObject(underlyingType, defaultValue);
					}
				}
			}
			return flag;
			[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2067:UnrecognizedReflectionPattern", Justification = "CreateValueType is only called on a ValueType. You can always create an instance of a ValueType.")]
			static object? CreateValueType(Type t)
			{
				return RuntimeHelpers.GetUninitializedObject(t);
			}
		}

		public static bool CheckHasDefaultValue(ParameterInfo parameter, out bool tryToGetDefaultValue)
		{
			tryToGetDefaultValue = true;
			return parameter.HasDefaultValue;
		}
	}
}
namespace Microsoft.Extensions.DependencyInjection
{
	public static class ActivatorUtilities
	{
		private struct ConstructorMatcher
		{
			private readonly ConstructorInfo _constructor;

			private readonly ParameterInfo[] _parameters;

			private readonly object[] _parameterValues;

			public ConstructorMatcher(ConstructorInfo constructor)
			{
				_constructor = constructor;
				_parameters = _constructor.GetParameters();
				_parameterValues = new object[_parameters.Length];
			}

			public int Match(object[] givenParameters)
			{
				int num = 0;
				int result = 0;
				for (int i = 0; i != givenParameters.Length; i++)
				{
					Type c = givenParameters[i]?.GetType();
					bool flag = false;
					int num2 = num;
					while (!flag && num2 != _parameters.Length)
					{
						if (_parameterValues[num2] == null && _parameters[num2].ParameterType.IsAssignableFrom(c))
						{
							flag = true;
							_parameterValues[num2] = givenParameters[i];
							if (num == num2)
							{
								num++;
								if (num2 == i)
								{
									result = num2;
								}
							}
						}
						num2++;
					}
					if (!flag)
					{
						return -1;
					}
				}
				return result;
			}

			public object CreateInstance(IServiceProvider provider)
			{
				for (int i = 0; i != _parameters.Length; i++)
				{
					if (_parameterValues[i] != null)
					{
						continue;
					}
					object service = provider.GetService(_parameters[i].ParameterType);
					if (service == null)
					{
						if (!ParameterDefaultValue.TryGetDefaultValue(_parameters[i], out object defaultValue))
						{
							throw new InvalidOperationException($"Unable to resolve service for type '{_parameters[i].ParameterType}' while attempting to activate '{_constructor.DeclaringType}'.");
						}
						_parameterValues[i] = defaultValue;
					}
					else
					{
						_parameterValues[i] = service;
					}
				}
				return _constructor.Invoke(BindingFlags.DoNotWrapExceptions, null, _parameterValues, null);
			}
		}

		private static readonly MethodInfo GetServiceInfo = GetMethodInfo<Func<IServiceProvider, Type, Type, bool, object>>((IServiceProvider sp, Type t, Type r, bool c) => GetService(sp, t, r, c));

		public static object CreateInstance(IServiceProvider provider, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType, params object[] parameters)
		{
			int num = -1;
			bool flag = false;
			ConstructorMatcher constructorMatcher = default(ConstructorMatcher);
			if (!instanceType.IsAbstract)
			{
				ConstructorInfo[] constructors = instanceType.GetConstructors();
				foreach (ConstructorInfo constructorInfo in constructors)
				{
					ConstructorMatcher constructorMatcher2 = new ConstructorMatcher(constructorInfo);
					bool flag2 = constructorInfo.IsDefined(typeof(ActivatorUtilitiesConstructorAttribute), inherit: false);
					int num2 = constructorMatcher2.Match(parameters);
					if (flag2)
					{
						if (flag)
						{
							ThrowMultipleCtorsMarkedWithAttributeException();
						}
						if (num2 == -1)
						{
							ThrowMarkedCtorDoesNotTakeAllProvidedArguments();
						}
					}
					if (flag2 || num < num2)
					{
						num = num2;
						constructorMatcher = constructorMatcher2;
					}
					flag = flag || flag2;
				}
			}
			if (num == -1)
			{
				string message = $"A suitable constructor for type '{instanceType}' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.";
				throw new InvalidOperationException(message);
			}
			return constructorMatcher.CreateInstance(provider);
		}

		public static ObjectFactory CreateFactory([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType, Type[] argumentTypes)
		{
			FindApplicableConstructor(instanceType, argumentTypes, out var matchingConstructor, out var matchingParameterMap);
			ParameterExpression parameterExpression = Expression.Parameter(typeof(IServiceProvider), "provider");
			ParameterExpression parameterExpression2 = Expression.Parameter(typeof(object[]), "argumentArray");
			Expression body = BuildFactoryExpression(matchingConstructor, matchingParameterMap, parameterExpression, parameterExpression2);
			Expression<Func<IServiceProvider, object[], object>> expression = Expression.Lambda<Func<IServiceProvider, object[], object>>(body, new ParameterExpression[2] { parameterExpression, parameterExpression2 });
			Func<IServiceProvider, object[], object> @object = expression.Compile();
			return @object.Invoke;
		}

		public static T CreateInstance<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(IServiceProvider provider, params object[] parameters)
		{
			return (T)CreateInstance(provider, typeof(T), parameters);
		}

		public static T GetServiceOrCreateInstance<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(IServiceProvider provider)
		{
			return (T)GetServiceOrCreateInstance(provider, typeof(T));
		}

		public static object GetServiceOrCreateInstance(IServiceProvider provider, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type)
		{
			return provider.GetService(type) ?? CreateInstance(provider, type);
		}

		private static MethodInfo GetMethodInfo<T>(Expression<T> expr)
		{
			MethodCallExpression methodCallExpression = (MethodCallExpression)expr.Body;
			return methodCallExpression.Method;
		}

		private static object GetService(IServiceProvider sp, Type type, Type requiredBy, bool isDefaultParameterRequired)
		{
			object service = sp.GetService(type);
			if (service == null && !isDefaultParameterRequired)
			{
				string message = $"Unable to resolve service for type '{type}' while attempting to activate '{requiredBy}'.";
				throw new InvalidOperationException(message);
			}
			return service;
		}

		private static Expression BuildFactoryExpression(ConstructorInfo constructor, int?[] parameterMap, Expression serviceProvider, Expression factoryArgumentArray)
		{
			ParameterInfo[] parameters = constructor.GetParameters();
			Expression[] array = new Expression[parameters.Length];
			for (int i = 0; i < parameters.Length; i++)
			{
				ParameterInfo parameterInfo = parameters[i];
				Type parameterType = parameterInfo.ParameterType;
				object defaultValue;
				bool flag = ParameterDefaultValue.TryGetDefaultValue(parameterInfo, out defaultValue);
				if (parameterMap[i].HasValue)
				{
					array[i] = Expression.ArrayAccess(factoryArgumentArray, Expression.Constant(parameterMap[i]));
				}
				else
				{
					Expression[] arguments = new Expression[4]
					{
						serviceProvider,
						Expression.Constant(parameterType, typeof(Type)),
						Expression.Constant(constructor.DeclaringType, typeof(Type)),
						Expression.Constant(flag)
					};
					array[i] = Expression.Call(GetServiceInfo, arguments);
				}
				if (flag)
				{
					ConstantExpression right = Expression.Constant(defaultValue);
					array[i] = Expression.Coalesce(array[i], right);
				}
				array[i] = Expression.Convert(array[i], parameterType);
			}
			return Expression.New(constructor, array);
		}

		private static void FindApplicableConstructor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType, Type[] argumentTypes, out ConstructorInfo matchingConstructor, out int?[] matchingParameterMap)
		{
			ConstructorInfo matchingConstructor2 = null;
			int?[] parameterMap = null;
			if (!TryFindPreferredConstructor(instanceType, argumentTypes, ref matchingConstructor2, ref parameterMap) && !TryFindMatchingConstructor(instanceType, argumentTypes, ref matchingConstructor2, ref parameterMap))
			{
				string message = $"A suitable constructor for type '{instanceType}' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.";
				throw new InvalidOperationException(message);
			}
			matchingConstructor = matchingConstructor2;
			matchingParameterMap = parameterMap;
		}

		private static bool TryFindMatchingConstructor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType, Type[] argumentTypes, [NotNullWhen(true)] ref ConstructorInfo matchingConstructor, [NotNullWhen(true)] ref int?[] parameterMap)
		{
			ConstructorInfo[] constructors = instanceType.GetConstructors();
			foreach (ConstructorInfo constructorInfo in constructors)
			{
				if (TryCreateParameterMap(constructorInfo.GetParameters(), argumentTypes, out var parameterMap2))
				{
					if (matchingConstructor != null)
					{
						throw new InvalidOperationException($"Multiple constructors accepting all given argument types have been found in type '{instanceType}'. There should only be one applicable constructor.");
					}
					matchingConstructor = constructorInfo;
					parameterMap = parameterMap2;
				}
			}
			if (matchingConstructor != null)
			{
				return true;
			}
			return false;
		}

		private static bool TryFindPreferredConstructor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType, Type[] argumentTypes, [NotNullWhen(true)] ref ConstructorInfo matchingConstructor, [NotNullWhen(true)] ref int?[] parameterMap)
		{
			bool flag = false;
			ConstructorInfo[] constructors = instanceType.GetConstructors();
			foreach (ConstructorInfo constructorInfo in constructors)
			{
				if (constructorInfo.IsDefined(typeof(ActivatorUtilitiesConstructorAttribute), inherit: false))
				{
					if (flag)
					{
						ThrowMultipleCtorsMarkedWithAttributeException();
					}
					if (!TryCreateParameterMap(constructorInfo.GetParameters(), argumentTypes, out var parameterMap2))
					{
						ThrowMarkedCtorDoesNotTakeAllProvidedArguments();
					}
					matchingConstructor = constructorInfo;
					parameterMap = parameterMap2;
					flag = true;
				}
			}
			if (matchingConstructor != null)
			{
				return true;
			}
			return false;
		}

		private static bool TryCreateParameterMap(ParameterInfo[] constructorParameters, Type[] argumentTypes, out int?[] parameterMap)
		{
			parameterMap = new int?[constructorParameters.Length];
			for (int i = 0; i < argumentTypes.Length; i++)
			{
				bool flag = false;
				Type c = argumentTypes[i];
				for (int j = 0; j < constructorParameters.Length; j++)
				{
					if (!parameterMap[j].HasValue && constructorParameters[j].ParameterType.IsAssignableFrom(c))
					{
						flag = true;
						parameterMap[j] = i;
						break;
					}
				}
				if (!flag)
				{
					return false;
				}
			}
			return true;
		}

		private static void ThrowMultipleCtorsMarkedWithAttributeException()
		{
			throw new InvalidOperationException("Multiple constructors were marked with ActivatorUtilitiesConstructorAttribute.");
		}

		private static void ThrowMarkedCtorDoesNotTakeAllProvidedArguments()
		{
			throw new InvalidOperationException("Constructor marked with ActivatorUtilitiesConstructorAttribute does not accept all given argument types.");
		}
	}
	[AttributeUsage(AttributeTargets.All)]
	public class ActivatorUtilitiesConstructorAttribute : Attribute
	{
	}
	public readonly struct AsyncServiceScope : IServiceScope, IDisposable, IAsyncDisposable
	{
		private readonly IServiceScope _serviceScope;

		public IServiceProvider ServiceProvider => _serviceScope.ServiceProvider;

		public AsyncServiceScope(IServiceScope serviceScope)
		{
			System.ThrowHelper.ThrowIfNull(serviceScope, "serviceScope");
			_serviceScope = serviceScope;
		}

		public void Dispose()
		{
			_serviceScope.Dispose();
		}

		public ValueTask DisposeAsync()
		{
			if (_serviceScope is IAsyncDisposable asyncDisposable)
			{
				return asyncDisposable.DisposeAsync();
			}
			_serviceScope.Dispose();
			return default(ValueTask);
		}
	}
	public interface IServiceCollection : IList<ServiceDescriptor>, ICollection<ServiceDescriptor>, IEnumerable<ServiceDescriptor>, IEnumerable
	{
	}
	public interface IServiceProviderFactory<TContainerBuilder> where TContainerBuilder : notnull
	{
		TContainerBuilder CreateBuilder(IServiceCollection services);

		IServiceProvider CreateServiceProvider(TContainerBuilder containerBuilder);
	}
	public interface IServiceProviderIsService
	{
		bool IsService(Type serviceType);
	}
	public interface IServiceScope : IDisposable
	{
		IServiceProvider ServiceProvider { get; }
	}
	public interface IServiceScopeFactory
	{
		IServiceScope CreateScope();
	}
	public interface ISupportRequiredService
	{
		object GetRequiredService(Type serviceType);
	}
	public delegate object ObjectFactory(IServiceProvider serviceProvider, object?[]? arguments);
	public class ServiceCollection : IServiceCollection, IList<ServiceDescriptor>, ICollection<ServiceDescriptor>, IEnumerable<ServiceDescriptor>, IEnumerable
	{
		private readonly List<ServiceDescriptor> _descriptors = new List<ServiceDescriptor>();

		private bool _isReadOnly;

		public int Count => _descriptors.Count;

		public bool IsReadOnly => _isReadOnly;

		public ServiceDescriptor this[int index]
		{
			get
			{
				return _descriptors[index];
			}
			set
			{
				CheckReadOnly();
				_descriptors[index] = value;
			}
		}

		public void Clear()
		{
			CheckReadOnly();
			_descriptors.Clear();
		}

		public bool Contains(ServiceDescriptor item)
		{
			return _descriptors.Contains(item);
		}

		public void CopyTo(ServiceDescriptor[] array, int arrayIndex)
		{
			_descriptors.CopyTo(array, arrayIndex);
		}

		public bool Remove(ServiceDescriptor item)
		{
			CheckReadOnly();
			return _descriptors.Remove(item);
		}

		public IEnumerator<ServiceDescriptor> GetEnumerator()
		{
			return _descriptors.GetEnumerator();
		}

		void ICollection<ServiceDescriptor>.Add(ServiceDescriptor item)
		{
			CheckReadOnly();
			_descriptors.Add(item);
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

		public int IndexOf(ServiceDescriptor item)
		{
			return _descriptors.IndexOf(item);
		}

		public void Insert(int index, ServiceDescriptor item)
		{
			CheckReadOnly();
			_descriptors.Insert(index, item);
		}

		public void RemoveAt(int index)
		{
			CheckReadOnly();
			_descriptors.RemoveAt(index);
		}

		public void MakeReadOnly()
		{
			_isReadOnly = true;
		}

		private void CheckReadOnly()
		{
			if (_isReadOnly)
			{
				ThrowReadOnlyException();
			}
		}

		private static void ThrowReadOnlyException()
		{
			throw new InvalidOperationException(System.SR.ServiceCollectionReadOnly);
		}
	}
	public static class ServiceCollectionServiceExtensions
	{
		public static IServiceCollection AddTransient(this IServiceCollection services, Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			return Add(services, serviceType, implementationType, ServiceLifetime.Transient);
		}

		public static IServiceCollection AddTransient(this IServiceCollection services, Type serviceType, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Add(services, serviceType, implementationFactory, ServiceLifetime.Transient);
		}

		public static IServiceCollection AddTransient<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection services) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddTransient(typeof(TService), typeof(TImplementation));
		}

		public static IServiceCollection AddTransient(this IServiceCollection services, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			return services.AddTransient(serviceType, serviceType);
		}

		public static IServiceCollection AddTransient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection services) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddTransient(typeof(TService));
		}

		public static IServiceCollection AddTransient<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddTransient(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddTransient<TService, TImplementation>(this IServiceCollection services, Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddTransient(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddScoped(this IServiceCollection services, Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			return Add(services, serviceType, implementationType, ServiceLifetime.Scoped);
		}

		public static IServiceCollection AddScoped(this IServiceCollection services, Type serviceType, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Add(services, serviceType, implementationFactory, ServiceLifetime.Scoped);
		}

		public static IServiceCollection AddScoped<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection services) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddScoped(typeof(TService), typeof(TImplementation));
		}

		public static IServiceCollection AddScoped(this IServiceCollection services, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			return services.AddScoped(serviceType, serviceType);
		}

		public static IServiceCollection AddScoped<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection services) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddScoped(typeof(TService));
		}

		public static IServiceCollection AddScoped<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddScoped(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddScoped<TService, TImplementation>(this IServiceCollection services, Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddScoped(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			return Add(services, serviceType, implementationType, ServiceLifetime.Singleton);
		}

		public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Add(services, serviceType, implementationFactory, ServiceLifetime.Singleton);
		}

		public static IServiceCollection AddSingleton<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection services) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddSingleton(typeof(TService), typeof(TImplementation));
		}

		public static IServiceCollection AddSingleton(this IServiceCollection services, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			return services.AddSingleton(serviceType, serviceType);
		}

		public static IServiceCollection AddSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection services) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddSingleton(typeof(TService));
		}

		public static IServiceCollection AddSingleton<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddSingleton(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddSingleton<TService, TImplementation>(this IServiceCollection services, Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddSingleton(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType, object implementationInstance)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationInstance, "implementationInstance");
			ServiceDescriptor item = new ServiceDescriptor(serviceType, implementationInstance);
			services.Add(item);
			return services;
		}

		public static IServiceCollection AddSingleton<TService>(this IServiceCollection services, TService implementationInstance) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationInstance, "implementationInstance");
			return services.AddSingleton(typeof(TService), implementationInstance);
		}

		private static IServiceCollection Add(IServiceCollection collection, Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType, ServiceLifetime lifetime)
		{
			ServiceDescriptor item = new ServiceDescriptor(serviceType, implementationType, lifetime);
			collection.Add(item);
			return collection;
		}

		private static IServiceCollection Add(IServiceCollection collection, Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime)
		{
			ServiceDescriptor item = new ServiceDescriptor(serviceType, implementationFactory, lifetime);
			collection.Add(item);
			return collection;
		}
	}
	[DebuggerDisplay("Lifetime = {Lifetime}, ServiceType = {ServiceType}, ImplementationType = {ImplementationType}")]
	public class ServiceDescriptor
	{
		public ServiceLifetime Lifetime { get; }

		public Type ServiceType { get; }

		[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
		public Type? ImplementationType { get; }

		public object? ImplementationInstance { get; }

		public Func<IServiceProvider, object>? ImplementationFactory { get; }

		public ServiceDescriptor(Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType, ServiceLifetime lifetime)
			: this(serviceType, lifetime)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			ImplementationType = implementationType;
		}

		public ServiceDescriptor(Type serviceType, object instance)
			: this(serviceType, ServiceLifetime.Singleton)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(instance, "instance");
			ImplementationInstance = instance;
		}

		public ServiceDescriptor(Type serviceType, Func<IServiceProvider, object> factory, ServiceLifetime lifetime)
			: this(serviceType, lifetime)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(factory, "factory");
			ImplementationFactory = factory;
		}

		private ServiceDescriptor(Type serviceType, ServiceLifetime lifetime)
		{
			Lifetime = lifetime;
			ServiceType = serviceType;
		}

		public override string ToString()
		{
			string text = $"{"ServiceType"}: {ServiceType} {"Lifetime"}: {Lifetime} ";
			if (ImplementationType != null)
			{
				return text + $"{"ImplementationType"}: {ImplementationType}";
			}
			if (ImplementationFactory != null)
			{
				return text + $"{"ImplementationFactory"}: {ImplementationFactory.Method}";
			}
			return text + $"{"ImplementationInstance"}: {ImplementationInstance}";
		}

		internal Type GetImplementationType()
		{
			if (ImplementationType != null)
			{
				return ImplementationType;
			}
			if (ImplementationInstance != null)
			{
				return ImplementationInstance.GetType();
			}
			if (ImplementationFactory != null)
			{
				Type[] genericTypeArguments = ImplementationFactory.GetType().GenericTypeArguments;
				return genericTypeArguments[1];
			}
			return null;
		}

		public static ServiceDescriptor Transient<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() where TService : class where TImplementation : class, TService
		{
			return Describe<TService, TImplementation>(ServiceLifetime.Transient);
		}

		public static ServiceDescriptor Transient(Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			return Describe(service, implementationType, ServiceLifetime.Transient);
		}

		public static ServiceDescriptor Transient<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Transient);
		}

		public static ServiceDescriptor Transient<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Transient);
		}

		public static ServiceDescriptor Transient(Type service, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(service, implementationFactory, ServiceLifetime.Transient);
		}

		public static ServiceDescriptor Scoped<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() where TService : class where TImplementation : class, TService
		{
			return Describe<TService, TImplementation>(ServiceLifetime.Scoped);
		}

		public static ServiceDescriptor Scoped(Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			return Describe(service, implementationType, ServiceLifetime.Scoped);
		}

		public static ServiceDescriptor Scoped<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Scoped);
		}

		public static ServiceDescriptor Scoped<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Scoped);
		}

		public static ServiceDescriptor Scoped(Type service, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(service, implementationFactory, ServiceLifetime.Scoped);
		}

		public static ServiceDescriptor Singleton<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() where TService : class where TImplementation : class, TService
		{
			return Describe<TService, TImplementation>(ServiceLifetime.Singleton);
		}

		public static ServiceDescriptor Singleton(Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			return Describe(service, implementationType, ServiceLifetime.Singleton);
		}

		public static ServiceDescriptor Singleton<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Singleton);
		}

		public static ServiceDescriptor Singleton<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Singleton);
		}

		public static ServiceDescriptor Singleton(Type serviceType, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(serviceType, implementationFactory, ServiceLifetime.Singleton);
		}

		public static ServiceDescriptor Singleton<TService>(TService implementationInstance) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(implementationInstance, "implementationInstance");
			return Singleton(typeof(TService), implementationInstance);
		}

		public static ServiceDescriptor Singleton(Type serviceType, object implementationInstance)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationInstance, "implementationInstance");
			return new ServiceDescriptor(serviceType, implementationInstance);
		}

		private static ServiceDescriptor Describe<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(ServiceLifetime lifetime) where TService : class where TImplementation : class, TService
		{
			return Describe(typeof(TService), typeof(TImplementation), lifetime);
		}

		public static ServiceDescriptor Describe(Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType, ServiceLifetime lifetime)
		{
			return new ServiceDescriptor(serviceType, implementationType, lifetime);
		}

		public static ServiceDescriptor Describe(Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime)
		{
			return new ServiceDescriptor(serviceType, implementationFactory, lifetime);
		}
	}
	public enum ServiceLifetime
	{
		Singleton,
		Scoped,
		Transient
	}
	public static class ServiceProviderServiceExtensions
	{
		public static T? GetService<T>(this IServiceProvider provider)
		{
			System.ThrowHelper.ThrowIfNull(provider, "provider");
			return (T)provider.GetService(typeof(T));
		}

		public static object GetRequiredService(this IServiceProvider provider, Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(provider, "provider");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			if (provider is ISupportRequiredService supportRequiredService)
			{
				return supportRequiredService.GetRequiredService(serviceType);
			}
			object service = provider.GetService(serviceType);
			if (service == null)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.NoServiceRegistered, serviceType));
			}
			return service;
		}

		public static T GetRequiredService<T>(this IServiceProvider provider) where T : notnull
		{
			System.ThrowHelper.ThrowIfNull(provider, "provider");
			return (T)provider.GetRequiredService(typeof(T));
		}

		public static IEnumerable<T> GetServices<T>(this IServiceProvider provider)
		{
			System.ThrowHelper.ThrowIfNull(provider, "provider");
			return provider.GetRequiredService<IEnumerable<T>>();
		}

		[RequiresDynamicCode("The native code for an IEnumerable<serviceType> might not be available at runtime.")]
		public static IEnumerable<object?> GetServices(this IServiceProvider provider, Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(provider, "provider");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			Type serviceType2 = typeof(IEnumerable<>).MakeGenericType(serviceType);
			return (IEnumerable<object>)provider.GetRequiredService(serviceType2);
		}

		public static IServiceScope CreateScope(this IServiceProvider provider)
		{
			return provider.GetRequiredService<IServiceScopeFactory>().CreateScope();
		}

		public static AsyncServiceScope CreateAsyncScope(this IServiceProvider provider)
		{
			return new AsyncServiceScope(provider.CreateScope());
		}

		public static AsyncServiceScope CreateAsyncScope(this IServiceScopeFactory serviceScopeFactory)
		{
			return new AsyncServiceScope(serviceScopeFactory.CreateScope());
		}
	}
}
namespace Microsoft.Extensions.DependencyInjection.Extensions
{
	public static class ServiceCollectionDescriptorExtensions
	{
		public static IServiceCollection Add(this IServiceCollection collection, ServiceDescriptor descriptor)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(descriptor, "descriptor");
			collection.Add(descriptor);
			return collection;
		}

		public static IServiceCollection Add(this IServiceCollection collection, IEnumerable<ServiceDescriptor> descriptors)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(descriptors, "descriptors");
			foreach (ServiceDescriptor descriptor in descriptors)
			{
				collection.Add(descriptor);
			}
			return collection;
		}

		public static void TryAdd(this IServiceCollection collection, ServiceDescriptor descriptor)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(descriptor, "descriptor");
			int count = collection.Count;
			for (int i = 0; i < count; i++)
			{
				if (collection[i].ServiceType == descriptor.ServiceType)
				{
					return;
				}
			}
			collection.Add(descriptor);
		}

		public static void TryAdd(this IServiceCollection collection, IEnumerable<ServiceDescriptor> descriptors)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(descriptors, "descriptors");
			foreach (ServiceDescriptor descriptor in descriptors)
			{
				collection.TryAdd(descriptor);
			}
		}

		public static void TryAddTransient(this IServiceCollection collection, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			ServiceDescriptor descriptor = ServiceDescriptor.Transient(service, service);
			collection.TryAdd(descriptor);
		}

		public static void TryAddTransient(this IServiceCollection collection, Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			ServiceDescriptor descriptor = ServiceDescriptor.Transient(service, implementationType);
			collection.TryAdd(descriptor);
		}

		public static void TryAddTransient(this IServiceCollection collection, Type service, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			ServiceDescriptor descriptor = ServiceDescriptor.Transient(service, implementationFactory);
			collection.TryAdd(descriptor);
		}

		public static void TryAddTransient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddTransient(typeof(TService), typeof(TService));
		}

		public static void TryAddTransient<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection collection) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddTransient(typeof(TService), typeof(TImplementation));
		}

		public static void TryAddTransient<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			services.TryAdd(ServiceDescriptor.Transient(implementationFactory));
		}

		public static void TryAddScoped(this IServiceCollection collection, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			ServiceDescriptor descriptor = ServiceDescriptor.Scoped(service, service);
			collection.TryAdd(descriptor);
		}

		public static void TryAddScoped(this IServiceCollection collection, Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			ServiceDescriptor descriptor = ServiceDescriptor.Scoped(service, implementationType);
			collection.TryAdd(descriptor);
		}

		public static void TryAddScoped(this IServiceCollection collection, Type service, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			ServiceDescriptor descriptor = ServiceDescriptor.Scoped(service, implementationFactory);
			collection.TryAdd(descriptor);
		}

		public static void TryAddScoped<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddScoped(typeof(TService), typeof(TService));
		}

		public static void TryAddScoped<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection collection) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddScoped(typeof(TService), typeof(TImplementation));
		}

		public static void TryAddScoped<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			services.TryAdd(ServiceDescriptor.Scoped(implementationFactory));
		}

		public static void TryAddSingleton(this IServiceCollection collection, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			ServiceDescriptor descriptor = ServiceDescriptor.Singleton(service, service);
			collection.TryAdd(descriptor);
		}

		public static void TryAddSingleton(this IServiceCollection collection, Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			ServiceDescriptor descriptor = ServiceDescriptor.Singleton(service, implementationType);
			collection.TryAdd(descriptor);
		}

		public static void TryAddSingleton(this IServiceCollection collection, Type service, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			ServiceDescriptor descriptor = ServiceDescriptor.Singleton(service, implementationFactory);
			collection.TryAdd(descriptor);
		}

		public static void TryAddSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddSingleton(typeof(TService), typeof(TService));
		}

		public static void TryAddSingleton<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection collection) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddSingleton(typeof(TService), typeof(TImplementation));
		}

		public static void TryAddSingleton<TService>(this IServiceCollection collection, TService instance) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(instance, "instance");
			ServiceDescriptor descriptor = ServiceDescriptor.Singleton(typeof(TService), instance);
			collection.TryAdd(descriptor);
		}

		public static void TryAddSingleton<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			services.TryAdd(ServiceDescriptor.Singleton(implementationFactory));
		}

		public static void TryAddEnumerable(this IServiceCollection services, ServiceDescriptor descriptor)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(descriptor, "descriptor");
			Type implementationType = descriptor.GetImplementationType();
			if (implementationType == typeof(object) || implementationType == descriptor.ServiceType)
			{
				throw new ArgumentException(System.SR.Format(System.SR.TryAddIndistinguishableTypeToEnumerable, implementationType, descriptor.ServiceType), "descriptor");
			}
			int count = services.Count;
			for (int i = 0; i < count; i++)
			{
				ServiceDescriptor serviceDescriptor = services[i];
				if (serviceDescriptor.ServiceType == descriptor.ServiceType && serviceDescriptor.GetImplementationType() == implementationType)
				{
					return;
				}
			}
			services.Add(descriptor);
		}

		public static void TryAddEnumerable(this IServiceCollection services, IEnumerable<ServiceDescriptor> descriptors)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(descriptors, "descriptors");
			foreach (ServiceDescriptor descriptor in descriptors)
			{
				services.TryAddEnumerable(descriptor);
			}
		}

		public static IServiceCollection Replace(this IServiceCollection collection, ServiceDescriptor descriptor)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(descriptor, "descriptor");
			int count = collection.Count;
			for (int i = 0; i < count; i++)
			{
				if (collection[i].ServiceType == descriptor.ServiceType)
				{
					collection.RemoveAt(i);
					break;
				}
			}
			collection.Add(descriptor);
			return collection;
		}

		public static IServiceCollection RemoveAll<T>(this IServiceCollection collection)
		{
			return collection.RemoveAll(typeof(T));
		}

		public static IServiceCollection RemoveAll(this IServiceCollection collection, Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			for (int num = collection.Count - 1; num >= 0; num--)
			{
				ServiceDescriptor serviceDescriptor = collection[num];
				if (serviceDescriptor.ServiceType == serviceType)
				{
					collection.RemoveAt(num);
				}
			}
			return collection;
		}
	}
}

Microsoft.Extensions.DependencyInjection.dll

Decompiled 5 months ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using FxResources.Microsoft.Extensions.DependencyInjection;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.ServiceLookup;
using Microsoft.Extensions.Internal;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyInjection.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("MicroBenchmarks, PublicKey=00240000048000009400000006020000002400005253413100040000010001004b86c4cb78549b34bab61a3b1800e23bfeb5b3ec390074041536a7e3cbd97f5f04cf0f857155a8928eaa29ebfd11cfbbad3ba70efea7bda3226c6a8d370a4cd303f714486b6ebc225985a638471e6ef571cc92a4613c00b8fa65d61ccee0cbe5f36330c9a01f4183559f1bef24cc2917c6d913e3a541333a1d05d9bed22b38cb")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.DependencyInjection")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Default implementation of dependency injection for Microsoft.Extensions.DependencyInjection.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.DependencyInjection")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: TypeForwardedTo(typeof(ServiceCollection))]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FxResources.Microsoft.Extensions.DependencyInjection
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

		internal static string AmbiguousConstructorException => GetResourceString("AmbiguousConstructorException");

		internal static string CannotResolveService => GetResourceString("CannotResolveService");

		internal static string CircularDependencyException => GetResourceString("CircularDependencyException");

		internal static string UnableToActivateTypeException => GetResourceString("UnableToActivateTypeException");

		internal static string OpenGenericServiceRequiresOpenGenericImplementation => GetResourceString("OpenGenericServiceRequiresOpenGenericImplementation");

		internal static string ArityOfOpenGenericServiceNotEqualArityOfOpenGenericImplementation => GetResourceString("ArityOfOpenGenericServiceNotEqualArityOfOpenGenericImplementation");

		internal static string TypeCannotBeActivated => GetResourceString("TypeCannotBeActivated");

		internal static string NoConstructorMatch => GetResourceString("NoConstructorMatch");

		internal static string ScopedInSingletonException => GetResourceString("ScopedInSingletonException");

		internal static string ScopedResolvedFromRootException => GetResourceString("ScopedResolvedFromRootException");

		internal static string DirectScopedResolvedFromRootException => GetResourceString("DirectScopedResolvedFromRootException");

		internal static string ConstantCantBeConvertedToServiceType => GetResourceString("ConstantCantBeConvertedToServiceType");

		internal static string ImplementationTypeCantBeConvertedToServiceType => GetResourceString("ImplementationTypeCantBeConvertedToServiceType");

		internal static string AsyncDisposableServiceDispose => GetResourceString("AsyncDisposableServiceDispose");

		internal static string GetCaptureDisposableNotSupported => GetResourceString("GetCaptureDisposableNotSupported");

		internal static string InvalidServiceDescriptor => GetResourceString("InvalidServiceDescriptor");

		internal static string ServiceDescriptorNotExist => GetResourceString("ServiceDescriptorNotExist");

		internal static string CallSiteTypeNotSupported => GetResourceString("CallSiteTypeNotSupported");

		internal static string TrimmingAnnotationsDoNotMatch => GetResourceString("TrimmingAnnotationsDoNotMatch");

		internal static string TrimmingAnnotationsDoNotMatch_NewConstraint => GetResourceString("TrimmingAnnotationsDoNotMatch_NewConstraint");

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

		internal static string GetResourceString(string resourceKey)
		{
			if (UsingResourceKeys())
			{
				return resourceKey;
			}
			string result = null;
			try
			{
				result = ResourceManager.GetString(resourceKey);
			}
			catch (MissingManifestResourceException)
			{
			}
			return result;
		}

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		public string Message { get; }

		public string? Url { get; set; }

		public RequiresDynamicCodeAttribute(string message)
		{
			Message = message;
		}
	}
}
namespace Microsoft.Extensions.DependencyInjection
{
	internal sealed class CallSiteJsonFormatter : CallSiteVisitor<CallSiteJsonFormatter.CallSiteFormatterContext, object?>
	{
		internal struct CallSiteFormatterContext
		{
			private readonly HashSet<ServiceCallSite> _processedCallSites;

			private bool _firstItem;

			public int Offset { get; }

			public StringBuilder Builder { get; }

			public CallSiteFormatterContext(StringBuilder builder, int offset, HashSet<ServiceCallSite> processedCallSites)
			{
				Builder = builder;
				Offset = offset;
				_processedCallSites = processedCallSites;
				_firstItem = true;
			}

			public bool ShouldFormat(ServiceCallSite serviceCallSite)
			{
				return _processedCallSites.Add(serviceCallSite);
			}

			public CallSiteFormatterContext IncrementOffset()
			{
				CallSiteFormatterContext result = new CallSiteFormatterContext(Builder, Offset + 4, _processedCallSites);
				result._firstItem = true;
				return result;
			}

			public CallSiteFormatterContext StartObject()
			{
				Builder.Append('{');
				return IncrementOffset();
			}

			public void EndObject()
			{
				Builder.Append('}');
			}

			public void StartProperty(string name)
			{
				if (!_firstItem)
				{
					Builder.Append(',');
				}
				else
				{
					_firstItem = false;
				}
				Builder.AppendFormat("\"{0}\":", name);
			}

			public void StartArrayItem()
			{
				if (!_firstItem)
				{
					Builder.Append(',');
				}
				else
				{
					_firstItem = false;
				}
			}

			public void WriteProperty(string name, object? value)
			{
				StartProperty(name);
				if (value != null)
				{
					Builder.AppendFormat(" \"{0}\"", value);
				}
				else
				{
					Builder.Append("null");
				}
			}

			public CallSiteFormatterContext StartArray()
			{
				Builder.Append('[');
				return IncrementOffset();
			}

			public void EndArray()
			{
				Builder.Append(']');
			}
		}

		internal static CallSiteJsonFormatter Instance = new CallSiteJsonFormatter();

		private CallSiteJsonFormatter()
		{
		}

		public string Format(ServiceCallSite callSite)
		{
			StringBuilder stringBuilder = new StringBuilder();
			CallSiteFormatterContext argument = new CallSiteFormatterContext(stringBuilder, 0, new HashSet<ServiceCallSite>());
			VisitCallSite(callSite, argument);
			return stringBuilder.ToString();
		}

		protected override object? VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteFormatterContext argument)
		{
			argument.WriteProperty("implementationType", constructorCallSite.ImplementationType);
			if (constructorCallSite.ParameterCallSites.Length != 0)
			{
				argument.StartProperty("arguments");
				CallSiteFormatterContext argument2 = argument.StartArray();
				ServiceCallSite[] parameterCallSites = constructorCallSite.ParameterCallSites;
				foreach (ServiceCallSite callSite in parameterCallSites)
				{
					argument2.StartArrayItem();
					VisitCallSite(callSite, argument2);
				}
				argument.EndArray();
			}
			return null;
		}

		protected override object? VisitCallSiteMain(ServiceCallSite callSite, CallSiteFormatterContext argument)
		{
			if (argument.ShouldFormat(callSite))
			{
				CallSiteFormatterContext argument2 = argument.StartObject();
				argument2.WriteProperty("serviceType", callSite.ServiceType);
				argument2.WriteProperty("kind", callSite.Kind);
				argument2.WriteProperty("cache", callSite.Cache.Location);
				base.VisitCallSiteMain(callSite, argument2);
				argument.EndObject();
			}
			else
			{
				argument.StartObject().WriteProperty("ref", callSite.ServiceType);
				argument.EndObject();
			}
			return null;
		}

		protected override object? VisitConstant(ConstantCallSite constantCallSite, CallSiteFormatterContext argument)
		{
			argument.WriteProperty("value", constantCallSite.DefaultValue ?? "");
			return null;
		}

		protected override object? VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, CallSiteFormatterContext argument)
		{
			return null;
		}

		protected override object? VisitIEnumerable(IEnumerableCallSite enumerableCallSite, CallSiteFormatterContext argument)
		{
			argument.WriteProperty("itemType", enumerableCallSite.ItemType);
			argument.WriteProperty("size", enumerableCallSite.ServiceCallSites.Length);
			if (enumerableCallSite.ServiceCallSites.Length != 0)
			{
				argument.StartProperty("items");
				CallSiteFormatterContext argument2 = argument.StartArray();
				ServiceCallSite[] serviceCallSites = enumerableCallSite.ServiceCallSites;
				foreach (ServiceCallSite callSite in serviceCallSites)
				{
					argument2.StartArrayItem();
					VisitCallSite(callSite, argument2);
				}
				argument.EndArray();
			}
			return null;
		}

		protected override object? VisitFactory(FactoryCallSite factoryCallSite, CallSiteFormatterContext argument)
		{
			argument.WriteProperty("method", factoryCallSite.Factory.Method);
			return null;
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	public class DefaultServiceProviderFactory : IServiceProviderFactory<IServiceCollection>
	{
		private readonly ServiceProviderOptions _options;

		public DefaultServiceProviderFactory()
			: this(ServiceProviderOptions.Default)
		{
		}

		public DefaultServiceProviderFactory(ServiceProviderOptions options)
		{
			_options = options ?? throw new ArgumentNullException("options");
		}

		public IServiceCollection CreateBuilder(IServiceCollection services)
		{
			return services;
		}

		public IServiceProvider CreateServiceProvider(IServiceCollection containerBuilder)
		{
			return containerBuilder.BuildServiceProvider(_options);
		}
	}
	[EventSource(Name = "Microsoft-Extensions-DependencyInjection")]
	internal sealed class DependencyInjectionEventSource : EventSource
	{
		public static class Keywords
		{
			public const EventKeywords ServiceProviderInitialized = (EventKeywords)1L;
		}

		public static readonly DependencyInjectionEventSource Log = new DependencyInjectionEventSource();

		private const int MaxChunkSize = 10240;

		private readonly List<WeakReference<ServiceProvider>> _providers = new List<WeakReference<ServiceProvider>>();

		private DependencyInjectionEventSource()
			: base(EventSourceSettings.EtwSelfDescribingEventFormat)
		{
		}

		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe.")]
		[Event(1, Level = EventLevel.Verbose)]
		private void CallSiteBuilt(string serviceType, string callSite, int chunkIndex, int chunkCount, int serviceProviderHashCode)
		{
			WriteEvent(1, serviceType, callSite, chunkIndex, chunkCount, serviceProviderHashCode);
		}

		[Event(2, Level = EventLevel.Verbose)]
		public void ServiceResolved(string serviceType, int serviceProviderHashCode)
		{
			WriteEvent(2, serviceType, serviceProviderHashCode);
		}

		[Event(3, Level = EventLevel.Verbose)]
		public void ExpressionTreeGenerated(string serviceType, int nodeCount, int serviceProviderHashCode)
		{
			WriteEvent(3, serviceType, nodeCount, serviceProviderHashCode);
		}

		[Event(4, Level = EventLevel.Verbose)]
		public void DynamicMethodBuilt(string serviceType, int methodSize, int serviceProviderHashCode)
		{
			WriteEvent(4, serviceType, methodSize, serviceProviderHashCode);
		}

		[Event(5, Level = EventLevel.Verbose)]
		public void ScopeDisposed(int serviceProviderHashCode, int scopedServicesResolved, int disposableServices)
		{
			WriteEvent(5, serviceProviderHashCode, scopedServicesResolved, disposableServices);
		}

		[Event(6, Level = EventLevel.Error)]
		public void ServiceRealizationFailed(string? exceptionMessage, int serviceProviderHashCode)
		{
			WriteEvent(6, exceptionMessage, serviceProviderHashCode);
		}

		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe.")]
		[Event(7, Level = EventLevel.Informational, Keywords = (EventKeywords)1L)]
		private void ServiceProviderBuilt(int serviceProviderHashCode, int singletonServices, int scopedServices, int transientServices, int closedGenericsServices, int openGenericsServices)
		{
			WriteEvent(7, serviceProviderHashCode, singletonServices, scopedServices, transientServices, closedGenericsServices, openGenericsServices);
		}

		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe.")]
		[Event(8, Level = EventLevel.Informational, Keywords = (EventKeywords)1L)]
		private void ServiceProviderDescriptors(int serviceProviderHashCode, string descriptors, int chunkIndex, int chunkCount)
		{
			WriteEvent(8, serviceProviderHashCode, descriptors, chunkIndex, chunkCount);
		}

		[NonEvent]
		public void ServiceResolved(ServiceProvider provider, Type serviceType)
		{
			if (IsEnabled(EventLevel.Verbose, EventKeywords.All))
			{
				ServiceResolved(serviceType.ToString(), provider.GetHashCode());
			}
		}

		[NonEvent]
		public void CallSiteBuilt(ServiceProvider provider, Type serviceType, ServiceCallSite callSite)
		{
			if (IsEnabled(EventLevel.Verbose, EventKeywords.All))
			{
				string text = CallSiteJsonFormatter.Instance.Format(callSite);
				int num = text.Length / 10240 + ((text.Length % 10240 > 0) ? 1 : 0);
				int hashCode = provider.GetHashCode();
				for (int i = 0; i < num; i++)
				{
					CallSiteBuilt(serviceType.ToString(), text.Substring(i * 10240, Math.Min(10240, text.Length - i * 10240)), i, num, hashCode);
				}
			}
		}

		[NonEvent]
		public void DynamicMethodBuilt(ServiceProvider provider, Type serviceType, int methodSize)
		{
			if (IsEnabled(EventLevel.Verbose, EventKeywords.All))
			{
				DynamicMethodBuilt(serviceType.ToString(), methodSize, provider.GetHashCode());
			}
		}

		[NonEvent]
		public void ServiceRealizationFailed(Exception exception, int serviceProviderHashCode)
		{
			if (IsEnabled(EventLevel.Error, EventKeywords.All))
			{
				ServiceRealizationFailed(exception.ToString(), serviceProviderHashCode);
			}
		}

		[NonEvent]
		public void ServiceProviderBuilt(ServiceProvider provider)
		{
			lock (_providers)
			{
				_providers.Add(new WeakReference<ServiceProvider>(provider));
			}
			WriteServiceProviderBuilt(provider);
		}

		[NonEvent]
		public void ServiceProviderDisposed(ServiceProvider provider)
		{
			lock (_providers)
			{
				for (int num = _providers.Count - 1; num >= 0; num--)
				{
					WeakReference<ServiceProvider> weakReference = _providers[num];
					if (!weakReference.TryGetTarget(out var target) || target == provider)
					{
						_providers.RemoveAt(num);
					}
				}
			}
		}

		[NonEvent]
		private void WriteServiceProviderBuilt(ServiceProvider provider)
		{
			if (!IsEnabled(EventLevel.Informational, (EventKeywords)1L))
			{
				return;
			}
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			StringBuilder stringBuilder = new StringBuilder("{ \"descriptors\":[ ");
			bool flag = true;
			ServiceDescriptor[] descriptors = provider.CallSiteFactory.Descriptors;
			foreach (ServiceDescriptor serviceDescriptor in descriptors)
			{
				if (flag)
				{
					flag = false;
				}
				else
				{
					stringBuilder.Append(", ");
				}
				AppendServiceDescriptor(stringBuilder, serviceDescriptor);
				switch (serviceDescriptor.Lifetime)
				{
				case ServiceLifetime.Singleton:
					num++;
					break;
				case ServiceLifetime.Scoped:
					num2++;
					break;
				case ServiceLifetime.Transient:
					num3++;
					break;
				}
				if (serviceDescriptor.ServiceType.IsGenericType)
				{
					if (serviceDescriptor.ServiceType.IsConstructedGenericType)
					{
						num4++;
					}
					else
					{
						num5++;
					}
				}
			}
			stringBuilder.Append(" ] }");
			int hashCode = provider.GetHashCode();
			ServiceProviderBuilt(hashCode, num, num2, num3, num4, num5);
			string text = stringBuilder.ToString();
			int num6 = text.Length / 10240 + ((text.Length % 10240 > 0) ? 1 : 0);
			for (int j = 0; j < num6; j++)
			{
				ServiceProviderDescriptors(hashCode, text.Substring(j * 10240, Math.Min(10240, text.Length - j * 10240)), j, num6);
			}
		}

		[NonEvent]
		private static void AppendServiceDescriptor(StringBuilder builder, ServiceDescriptor descriptor)
		{
			builder.Append("{ \"serviceType\": \"");
			builder.Append(descriptor.ServiceType);
			builder.Append("\", \"lifetime\": \"");
			builder.Append(descriptor.Lifetime);
			builder.Append("\", ");
			if ((object)descriptor.ImplementationType != null)
			{
				builder.Append("\"implementationType\": \"");
				builder.Append(descriptor.ImplementationType);
			}
			else if (descriptor.ImplementationFactory != null)
			{
				builder.Append("\"implementationFactory\": \"");
				builder.Append(descriptor.ImplementationFactory.Method);
			}
			else if (descriptor.ImplementationInstance != null)
			{
				builder.Append("\"implementationInstance\": \"");
				builder.Append(descriptor.ImplementationInstance.GetType());
				builder.Append(" (instance)");
			}
			else
			{
				builder.Append("\"unknown\": \"");
			}
			builder.Append("\" }");
		}

		protected override void OnEventCommand(EventCommandEventArgs command)
		{
			if (command.Command != EventCommand.Enable)
			{
				return;
			}
			lock (_providers)
			{
				foreach (WeakReference<ServiceProvider> provider in _providers)
				{
					if (provider.TryGetTarget(out var target))
					{
						WriteServiceProviderBuilt(target);
					}
				}
			}
		}
	}
	internal static class DependencyInjectionEventSourceExtensions
	{
		private sealed class NodeCountingVisitor : ExpressionVisitor
		{
			public int NodeCount { get; private set; }

			[return: NotNullIfNotNull("e")]
			public override Expression Visit(Expression e)
			{
				base.Visit(e);
				NodeCount++;
				return e;
			}
		}

		public static void ExpressionTreeGenerated(this DependencyInjectionEventSource source, ServiceProvider provider, Type serviceType, Expression expression)
		{
			if (source.IsEnabled(EventLevel.Verbose, EventKeywords.All))
			{
				NodeCountingVisitor nodeCountingVisitor = new NodeCountingVisitor();
				nodeCountingVisitor.Visit(expression);
				source.ExpressionTreeGenerated(serviceType.ToString(), nodeCountingVisitor.NodeCount, provider.GetHashCode());
			}
		}
	}
	public static class ServiceCollectionContainerBuilderExtensions
	{
		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		public static ServiceProvider BuildServiceProvider(this IServiceCollection services)
		{
			return services.BuildServiceProvider(ServiceProviderOptions.Default);
		}

		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		public static ServiceProvider BuildServiceProvider(this IServiceCollection services, bool validateScopes)
		{
			return services.BuildServiceProvider(new ServiceProviderOptions
			{
				ValidateScopes = validateScopes
			});
		}

		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		public static ServiceProvider BuildServiceProvider(this IServiceCollection services, ServiceProviderOptions options)
		{
			if (services == null)
			{
				throw new ArgumentNullException("services");
			}
			if (options == null)
			{
				throw new ArgumentNullException("options");
			}
			return new ServiceProvider(services, options);
		}
	}
	public sealed class ServiceProvider : IServiceProvider, IDisposable, IAsyncDisposable
	{
		internal const string RequiresDynamicCodeMessage = "Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.";

		private readonly CallSiteValidator _callSiteValidator;

		private readonly Func<Type, Func<ServiceProviderEngineScope, object>> _createServiceAccessor;

		internal ServiceProviderEngine _engine;

		private bool _disposed;

		private ConcurrentDictionary<Type, Func<ServiceProviderEngineScope, object>> _realizedServices;

		internal CallSiteFactory CallSiteFactory { get; }

		internal ServiceProviderEngineScope Root { get; }

		internal static bool VerifyOpenGenericServiceTrimmability { get; } = AppContext.TryGetSwitch("Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability", out var isEnabled) && isEnabled;


		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		internal ServiceProvider(ICollection<ServiceDescriptor> serviceDescriptors, ServiceProviderOptions options)
		{
			Root = new ServiceProviderEngineScope(this, isRootScope: true);
			_engine = GetEngine();
			_createServiceAccessor = CreateServiceAccessor;
			_realizedServices = new ConcurrentDictionary<Type, Func<ServiceProviderEngineScope, object>>();
			CallSiteFactory = new CallSiteFactory(serviceDescriptors);
			CallSiteFactory.Add(typeof(IServiceProvider), new ServiceProviderCallSite());
			CallSiteFactory.Add(typeof(IServiceScopeFactory), new ConstantCallSite(typeof(IServiceScopeFactory), Root));
			CallSiteFactory.Add(typeof(IServiceProviderIsService), new ConstantCallSite(typeof(IServiceProviderIsService), CallSiteFactory));
			if (options.ValidateScopes)
			{
				_callSiteValidator = new CallSiteValidator();
			}
			if (options.ValidateOnBuild)
			{
				List<Exception> list = null;
				foreach (ServiceDescriptor serviceDescriptor in serviceDescriptors)
				{
					try
					{
						ValidateService(serviceDescriptor);
					}
					catch (Exception item)
					{
						if (list == null)
						{
							list = new List<Exception>();
						}
						list.Add(item);
					}
				}
				if (list != null)
				{
					throw new AggregateException("Some services are not able to be constructed", list.ToArray());
				}
			}
			DependencyInjectionEventSource.Log.ServiceProviderBuilt(this);
		}

		public object? GetService(Type serviceType)
		{
			return GetService(serviceType, Root);
		}

		internal bool IsDisposed()
		{
			return _disposed;
		}

		public void Dispose()
		{
			DisposeCore();
			Root.Dispose();
		}

		public ValueTask DisposeAsync()
		{
			DisposeCore();
			return Root.DisposeAsync();
		}

		private void DisposeCore()
		{
			_disposed = true;
			DependencyInjectionEventSource.Log.ServiceProviderDisposed(this);
		}

		private void OnCreate(ServiceCallSite callSite)
		{
			_callSiteValidator?.ValidateCallSite(callSite);
		}

		private void OnResolve(Type serviceType, IServiceScope scope)
		{
			_callSiteValidator?.ValidateResolution(serviceType, scope, Root);
		}

		internal object? GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
		{
			if (_disposed)
			{
				ThrowHelper.ThrowObjectDisposedException();
			}
			Func<ServiceProviderEngineScope, object> orAdd = _realizedServices.GetOrAdd(serviceType, _createServiceAccessor);
			OnResolve(serviceType, serviceProviderEngineScope);
			DependencyInjectionEventSource.Log.ServiceResolved(this, serviceType);
			return orAdd(serviceProviderEngineScope);
		}

		private void ValidateService(ServiceDescriptor descriptor)
		{
			if (descriptor.ServiceType.IsGenericType && !descriptor.ServiceType.IsConstructedGenericType)
			{
				return;
			}
			try
			{
				ServiceCallSite callSite = CallSiteFactory.GetCallSite(descriptor, new CallSiteChain());
				if (callSite != null)
				{
					OnCreate(callSite);
				}
			}
			catch (Exception ex)
			{
				throw new InvalidOperationException($"Error while validating the service descriptor '{descriptor}': {ex.Message}", ex);
			}
		}

		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		private Func<ServiceProviderEngineScope, object> CreateServiceAccessor(Type serviceType)
		{
			ServiceCallSite callSite = CallSiteFactory.GetCallSite(serviceType, new CallSiteChain());
			if (callSite != null)
			{
				DependencyInjectionEventSource.Log.CallSiteBuilt(this, serviceType, callSite);
				OnCreate(callSite);
				if (callSite.Cache.Location == CallSiteResultCacheLocation.Root)
				{
					object value = CallSiteRuntimeResolver.Instance.Resolve(callSite, Root);
					return (ServiceProviderEngineScope scope) => value;
				}
				return _engine.RealizeService(callSite);
			}
			return (ServiceProviderEngineScope _) => null;
		}

		internal void ReplaceServiceAccessor(ServiceCallSite callSite, Func<ServiceProviderEngineScope, object?> accessor)
		{
			_realizedServices[callSite.ServiceType] = accessor;
		}

		internal IServiceScope CreateScope()
		{
			if (_disposed)
			{
				ThrowHelper.ThrowObjectDisposedException();
			}
			return new ServiceProviderEngineScope(this, isRootScope: false);
		}

		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		private ServiceProviderEngine GetEngine()
		{
			if (RuntimeFeature.IsDynamicCodeCompiled)
			{
				return new DynamicServiceProviderEngine(this);
			}
			return RuntimeServiceProviderEngine.Instance;
		}
	}
	public class ServiceProviderOptions
	{
		internal static readonly ServiceProviderOptions Default = new ServiceProviderOptions();

		public bool ValidateScopes { get; set; }

		public bool ValidateOnBuild { get; set; }
	}
}
namespace Microsoft.Extensions.DependencyInjection.ServiceLookup
{
	internal sealed class CallSiteChain
	{
		private readonly struct ChainItemInfo
		{
			public int Order { get; }

			public Type ImplementationType { get; }

			public ChainItemInfo(int order, Type implementationType)
			{
				Order = order;
				ImplementationType = implementationType;
			}
		}

		private readonly Dictionary<Type, ChainItemInfo> _callSiteChain;

		public CallSiteChain()
		{
			_callSiteChain = new Dictionary<Type, ChainItemInfo>();
		}

		public void CheckCircularDependency(Type serviceType)
		{
			if (_callSiteChain.ContainsKey(serviceType))
			{
				throw new InvalidOperationException(CreateCircularDependencyExceptionMessage(serviceType));
			}
		}

		public void Remove(Type serviceType)
		{
			_callSiteChain.Remove(serviceType);
		}

		public void Add(Type serviceType, Type? implementationType = null)
		{
			_callSiteChain[serviceType] = new ChainItemInfo(_callSiteChain.Count, implementationType);
		}

		private string CreateCircularDependencyExceptionMessage(Type type)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(System.SR.Format(System.SR.CircularDependencyException, TypeNameHelper.GetTypeDisplayName(type)));
			stringBuilder.AppendLine();
			AppendResolutionPath(stringBuilder, type);
			return stringBuilder.ToString();
		}

		private void AppendResolutionPath(StringBuilder builder, Type currentlyResolving)
		{
			List<KeyValuePair<Type, ChainItemInfo>> list = new List<KeyValuePair<Type, ChainItemInfo>>(_callSiteChain);
			list.Sort((KeyValuePair<Type, ChainItemInfo> a, KeyValuePair<Type, ChainItemInfo> b) => a.Value.Order.CompareTo(b.Value.Order));
			foreach (KeyValuePair<Type, ChainItemInfo> item in list)
			{
				Type key = item.Key;
				Type implementationType = item.Value.ImplementationType;
				if (implementationType == null || key == implementationType)
				{
					builder.Append(TypeNameHelper.GetTypeDisplayName(key));
				}
				else
				{
					builder.AppendFormat("{0}({1})", TypeNameHelper.GetTypeDisplayName(key), TypeNameHelper.GetTypeDisplayName(implementationType));
				}
				builder.Append(" -> ");
			}
			builder.Append(TypeNameHelper.GetTypeDisplayName(currentlyResolving));
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class CallSiteFactory : IServiceProviderIsService
	{
		private struct ServiceDescriptorCacheItem
		{
			[DisallowNull]
			private ServiceDescriptor _item;

			[DisallowNull]
			private List<ServiceDescriptor> _items;

			public ServiceDescriptor Last
			{
				get
				{
					if (_items != null && _items.Count > 0)
					{
						return _items[_items.Count - 1];
					}
					return _item;
				}
			}

			public int Count
			{
				get
				{
					if (_item == null)
					{
						return 0;
					}
					return 1 + (_items?.Count ?? 0);
				}
			}

			public ServiceDescriptor this[int index]
			{
				get
				{
					if (index >= Count)
					{
						throw new ArgumentOutOfRangeException("index");
					}
					if (index == 0)
					{
						return _item;
					}
					return _items[index - 1];
				}
			}

			public int GetSlot(ServiceDescriptor descriptor)
			{
				if (descriptor == _item)
				{
					return Count - 1;
				}
				if (_items != null)
				{
					int num = _items.IndexOf(descriptor);
					if (num != -1)
					{
						return _items.Count - (num + 1);
					}
				}
				throw new InvalidOperationException(System.SR.ServiceDescriptorNotExist);
			}

			public ServiceDescriptorCacheItem Add(ServiceDescriptor descriptor)
			{
				ServiceDescriptorCacheItem result = default(ServiceDescriptorCacheItem);
				if (_item == null)
				{
					result._item = descriptor;
				}
				else
				{
					result._item = _item;
					result._items = _items ?? new List<ServiceDescriptor>();
					result._items.Add(descriptor);
				}
				return result;
			}
		}

		private const int DefaultSlot = 0;

		private readonly ServiceDescriptor[] _descriptors;

		private readonly ConcurrentDictionary<ServiceCacheKey, ServiceCallSite> _callSiteCache = new ConcurrentDictionary<ServiceCacheKey, ServiceCallSite>();

		private readonly Dictionary<Type, ServiceDescriptorCacheItem> _descriptorLookup = new Dictionary<Type, ServiceDescriptorCacheItem>();

		private readonly ConcurrentDictionary<Type, object> _callSiteLocks = new ConcurrentDictionary<Type, object>();

		private readonly StackGuard _stackGuard;

		internal ServiceDescriptor[] Descriptors => _descriptors;

		public CallSiteFactory(ICollection<ServiceDescriptor> descriptors)
		{
			_stackGuard = new StackGuard();
			_descriptors = new ServiceDescriptor[descriptors.Count];
			descriptors.CopyTo(_descriptors, 0);
			Populate();
		}

		private void Populate()
		{
			ServiceDescriptor[] descriptors = _descriptors;
			foreach (ServiceDescriptor serviceDescriptor in descriptors)
			{
				Type serviceType = serviceDescriptor.ServiceType;
				if (serviceType.IsGenericTypeDefinition)
				{
					Type implementationType = serviceDescriptor.ImplementationType;
					if (implementationType == null || !implementationType.IsGenericTypeDefinition)
					{
						throw new ArgumentException(System.SR.Format(System.SR.OpenGenericServiceRequiresOpenGenericImplementation, serviceType), "descriptors");
					}
					if (implementationType.IsAbstract || implementationType.IsInterface)
					{
						throw new ArgumentException(System.SR.Format(System.SR.TypeCannotBeActivated, implementationType, serviceType));
					}
					Type[] genericArguments = serviceType.GetGenericArguments();
					Type[] genericArguments2 = implementationType.GetGenericArguments();
					if (genericArguments.Length != genericArguments2.Length)
					{
						throw new ArgumentException(System.SR.Format(System.SR.ArityOfOpenGenericServiceNotEqualArityOfOpenGenericImplementation, serviceType, implementationType), "descriptors");
					}
					if (ServiceProvider.VerifyOpenGenericServiceTrimmability)
					{
						ValidateTrimmingAnnotations(serviceType, genericArguments, implementationType, genericArguments2);
					}
				}
				else if (serviceDescriptor.ImplementationInstance == null && serviceDescriptor.ImplementationFactory == null)
				{
					Type implementationType2 = serviceDescriptor.ImplementationType;
					if (implementationType2.IsGenericTypeDefinition || implementationType2.IsAbstract || implementationType2.IsInterface)
					{
						throw new ArgumentException(System.SR.Format(System.SR.TypeCannotBeActivated, implementationType2, serviceType));
					}
				}
				Type key = serviceType;
				_descriptorLookup.TryGetValue(key, out var value);
				_descriptorLookup[key] = value.Add(serviceDescriptor);
			}
		}

		private static void ValidateTrimmingAnnotations(Type serviceType, Type[] serviceTypeGenericArguments, Type implementationType, Type[] implementationTypeGenericArguments)
		{
			for (int i = 0; i < serviceTypeGenericArguments.Length; i++)
			{
				Type type = serviceTypeGenericArguments[i];
				Type type2 = implementationTypeGenericArguments[i];
				DynamicallyAccessedMemberTypes dynamicallyAccessedMemberTypes = GetDynamicallyAccessedMemberTypes(type);
				DynamicallyAccessedMemberTypes dynamicallyAccessedMemberTypes2 = GetDynamicallyAccessedMemberTypes(type2);
				if (!AreCompatible(dynamicallyAccessedMemberTypes, dynamicallyAccessedMemberTypes2))
				{
					throw new ArgumentException(System.SR.Format(System.SR.TrimmingAnnotationsDoNotMatch, implementationType.FullName, serviceType.FullName));
				}
				bool flag = type.GenericParameterAttributes.HasFlag(GenericParameterAttributes.DefaultConstructorConstraint);
				if (type2.GenericParameterAttributes.HasFlag(GenericParameterAttributes.DefaultConstructorConstraint) && !flag)
				{
					throw new ArgumentException(System.SR.Format(System.SR.TrimmingAnnotationsDoNotMatch_NewConstraint, implementationType.FullName, serviceType.FullName));
				}
			}
		}

		private static DynamicallyAccessedMemberTypes GetDynamicallyAccessedMemberTypes(Type serviceGenericType)
		{
			foreach (CustomAttributeData customAttributesDatum in serviceGenericType.GetCustomAttributesData())
			{
				if (customAttributesDatum.AttributeType.FullName == "System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute" && customAttributesDatum.ConstructorArguments.Count == 1 && customAttributesDatum.ConstructorArguments[0].ArgumentType.FullName == "System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes")
				{
					return (DynamicallyAccessedMemberTypes)(int)customAttributesDatum.ConstructorArguments[0].Value;
				}
			}
			return DynamicallyAccessedMemberTypes.None;
		}

		private static bool AreCompatible(DynamicallyAccessedMemberTypes serviceDynamicallyAccessedMembers, DynamicallyAccessedMemberTypes implementationDynamicallyAccessedMembers)
		{
			return serviceDynamicallyAccessedMembers.HasFlag(implementationDynamicallyAccessedMembers);
		}

		internal int? GetSlot(ServiceDescriptor serviceDescriptor)
		{
			if (_descriptorLookup.TryGetValue(serviceDescriptor.ServiceType, out var value))
			{
				return value.GetSlot(serviceDescriptor);
			}
			return null;
		}

		internal ServiceCallSite? GetCallSite(Type serviceType, CallSiteChain callSiteChain)
		{
			if (!_callSiteCache.TryGetValue(new ServiceCacheKey(serviceType, 0), out var value))
			{
				return CreateCallSite(serviceType, callSiteChain);
			}
			return value;
		}

		internal ServiceCallSite? GetCallSite(ServiceDescriptor serviceDescriptor, CallSiteChain callSiteChain)
		{
			if (_descriptorLookup.TryGetValue(serviceDescriptor.ServiceType, out var value))
			{
				return TryCreateExact(serviceDescriptor, serviceDescriptor.ServiceType, callSiteChain, value.GetSlot(serviceDescriptor));
			}
			return null;
		}

		private ServiceCallSite CreateCallSite(Type serviceType, CallSiteChain callSiteChain)
		{
			if (!_stackGuard.TryEnterOnCurrentStack())
			{
				return _stackGuard.RunOnEmptyStack(CreateCallSite, serviceType, callSiteChain);
			}
			object orAdd = _callSiteLocks.GetOrAdd(serviceType, (Type _) => new object());
			lock (orAdd)
			{
				callSiteChain.CheckCircularDependency(serviceType);
				return TryCreateExact(serviceType, callSiteChain) ?? TryCreateOpenGeneric(serviceType, callSiteChain) ?? TryCreateEnumerable(serviceType, callSiteChain);
			}
		}

		private ServiceCallSite TryCreateExact(Type serviceType, CallSiteChain callSiteChain)
		{
			if (_descriptorLookup.TryGetValue(serviceType, out var value))
			{
				return TryCreateExact(value.Last, serviceType, callSiteChain, 0);
			}
			return null;
		}

		private ServiceCallSite TryCreateOpenGeneric(Type serviceType, CallSiteChain callSiteChain)
		{
			if (serviceType.IsConstructedGenericType && _descriptorLookup.TryGetValue(serviceType.GetGenericTypeDefinition(), out var value))
			{
				return TryCreateOpenGeneric(value.Last, serviceType, callSiteChain, 0, throwOnConstraintViolation: true);
			}
			return null;
		}

		private ServiceCallSite TryCreateEnumerable(Type serviceType, CallSiteChain callSiteChain)
		{
			ServiceCacheKey serviceCacheKey = new ServiceCacheKey(serviceType, 0);
			if (_callSiteCache.TryGetValue(serviceCacheKey, out var value))
			{
				return value;
			}
			ServiceCallSite serviceCallSite4;
			try
			{
				callSiteChain.Add(serviceType);
				if (serviceType.IsConstructedGenericType && serviceType.GetGenericTypeDefinition() == typeof(IEnumerable<>))
				{
					Type type = serviceType.GenericTypeArguments[0];
					CallSiteResultCacheLocation callSiteResultCacheLocation = CallSiteResultCacheLocation.Root;
					List<ServiceCallSite> list = new List<ServiceCallSite>();
					if (!type.IsConstructedGenericType && _descriptorLookup.TryGetValue(type, out var value2))
					{
						for (int i = 0; i < value2.Count; i++)
						{
							ServiceDescriptor descriptor = value2[i];
							int slot = value2.Count - i - 1;
							ServiceCallSite serviceCallSite = TryCreateExact(descriptor, type, callSiteChain, slot);
							callSiteResultCacheLocation = GetCommonCacheLocation(callSiteResultCacheLocation, serviceCallSite.Cache.Location);
							list.Add(serviceCallSite);
						}
					}
					else
					{
						int num = 0;
						for (int num2 = _descriptors.Length - 1; num2 >= 0; num2--)
						{
							ServiceDescriptor descriptor2 = _descriptors[num2];
							ServiceCallSite serviceCallSite2 = TryCreateExact(descriptor2, type, callSiteChain, num) ?? TryCreateOpenGeneric(descriptor2, type, callSiteChain, num, throwOnConstraintViolation: false);
							if (serviceCallSite2 != null)
							{
								num++;
								callSiteResultCacheLocation = GetCommonCacheLocation(callSiteResultCacheLocation, serviceCallSite2.Cache.Location);
								list.Add(serviceCallSite2);
							}
						}
						list.Reverse();
					}
					ResultCache cache = ResultCache.None;
					if (callSiteResultCacheLocation == CallSiteResultCacheLocation.Scope || callSiteResultCacheLocation == CallSiteResultCacheLocation.Root)
					{
						cache = new ResultCache(callSiteResultCacheLocation, serviceCacheKey);
					}
					serviceCallSite4 = (_callSiteCache[serviceCacheKey] = new IEnumerableCallSite(cache, type, list.ToArray()));
					serviceCallSite4 = serviceCallSite4;
				}
				else
				{
					serviceCallSite4 = null;
				}
			}
			finally
			{
				callSiteChain.Remove(serviceType);
			}
			return serviceCallSite4;
		}

		private static CallSiteResultCacheLocation GetCommonCacheLocation(CallSiteResultCacheLocation locationA, CallSiteResultCacheLocation locationB)
		{
			return (CallSiteResultCacheLocation)Math.Max((int)locationA, (int)locationB);
		}

		private ServiceCallSite TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, int slot)
		{
			if (serviceType == descriptor.ServiceType)
			{
				ServiceCacheKey key = new ServiceCacheKey(serviceType, slot);
				if (_callSiteCache.TryGetValue(key, out var value))
				{
					return value;
				}
				ResultCache resultCache = new ResultCache(descriptor.Lifetime, serviceType, slot);
				ServiceCallSite serviceCallSite;
				if (descriptor.ImplementationInstance != null)
				{
					serviceCallSite = new ConstantCallSite(descriptor.ServiceType, descriptor.ImplementationInstance);
				}
				else if (descriptor.ImplementationFactory != null)
				{
					serviceCallSite = new FactoryCallSite(resultCache, descriptor.ServiceType, descriptor.ImplementationFactory);
				}
				else
				{
					if (!(descriptor.ImplementationType != null))
					{
						throw new InvalidOperationException(System.SR.InvalidServiceDescriptor);
					}
					serviceCallSite = CreateConstructorCallSite(resultCache, descriptor.ServiceType, descriptor.ImplementationType, callSiteChain);
				}
				return _callSiteCache[key] = serviceCallSite;
			}
			return null;
		}

		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2055:MakeGenericType", Justification = "MakeGenericType here is used to create a closed generic implementation type given the closed service type. Trimming annotations on the generic types are verified when 'Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability' is set, which is set by default when PublishTrimmed=true. That check informs developers when these generic types don't have compatible trimming annotations.")]
		private ServiceCallSite TryCreateOpenGeneric(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, int slot, bool throwOnConstraintViolation)
		{
			if (serviceType.IsConstructedGenericType && serviceType.GetGenericTypeDefinition() == descriptor.ServiceType)
			{
				ServiceCacheKey key = new ServiceCacheKey(serviceType, slot);
				if (_callSiteCache.TryGetValue(key, out var value))
				{
					return value;
				}
				ResultCache lifetime = new ResultCache(descriptor.Lifetime, serviceType, slot);
				Type implementationType;
				try
				{
					implementationType = descriptor.ImplementationType.MakeGenericType(serviceType.GenericTypeArguments);
				}
				catch (ArgumentException)
				{
					if (throwOnConstraintViolation)
					{
						throw;
					}
					return null;
				}
				return _callSiteCache[key] = CreateConstructorCallSite(lifetime, serviceType, implementationType, callSiteChain);
			}
			return null;
		}

		private ServiceCallSite CreateConstructorCallSite(ResultCache lifetime, Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType, CallSiteChain callSiteChain)
		{
			try
			{
				callSiteChain.Add(serviceType, implementationType);
				ConstructorInfo[] constructors = implementationType.GetConstructors();
				ServiceCallSite[] parameterCallSites = null;
				if (constructors.Length == 0)
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.NoConstructorMatch, implementationType));
				}
				if (constructors.Length == 1)
				{
					ConstructorInfo constructorInfo = constructors[0];
					ParameterInfo[] parameters = constructorInfo.GetParameters();
					if (parameters.Length == 0)
					{
						return new ConstructorCallSite(lifetime, serviceType, constructorInfo);
					}
					parameterCallSites = CreateArgumentCallSites(implementationType, callSiteChain, parameters, throwIfCallSiteNotFound: true);
					return new ConstructorCallSite(lifetime, serviceType, constructorInfo, parameterCallSites);
				}
				Array.Sort(constructors, (ConstructorInfo a, ConstructorInfo b) => b.GetParameters().Length.CompareTo(a.GetParameters().Length));
				ConstructorInfo constructorInfo2 = null;
				HashSet<Type> hashSet = null;
				for (int i = 0; i < constructors.Length; i++)
				{
					ParameterInfo[] parameters2 = constructors[i].GetParameters();
					ServiceCallSite[] array = CreateArgumentCallSites(implementationType, callSiteChain, parameters2, throwIfCallSiteNotFound: false);
					if (array == null)
					{
						continue;
					}
					if (constructorInfo2 == null)
					{
						constructorInfo2 = constructors[i];
						parameterCallSites = array;
						continue;
					}
					if (hashSet == null)
					{
						hashSet = new HashSet<Type>();
						ParameterInfo[] parameters3 = constructorInfo2.GetParameters();
						foreach (ParameterInfo parameterInfo in parameters3)
						{
							hashSet.Add(parameterInfo.ParameterType);
						}
					}
					ParameterInfo[] array2 = parameters2;
					foreach (ParameterInfo parameterInfo2 in array2)
					{
						if (!hashSet.Contains(parameterInfo2.ParameterType))
						{
							throw new InvalidOperationException(string.Join(Environment.NewLine, System.SR.Format(System.SR.AmbiguousConstructorException, implementationType), constructorInfo2, constructors[i]));
						}
					}
				}
				if (constructorInfo2 == null)
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.UnableToActivateTypeException, implementationType));
				}
				return new ConstructorCallSite(lifetime, serviceType, constructorInfo2, parameterCallSites);
			}
			finally
			{
				callSiteChain.Remove(serviceType);
			}
		}

		private ServiceCallSite[] CreateArgumentCallSites(Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, bool throwIfCallSiteNotFound)
		{
			ServiceCallSite[] array = new ServiceCallSite[parameters.Length];
			for (int i = 0; i < parameters.Length; i++)
			{
				Type parameterType = parameters[i].ParameterType;
				ServiceCallSite serviceCallSite = GetCallSite(parameterType, callSiteChain);
				if (serviceCallSite == null && Microsoft.Extensions.Internal.ParameterDefaultValue.TryGetDefaultValue(parameters[i], out object defaultValue))
				{
					serviceCallSite = new ConstantCallSite(parameterType, defaultValue);
				}
				if (serviceCallSite == null)
				{
					if (throwIfCallSiteNotFound)
					{
						throw new InvalidOperationException(System.SR.Format(System.SR.CannotResolveService, parameterType, implementationType));
					}
					return null;
				}
				array[i] = serviceCallSite;
			}
			return array;
		}

		public void Add(Type type, ServiceCallSite serviceCallSite)
		{
			_callSiteCache[new ServiceCacheKey(type, 0)] = serviceCallSite;
		}

		public bool IsService(Type serviceType)
		{
			if ((object)serviceType == null)
			{
				throw new ArgumentNullException("serviceType");
			}
			if (serviceType.IsGenericTypeDefinition)
			{
				return false;
			}
			if (_descriptorLookup.ContainsKey(serviceType))
			{
				return true;
			}
			if (serviceType.IsConstructedGenericType)
			{
				Type genericTypeDefinition = serviceType.GetGenericTypeDefinition();
				if ((object)genericTypeDefinition != null)
				{
					if (!(genericTypeDefinition == typeof(IEnumerable<>)))
					{
						return _descriptorLookup.ContainsKey(genericTypeDefinition);
					}
					return true;
				}
			}
			if (!(serviceType == typeof(IServiceProvider)) && !(serviceType == typeof(IServiceScopeFactory)))
			{
				return serviceType == typeof(IServiceProviderIsService);
			}
			return true;
		}
	}
	internal enum CallSiteKind
	{
		Factory,
		Constructor,
		Constant,
		IEnumerable,
		ServiceProvider
	}
	internal enum CallSiteResultCacheLocation
	{
		Root,
		Scope,
		Dispose,
		None
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class CallSiteRuntimeResolver : CallSiteVisitor<RuntimeResolverContext, object?>
	{
		public static CallSiteRuntimeResolver Instance { get; } = new CallSiteRuntimeResolver();


		private CallSiteRuntimeResolver()
		{
		}

		public object? Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
		{
			if (scope.IsRootScope)
			{
				object value = callSite.Value;
				if (value != null)
				{
					return value;
				}
			}
			return VisitCallSite(callSite, new RuntimeResolverContext
			{
				Scope = scope
			});
		}

		protected override object? VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)
		{
			return context.Scope.CaptureDisposable(VisitCallSiteMain(transientCallSite, context));
		}

		protected override object VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
		{
			object[] array;
			if (constructorCallSite.ParameterCallSites.Length == 0)
			{
				array = Array.Empty<object>();
			}
			else
			{
				array = new object[constructorCallSite.ParameterCallSites.Length];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = VisitCallSite(constructorCallSite.ParameterCallSites[i], context);
				}
			}
			return constructorCallSite.ConstructorInfo.Invoke(BindingFlags.DoNotWrapExceptions, null, array, null);
		}

		protected override object? VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
		{
			object value = callSite.Value;
			if (value != null)
			{
				return value;
			}
			RuntimeResolverLock runtimeResolverLock = RuntimeResolverLock.Root;
			ServiceProviderEngineScope root = context.Scope.RootProvider.Root;
			lock (callSite)
			{
				object value2 = callSite.Value;
				if (value2 != null)
				{
					return value2;
				}
				object obj = VisitCallSiteMain(callSite, new RuntimeResolverContext
				{
					Scope = root,
					AcquiredLocks = (context.AcquiredLocks | runtimeResolverLock)
				});
				root.CaptureDisposable(obj);
				callSite.Value = obj;
				return obj;
			}
		}

		protected override object? VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
		{
			if (!context.Scope.IsRootScope)
			{
				return VisitCache(callSite, context, context.Scope, RuntimeResolverLock.Scope);
			}
			return VisitRootCache(callSite, context);
		}

		private object VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
		{
			bool lockTaken = false;
			object sync = serviceProviderEngine.Sync;
			Dictionary<ServiceCacheKey, object> resolvedServices = serviceProviderEngine.ResolvedServices;
			if ((context.AcquiredLocks & lockType) == 0)
			{
				Monitor.Enter(sync, ref lockTaken);
			}
			try
			{
				if (resolvedServices.TryGetValue(callSite.Cache.Key, out var value))
				{
					return value;
				}
				value = VisitCallSiteMain(callSite, new RuntimeResolverContext
				{
					Scope = serviceProviderEngine,
					AcquiredLocks = (context.AcquiredLocks | lockType)
				});
				serviceProviderEngine.CaptureDisposable(value);
				resolvedServices.Add(callSite.Cache.Key, value);
				return value;
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(sync);
				}
			}
		}

		protected override object? VisitConstant(ConstantCallSite constantCallSite, RuntimeResolverContext context)
		{
			return constantCallSite.DefaultValue;
		}

		protected override object VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, RuntimeResolverContext context)
		{
			return context.Scope;
		}

		protected override object VisitIEnumerable(IEnumerableCallSite enumerableCallSite, RuntimeResolverContext context)
		{
			Array array = Array.CreateInstance(enumerableCallSite.ItemType, enumerableCallSite.ServiceCallSites.Length);
			for (int i = 0; i < enumerableCallSite.ServiceCallSites.Length; i++)
			{
				object value = VisitCallSite(enumerableCallSite.ServiceCallSites[i], context);
				array.SetValue(value, i);
			}
			return array;
		}

		protected override object VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
		{
			return factoryCallSite.Factory(context.Scope);
		}
	}
	internal struct RuntimeResolverContext
	{
		public ServiceProviderEngineScope Scope { get; set; }

		public RuntimeResolverLock AcquiredLocks { get; set; }
	}
	[Flags]
	internal enum RuntimeResolverLock
	{
		Scope = 1,
		Root = 2
	}
	internal sealed class CallSiteValidator : CallSiteVisitor<CallSiteValidator.CallSiteValidatorState, Type?>
	{
		internal struct CallSiteValidatorState
		{
			public ServiceCallSite? Singleton
			{
				get; [param: DisallowNull]
				set;
			}
		}

		private readonly ConcurrentDictionary<Type, Type> _scopedServices = new ConcurrentDictionary<Type, Type>();

		public void ValidateCallSite(ServiceCallSite callSite)
		{
			Type type = VisitCallSite(callSite, default(CallSiteValidatorState));
			if (type != null)
			{
				_scopedServices[callSite.ServiceType] = type;
			}
		}

		public void ValidateResolution(Type serviceType, IServiceScope scope, IServiceScope rootScope)
		{
			if (scope == rootScope && _scopedServices.TryGetValue(serviceType, out var value))
			{
				if (serviceType == value)
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.DirectScopedResolvedFromRootException, serviceType, "Scoped".ToLowerInvariant()));
				}
				throw new InvalidOperationException(System.SR.Format(System.SR.ScopedResolvedFromRootException, serviceType, value, "Scoped".ToLowerInvariant()));
			}
		}

		protected override Type? VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
		{
			Type type = null;
			ServiceCallSite[] parameterCallSites = constructorCallSite.ParameterCallSites;
			foreach (ServiceCallSite callSite in parameterCallSites)
			{
				Type type2 = VisitCallSite(callSite, state);
				if ((object)type == null)
				{
					type = type2;
				}
			}
			return type;
		}

		protected override Type? VisitIEnumerable(IEnumerableCallSite enumerableCallSite, CallSiteValidatorState state)
		{
			Type type = null;
			ServiceCallSite[] serviceCallSites = enumerableCallSite.ServiceCallSites;
			foreach (ServiceCallSite callSite in serviceCallSites)
			{
				Type type2 = VisitCallSite(callSite, state);
				if ((object)type == null)
				{
					type = type2;
				}
			}
			return type;
		}

		protected override Type? VisitRootCache(ServiceCallSite singletonCallSite, CallSiteValidatorState state)
		{
			state.Singleton = singletonCallSite;
			return VisitCallSiteMain(singletonCallSite, state);
		}

		protected override Type? VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
		{
			if (scopedCallSite.ServiceType == typeof(IServiceScopeFactory))
			{
				return null;
			}
			if (state.Singleton != null)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.ScopedInSingletonException, scopedCallSite.ServiceType, state.Singleton.ServiceType, "Scoped".ToLowerInvariant(), "Singleton".ToLowerInvariant()));
			}
			VisitCallSiteMain(scopedCallSite, state);
			return scopedCallSite.ServiceType;
		}

		protected override Type? VisitConstant(ConstantCallSite constantCallSite, CallSiteValidatorState state)
		{
			return null;
		}

		protected override Type? VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, CallSiteValidatorState state)
		{
			return null;
		}

		protected override Type? VisitFactory(FactoryCallSite factoryCallSite, CallSiteValidatorState state)
		{
			return null;
		}
	}
	internal abstract class CallSiteVisitor<TArgument, TResult>
	{
		private readonly StackGuard _stackGuard;

		protected CallSiteVisitor()
		{
			_stackGuard = new StackGuard();
		}

		protected virtual TResult VisitCallSite(ServiceCallSite callSite, TArgument argument)
		{
			if (!_stackGuard.TryEnterOnCurrentStack())
			{
				return _stackGuard.RunOnEmptyStack(VisitCallSite, callSite, argument);
			}
			return callSite.Cache.Location switch
			{
				CallSiteResultCacheLocation.Root => VisitRootCache(callSite, argument), 
				CallSiteResultCacheLocation.Scope => VisitScopeCache(callSite, argument), 
				CallSiteResultCacheLocation.Dispose => VisitDisposeCache(callSite, argument), 
				CallSiteResultCacheLocation.None => VisitNoCache(callSite, argument), 
				_ => throw new ArgumentOutOfRangeException(), 
			};
		}

		protected virtual TResult VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
		{
			return callSite.Kind switch
			{
				CallSiteKind.Factory => VisitFactory((FactoryCallSite)callSite, argument), 
				CallSiteKind.IEnumerable => VisitIEnumerable((IEnumerableCallSite)callSite, argument), 
				CallSiteKind.Constructor => VisitConstructor((ConstructorCallSite)callSite, argument), 
				CallSiteKind.Constant => VisitConstant((ConstantCallSite)callSite, argument), 
				CallSiteKind.ServiceProvider => VisitServiceProvider((ServiceProviderCallSite)callSite, argument), 
				_ => throw new NotSupportedException(System.SR.Format(System.SR.CallSiteTypeNotSupported, callSite.GetType())), 
			};
		}

		protected virtual TResult VisitNoCache(ServiceCallSite callSite, TArgument argument)
		{
			return VisitCallSiteMain(callSite, argument);
		}

		protected virtual TResult VisitDisposeCache(ServiceCallSite callSite, TArgument argument)
		{
			return VisitCallSiteMain(callSite, argument);
		}

		protected virtual TResult VisitRootCache(ServiceCallSite callSite, TArgument argument)
		{
			return VisitCallSiteMain(callSite, argument);
		}

		protected virtual TResult VisitScopeCache(ServiceCallSite callSite, TArgument argument)
		{
			return VisitCallSiteMain(callSite, argument);
		}

		protected abstract TResult VisitConstructor(ConstructorCallSite constructorCallSite, TArgument argument);

		protected abstract TResult VisitConstant(ConstantCallSite constantCallSite, TArgument argument);

		protected abstract TResult VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, TArgument argument);

		protected abstract TResult VisitIEnumerable(IEnumerableCallSite enumerableCallSite, TArgument argument);

		protected abstract TResult VisitFactory(FactoryCallSite factoryCallSite, TArgument argument);
	}
	internal abstract class CompiledServiceProviderEngine : ServiceProviderEngine
	{
		public ILEmitResolverBuilder ResolverBuilder { get; }

		[RequiresDynamicCode("Creates DynamicMethods")]
		public CompiledServiceProviderEngine(ServiceProvider provider)
		{
			ResolverBuilder = new ILEmitResolverBuilder(provider);
		}

		public override Func<ServiceProviderEngineScope, object?> RealizeService(ServiceCallSite callSite)
		{
			return ResolverBuilder.Build(callSite);
		}
	}
	internal sealed class ConstantCallSite : ServiceCallSite
	{
		private readonly Type _serviceType;

		internal object? DefaultValue => base.Value;

		public override Type ServiceType => _serviceType;

		public override Type ImplementationType => DefaultValue?.GetType() ?? _serviceType;

		public override CallSiteKind Kind { get; } = CallSiteKind.Constant;


		public ConstantCallSite(Type serviceType, object? defaultValue)
			: base(ResultCache.None)
		{
			_serviceType = serviceType ?? throw new ArgumentNullException("serviceType");
			if (defaultValue != null && !serviceType.IsInstanceOfType(defaultValue))
			{
				throw new ArgumentException(System.SR.Format(System.SR.ConstantCantBeConvertedToServiceType, defaultValue.GetType(), serviceType));
			}
			base.Value = defaultValue;
		}
	}
	internal sealed class ConstructorCallSite : ServiceCallSite
	{
		internal ConstructorInfo ConstructorInfo { get; }

		internal ServiceCallSite[] ParameterCallSites { get; }

		public override Type ServiceType { get; }

		public override Type? ImplementationType => ConstructorInfo.DeclaringType;

		public override CallSiteKind Kind { get; } = CallSiteKind.Constructor;


		public ConstructorCallSite(ResultCache cache, Type serviceType, ConstructorInfo constructorInfo)
			: this(cache, serviceType, constructorInfo, Array.Empty<ServiceCallSite>())
		{
		}

		public ConstructorCallSite(ResultCache cache, Type serviceType, ConstructorInfo constructorInfo, ServiceCallSite[] parameterCallSites)
			: base(cache)
		{
			if (!serviceType.IsAssignableFrom(constructorInfo.DeclaringType))
			{
				throw new ArgumentException(System.SR.Format(System.SR.ImplementationTypeCantBeConvertedToServiceType, constructorInfo.DeclaringType, serviceType));
			}
			ServiceType = serviceType;
			ConstructorInfo = constructorInfo;
			ParameterCallSites = parameterCallSites;
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class DynamicServiceProviderEngine : CompiledServiceProviderEngine
	{
		private readonly ServiceProvider _serviceProvider;

		public DynamicServiceProviderEngine(ServiceProvider serviceProvider)
			: base(serviceProvider)
		{
			_serviceProvider = serviceProvider;
		}

		public override Func<ServiceProviderEngineScope, object?> RealizeService(ServiceCallSite callSite)
		{
			ServiceCallSite callSite2 = callSite;
			int callCount = 0;
			return delegate(ServiceProviderEngineScope scope)
			{
				object result = CallSiteRuntimeResolver.Instance.Resolve(callSite2, scope);
				if (Interlocked.Increment(ref callCount) == 2)
				{
					ThreadPool.UnsafeQueueUserWorkItem(delegate
					{
						try
						{
							_serviceProvider.ReplaceServiceAccessor(callSite2, base.RealizeService(callSite2));
						}
						catch (Exception exception)
						{
							DependencyInjectionEventSource.Log.ServiceRealizationFailed(exception, _serviceProvider.GetHashCode());
						}
					}, null);
				}
				return result;
			};
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class ExpressionResolverBuilder : CallSiteVisitor<object?, Expression>
	{
		private static readonly ParameterExpression ScopeParameter = Expression.Parameter(typeof(ServiceProviderEngineScope));

		private static readonly ParameterExpression ResolvedServices = Expression.Variable(typeof(IDictionary<ServiceCacheKey, object>), ScopeParameter.Name + "resolvedServices");

		private static readonly ParameterExpression Sync = Expression.Variable(typeof(object), ScopeParameter.Name + "sync");

		private static readonly BinaryExpression ResolvedServicesVariableAssignment = Expression.Assign(ResolvedServices, Expression.Property(ScopeParameter, typeof(ServiceProviderEngineScope).GetProperty("ResolvedServices", BindingFlags.Instance | BindingFlags.NonPublic)));

		private static readonly BinaryExpression SyncVariableAssignment = Expression.Assign(Sync, Expression.Property(ScopeParameter, typeof(ServiceProviderEngineScope).GetProperty("Sync", BindingFlags.Instance | BindingFlags.NonPublic)));

		private static readonly ParameterExpression CaptureDisposableParameter = Expression.Parameter(typeof(object));

		private static readonly LambdaExpression CaptureDisposable = Expression.Lambda(Expression.Call(ScopeParameter, ServiceLookupHelpers.CaptureDisposableMethodInfo, CaptureDisposableParameter), CaptureDisposableParameter);

		private static readonly ConstantExpression CallSiteRuntimeResolverInstanceExpression = Expression.Constant(CallSiteRuntimeResolver.Instance, typeof(CallSiteRuntimeResolver));

		private readonly ServiceProviderEngineScope _rootScope;

		private readonly ConcurrentDictionary<ServiceCacheKey, Func<ServiceProviderEngineScope, object>> _scopeResolverCache;

		private readonly Func<ServiceCacheKey, ServiceCallSite, Func<ServiceProviderEngineScope, object>> _buildTypeDelegate;

		public ExpressionResolverBuilder(ServiceProvider serviceProvider)
		{
			_rootScope = serviceProvider.Root;
			_scopeResolverCache = new ConcurrentDictionary<ServiceCacheKey, Func<ServiceProviderEngineScope, object>>();
			_buildTypeDelegate = (ServiceCacheKey key, ServiceCallSite cs) => BuildNoCache(cs);
		}

		public Func<ServiceProviderEngineScope, object> Build(ServiceCallSite callSite)
		{
			if (callSite.Cache.Location == CallSiteResultCacheLocation.Scope)
			{
				return _scopeResolverCache.GetOrAdd(callSite.Cache.Key, _buildTypeDelegate, callSite);
			}
			return BuildNoCache(callSite);
		}

		public Func<ServiceProviderEngineScope, object> BuildNoCache(ServiceCallSite callSite)
		{
			Expression<Func<ServiceProviderEngineScope, object>> expression = BuildExpression(callSite);
			DependencyInjectionEventSource.Log.ExpressionTreeGenerated(_rootScope.RootProvider, callSite.ServiceType, expression);
			return expression.Compile();
		}

		private Expression<Func<ServiceProviderEngineScope, object>> BuildExpression(ServiceCallSite callSite)
		{
			if (callSite.Cache.Location == CallSiteResultCacheLocation.Scope)
			{
				return Expression.Lambda<Func<ServiceProviderEngineScope, object>>(Expression.Block(new ParameterExpression[2] { ResolvedServices, Sync }, ResolvedServicesVariableAssignment, SyncVariableAssignment, BuildScopedExpression(callSite)), new ParameterExpression[1] { ScopeParameter });
			}
			return Expression.Lambda<Func<ServiceProviderEngineScope, object>>(Convert(VisitCallSite(callSite, null), typeof(object), forceValueTypeConversion: true), new ParameterExpression[1] { ScopeParameter });
		}

		protected override Expression VisitRootCache(ServiceCallSite singletonCallSite, object? context)
		{
			return Expression.Constant(CallSiteRuntimeResolver.Instance.Resolve(singletonCallSite, _rootScope));
		}

		protected override Expression VisitConstant(ConstantCallSite constantCallSite, object? context)
		{
			return Expression.Constant(constantCallSite.DefaultValue);
		}

		protected override Expression VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, object? context)
		{
			return ScopeParameter;
		}

		protected override Expression VisitFactory(FactoryCallSite factoryCallSite, object? context)
		{
			return Expression.Invoke(Expression.Constant(factoryCallSite.Factory), ScopeParameter);
		}

		protected override Expression VisitIEnumerable(IEnumerableCallSite callSite, object? context)
		{
			object context2 = context;
			IEnumerableCallSite callSite2 = callSite;
			if (callSite2.ServiceCallSites.Length == 0)
			{
				return Expression.Constant(ServiceLookupHelpers.GetArrayEmptyMethodInfo(callSite2.ItemType).Invoke(null, Array.Empty<object>()));
			}
			return Expression.NewArrayInit(callSite2.ItemType, callSite2.ServiceCallSites.Select((ServiceCallSite cs) => Convert(VisitCallSite(cs, context2), callSite2.ItemType)));
		}

		protected override Expression VisitDisposeCache(ServiceCallSite callSite, object? context)
		{
			return TryCaptureDisposable(callSite, ScopeParameter, VisitCallSiteMain(callSite, context));
		}

		private static Expression TryCaptureDisposable(ServiceCallSite callSite, ParameterExpression scope, Expression service)
		{
			if (!callSite.CaptureDisposable)
			{
				return service;
			}
			return Expression.Invoke(GetCaptureDisposable(scope), service);
		}

		protected override Expression VisitConstructor(ConstructorCallSite callSite, object? context)
		{
			ParameterInfo[] parameters = callSite.ConstructorInfo.GetParameters();
			Expression[] array;
			if (callSite.ParameterCallSites.Length == 0)
			{
				array = Array.Empty<Expression>();
			}
			else
			{
				array = new Expression[callSite.ParameterCallSites.Length];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = Convert(VisitCallSite(callSite.ParameterCallSites[i], context), parameters[i].ParameterType);
				}
			}
			Expression expression = Expression.New(callSite.ConstructorInfo, array);
			if (callSite.ImplementationType.IsValueType)
			{
				expression = Expression.Convert(expression, typeof(object));
			}
			return expression;
		}

		private static Expression Convert(Expression expression, Type type, bool forceValueTypeConversion = false)
		{
			if (type.IsAssignableFrom(expression.Type) && (!expression.Type.IsValueType || !forceValueTypeConversion))
			{
				return expression;
			}
			return Expression.Convert(expression, type);
		}

		protected override Expression VisitScopeCache(ServiceCallSite callSite, object? context)
		{
			Func<ServiceProviderEngineScope, object> value = Build(callSite);
			return Expression.Invoke(Expression.Constant(value), ScopeParameter);
		}

		private Expression BuildScopedExpression(ServiceCallSite callSite)
		{
			ConstantExpression arg = Expression.Constant(callSite, typeof(ServiceCallSite));
			MethodCallExpression ifTrue = Expression.Call(CallSiteRuntimeResolverInstanceExpression, ServiceLookupHelpers.ResolveCallSiteAndScopeMethodInfo, arg, ScopeParameter);
			ConstantExpression arg2 = Expression.Constant(callSite.Cache.Key, typeof(ServiceCacheKey));
			ParameterExpression parameterExpression = Expression.Variable(typeof(object), "resolved");
			ParameterExpression resolvedServices = ResolvedServices;
			MethodCallExpression expression = Expression.Call(resolvedServices, ServiceLookupHelpers.TryGetValueMethodInfo, arg2, parameterExpression);
			Expression right = TryCaptureDisposable(callSite, ScopeParameter, VisitCallSiteMain(callSite, null));
			BinaryExpression arg3 = Expression.Assign(parameterExpression, right);
			MethodCallExpression arg4 = Expression.Call(resolvedServices, ServiceLookupHelpers.AddMethodInfo, arg2, parameterExpression);
			BlockExpression arg5 = Expression.Block(typeof(object), new ParameterExpression[1] { parameterExpression }, Expression.IfThen(Expression.Not(expression), Expression.Block(arg3, arg4)), parameterExpression);
			ParameterExpression parameterExpression2 = Expression.Variable(typeof(bool), "lockWasTaken");
			ParameterExpression sync = Sync;
			MethodCallExpression arg6 = Expression.Call(ServiceLookupHelpers.MonitorEnterMethodInfo, sync, parameterExpression2);
			MethodCallExpression ifTrue2 = Expression.Call(ServiceLookupHelpers.MonitorExitMethodInfo, sync);
			BlockExpression body = Expression.Block(arg6, arg5);
			ConditionalExpression @finally = Expression.IfThen(parameterExpression2, ifTrue2);
			return Expression.Condition(Expression.Property(ScopeParameter, typeof(ServiceProviderEngineScope).GetProperty("IsRootScope", BindingFlags.Instance | BindingFlags.Public)), ifTrue, Expression.Block(typeof(object), new ParameterExpression[1] { parameterExpression2 }, Expression.TryFinally(body, @finally)));
		}

		public static Expression GetCaptureDisposable(ParameterExpression scope)
		{
			if (scope != ScopeParameter)
			{
				throw new NotSupportedException(System.SR.GetCaptureDisposableNotSupported);
			}
			return CaptureDisposable;
		}
	}
	internal sealed class ExpressionsServiceProviderEngine : ServiceProviderEngine
	{
		private readonly ExpressionResolverBuilder _expressionResolverBuilder;

		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		public ExpressionsServiceProviderEngine(ServiceProvider serviceProvider)
		{
			_expressionResolverBuilder = new ExpressionResolverBuilder(serviceProvider);
		}

		public override Func<ServiceProviderEngineScope, object> RealizeService(ServiceCallSite callSite)
		{
			return _expressionResolverBuilder.Build(callSite);
		}
	}
	internal sealed class FactoryCallSite : ServiceCallSite
	{
		public Func<IServiceProvider, object> Factory { get; }

		public override Type ServiceType { get; }

		public override Type? ImplementationType => null;

		public override CallSiteKind Kind { get; }

		public FactoryCallSite(ResultCache cache, Type serviceType, Func<IServiceProvider, object> factory)
			: base(cache)
		{
			Factory = factory;
			ServiceType = serviceType;
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class IEnumerableCallSite : ServiceCallSite
	{
		internal Type ItemType { get; }

		internal ServiceCallSite[] ServiceCallSites { get; }

		public override Type ServiceType => typeof(IEnumerable<>).MakeGenericType(ItemType);

		public override Type ImplementationType => ItemType.MakeArrayType();

		public override CallSiteKind Kind { get; } = CallSiteKind.IEnumerable;


		public IEnumerableCallSite(ResultCache cache, Type itemType, ServiceCallSite[] serviceCallSites)
			: base(cache)
		{
			ItemType = itemType;
			ServiceCallSites = serviceCallSites;
		}
	}
	internal struct ResultCache
	{
		public static ResultCache None { get; } = new ResultCache(CallSiteResultCacheLocation.None, ServiceCacheKey.Empty);


		public CallSiteResultCacheLocation Location { get; set; }

		public ServiceCacheKey Key { get; set; }

		internal ResultCache(CallSiteResultCacheLocation lifetime, ServiceCacheKey cacheKey)
		{
			Location = lifetime;
			Key = cacheKey;
		}

		public ResultCache(ServiceLifetime lifetime, Type? type, int slot)
		{
			switch (lifetime)
			{
			case ServiceLifetime.Singleton:
				Location = CallSiteResultCacheLocation.Root;
				break;
			case ServiceLifetime.Scoped:
				Location = CallSiteResultCacheLocation.Scope;
				break;
			case ServiceLifetime.Transient:
				Location = CallSiteResultCacheLocation.Dispose;
				break;
			default:
				Location = CallSiteResultCacheLocation.None;
				break;
			}
			Key = new ServiceCacheKey(type, slot);
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class RuntimeServiceProviderEngine : ServiceProviderEngine
	{
		public static RuntimeServiceProviderEngine Instance { get; } = new RuntimeServiceProviderEngine();


		private RuntimeServiceProviderEngine()
		{
		}

		public override Func<ServiceProviderEngineScope, object?> RealizeService(ServiceCallSite callSite)
		{
			ServiceCallSite callSite2 = callSite;
			return (ServiceProviderEngineScope scope) => CallSiteRuntimeResolver.Instance.Resolve(callSite2, scope);
		}
	}
	internal readonly struct ServiceCacheKey : IEquatable<ServiceCacheKey>
	{
		public static ServiceCacheKey Empty { get; } = new ServiceCacheKey(null, 0);


		public Type? Type { get; }

		public int Slot { get; }

		public ServiceCacheKey(Type? type, int slot)
		{
			Type = type;
			Slot = slot;
		}

		public bool Equals(ServiceCacheKey other)
		{
			if (Type == other.Type)
			{
				return Slot == other.Slot;
			}
			return false;
		}

		public override bool Equals([NotNullWhen(true)] object? obj)
		{
			if (obj is ServiceCacheKey other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return ((Type?.GetHashCode() ?? 23) * 397) ^ Slot;
		}
	}
	internal abstract class ServiceCallSite
	{
		public abstract Type ServiceType { get; }

		public abstract Type? ImplementationType { get; }

		public abstract CallSiteKind Kind { get; }

		public ResultCache Cache { get; }

		public object? Value { get; set; }

		public bool CaptureDisposable
		{
			get
			{
				if (!(ImplementationType == null) && !typeof(IDisposable).IsAssignableFrom(ImplementationType))
				{
					return typeof(IAsyncDisposable).IsAssignableFrom(ImplementationType);
				}
				return true;
			}
		}

		protected ServiceCallSite(ResultCache cache)
		{
			Cache = cache;
		}
	}
	internal static class ServiceLookupHelpers
	{
		private const BindingFlags LookupFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private static readonly MethodInfo ArrayEmptyMethodInfo = typeof(Array).GetMethod("Empty");

		internal static readonly MethodInfo InvokeFactoryMethodInfo = typeof(Func<IServiceProvider, object>).GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		internal static readonly MethodInfo CaptureDisposableMethodInfo = typeof(ServiceProviderEngineScope).GetMethod("CaptureDisposable", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		internal static readonly MethodInfo TryGetValueMethodInfo = typeof(IDictionary<ServiceCacheKey, object>).GetMethod("TryGetValue", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		internal static readonly MethodInfo ResolveCallSiteAndScopeMethodInfo = typeof(CallSiteRuntimeResolver).GetMethod("Resolve", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		internal static readonly MethodInfo AddMethodInfo = typeof(IDictionary<ServiceCacheKey, object>).GetMethod("Add", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		internal static readonly MethodInfo MonitorEnterMethodInfo = typeof(Monitor).GetMethod("Enter", BindingFlags.Static | BindingFlags.Public, null, new Type[2]
		{
			typeof(object),
			typeof(bool).MakeByRefType()
		}, null);

		internal static readonly MethodInfo MonitorExitMethodInfo = typeof(Monitor).GetMethod("Exit", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(object) }, null);

		[RequiresDynamicCode("The code for an array of the specified type might not be available.")]
		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060:MakeGenericMethod", Justification = "Calling Array.Empty<T>() is safe since the T doesn't have trimming annotations.")]
		internal static MethodInfo GetArrayEmptyMethodInfo(Type itemType)
		{
			return ArrayEmptyMethodInfo.MakeGenericMethod(itemType);
		}
	}
	internal sealed class ServiceProviderCallSite : ServiceCallSite
	{
		public override Type ServiceType { get; } = typeof(IServiceProvider);


		public override Type ImplementationType { get; } = typeof(ServiceProvider);


		public override CallSiteKind Kind { get; } = CallSiteKind.ServiceProvider;


		public ServiceProviderCallSite()
			: base(ResultCache.None)
		{
		}
	}
	internal abstract class ServiceProviderEngine
	{
		public abstract Func<ServiceProviderEngineScope, object?> RealizeService(ServiceCallSite callSite);
	}
	internal sealed class ServiceProviderEngineScope : IServiceScope, IDisposable, IServiceProvider, IAsyncDisposable, IServiceScopeFactory
	{
		private bool _disposed;

		private List<object> _disposables;

		internal IList<object> Disposables
		{
			get
			{
				IList<object> disposables = _disposables;
				return disposables ?? Array.Empty<object>();
			}
		}

		internal Dictionary<ServiceCacheKey, object?> ResolvedServices { get; }

		internal object Sync => ResolvedServices;

		public bool IsRootScope { get; }

		internal ServiceProvider RootProvider { get; }

		public IServiceProvider ServiceProvider => this;

		public ServiceProviderEngineScope(ServiceProvider provider, bool isRootScope)
		{
			ResolvedServices = new Dictionary<ServiceCacheKey, object>();
			RootProvider = provider;
			IsRootScope = isRootScope;
		}

		public object? GetService(Type serviceType)
		{
			if (_disposed)
			{
				ThrowHelper.ThrowObjectDisposedException();
			}
			return RootProvider.GetService(serviceType, this);
		}

		public IServiceScope CreateScope()
		{
			return RootProvider.CreateScope();
		}

		[return: NotNullIfNotNull("service")]
		internal object? CaptureDisposable(object? service)
		{
			object service2 = service;
			if (this == service2 || (!(service2 is IDisposable) && !(service2 is IAsyncDisposable)))
			{
				return service2;
			}
			bool flag = false;
			lock (Sync)
			{
				if (_disposed)
				{
					flag = true;
				}
				else
				{
					if (_disposables == null)
					{
						_disposables = new List<object>();
					}
					_disposables.Add(service2);
				}
			}
			if (flag)
			{
				if (service2 is IDisposable disposable)
				{
					disposable.Dispose();
				}
				else
				{
					Task.Run(() => ((IAsyncDisposable)service2).DisposeAsync().AsTask()).GetAwaiter().GetResult();
				}
				ThrowHelper.ThrowObjectDisposedException();
			}
			return service2;
		}

		public void Dispose()
		{
			List<object> list = BeginDispose();
			if (list == null)
			{
				return;
			}
			int num = list.Count - 1;
			while (num >= 0)
			{
				if (list[num] is IDisposable disposable)
				{
					disposable.Dispose();
					num--;
					continue;
				}
				throw new InvalidOperationException(System.SR.Format(System.SR.AsyncDisposableServiceDispose, TypeNameHelper.GetTypeDisplayName(list[num])));
			}
		}

		public ValueTask DisposeAsync()
		{
			List<object> list = BeginDispose();
			if (list != null)
			{
				try
				{
					for (int num = list.Count - 1; num >= 0; num--)
					{
						object obj = list[num];
						if (obj is IAsyncDisposable asyncDisposable)
						{
							ValueTask vt2 = asyncDisposable.DisposeAsync();
							if (!vt2.IsCompletedSuccessfully)
							{
								return Await(num, vt2, list);
							}
							vt2.GetAwaiter().GetResult();
						}
						else
						{
							((IDisposable)obj).Dispose();
						}
					}
				}
				catch (Exception exception)
				{
					return new ValueTask(Task.FromException(exception));
				}
			}
			return default(ValueTask);
			static async ValueTask Await(int i, ValueTask vt, List<object> toDispose)
			{
				await vt.ConfigureAwait(continueOnCapturedContext: false);
				i--;
				while (i >= 0)
				{
					object obj2 = toDispose[i];
					if (obj2 is IAsyncDisposable asyncDisposable2)
					{
						await asyncDisposable2.DisposeAsync().ConfigureAwait(continueOnCapturedContext: false);
					}
					else
					{
						((IDisposable)obj2).Dispose();
					}
					i--;
				}
			}
		}

		private List<object> BeginDispose()
		{
			lock (Sync)
			{
				if (_disposed)
				{
					return null;
				}
				DependencyInjectionEventSource.Log.ScopeDisposed(RootProvider.GetHashCode(), ResolvedServices.Count, _disposables?.Count ?? 0);
				_disposed = true;
			}
			if (IsRootScope && !RootProvider.IsDisposed())
			{
				RootProvider.Dispose();
			}
			return _disposables;
		}
	}
	internal sealed class StackGuard
	{
		private const int MaxExecutionStackCount = 1024;

		private int _executionStackCount;

		public bool TryEnterOnCurrentStack()
		{
			if (RuntimeHelpers.TryEnsureSufficientExecutionStack())
			{
				return true;
			}
			if (_executionStackCount < 1024)
			{
				return false;
			}
			throw new InsufficientExecutionStackException();
		}

		public TR RunOnEmptyStack<T1, T2, TR>(Func<T1, T2, TR> action, T1 arg1, T2 arg2)
		{
			return RunOnEmptyStackCore(delegate(object s)
			{
				(Func<T1, T2, TR>, T1, T2) tuple = ((Func<T1, T2, TR>, T1, T2))s;
				return tuple.Item1(tuple.Item2, tuple.Item3);
			}, (action, arg1, arg2));
		}

		private R RunOnEmptyStackCore<R>(Func<object, R> action, object state)
		{
			_executionStackCount++;
			try
			{
				Task<R> task = Task.Factory.StartNew(action, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
				if (!task.IsCompleted)
				{
					((IAsyncResult)task).AsyncWaitHandle.WaitOne();
				}
				return task.GetAwaiter().GetResult();
			}
			finally
			{
				_executionStackCount--;
			}
		}
	}
	internal static class ThrowHelper
	{
		[MethodImpl(MethodImplOptions.NoInlining)]
		[DoesNotReturn]
		internal static void ThrowObjectDisposedException()
		{
			throw new ObjectDisposedException("IServiceProvider");
		}
	}
	[RequiresDynamicCode("Creates DynamicMethods")]
	internal sealed class ILEmitResolverBuilder : CallSiteVisitor<ILEmitResolverBuilderContext, object?>
	{
		private sealed class ILEmitResolverBuilderRuntimeContext
		{
			public object[] Constants;

			public Func<IServiceProvider, object>[] Factories;
		}

		private struct GeneratedMethod
		{
			public Func<ServiceProviderEngineScope, object> Lambda;

			public ILEmitResolverBuilderRuntimeContext Context;

			public DynamicMethod DynamicMethod;
		}

		private static readonly MethodInfo ResolvedServicesGetter = typeof(ServiceProviderEngineScope).GetProperty("ResolvedServices", BindingFlags.Instance | BindingFlags.NonPublic).GetMethod;

		private static readonly MethodInfo ScopeLockGetter = typeof(ServiceProviderEngineScope).GetProperty("Sync", BindingFlags.Instance | BindingFlags.NonPublic).GetMethod;

		private static readonly MethodInfo ScopeIsRootScope = typeof(ServiceProviderEngineScope).GetProperty("IsRootScope", BindingFlags.Instance | BindingFlags.Public).GetMethod;

		private static readonly MethodInfo CallSiteRuntimeResolverResolveMethod = typeof(CallSiteRuntimeResolver).GetMethod("Resolve", BindingFlags.Instance | BindingFlags.Public);

		private static readonly MethodInfo CallSiteRuntimeResolverInstanceField = typeof(CallSiteRuntimeResolver).GetProperty("Instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public).GetMethod;

		private static readonly FieldInfo FactoriesField = typeof(ILEmitResolverBuilderRuntimeContext).GetField("Factories");

		private static readonly FieldInfo ConstantsField = typeof(ILEmitResolverBuilderRuntimeContext).GetField("Constants");

		private static readonly MethodInfo GetTypeFromHandleMethod = typeof(Type).GetMethod("GetTypeFromHandle");

		private static readonly ConstructorInfo CacheKeyCtor = typeof(ServiceCacheKey).GetConstructors()[0];

		private readonly ServiceProviderEngineScope _rootScope;

		private readonly ConcurrentDictionary<ServiceCacheKey, GeneratedMethod> _scopeResolverCache;

		private readonly Func<ServiceCacheKey, ServiceCallSite, GeneratedMethod> _buildTypeDelegate;

		public ILEmitResolverBuilder(ServiceProvider serviceProvider)
		{
			_rootScope = serviceProvider.Root;
			_scopeResolverCache = new ConcurrentDictionary<ServiceCacheKey, GeneratedMethod>();
			_buildTypeDelegate = (ServiceCacheKey key, ServiceCallSite cs) => BuildTypeNoCache(cs);
		}

		public Func<ServiceProviderEngineScope, object?> Build(ServiceCallSite callSite)
		{
			return BuildType(callSite).Lambda;
		}

		private GeneratedMethod BuildType(ServiceCallSite callSite)
		{
			if (callSite.Cache.Location == CallSiteResultCacheLocation.Scope)
			{
				return _scopeResolverCache.GetOrAdd(callSite.Cache.Key, _buildTypeDelegate, callSite);
			}
			return BuildTypeNoCache(callSite);
		}

		private GeneratedMethod BuildTypeNoCache(ServiceCallSite callSite)
		{
			DynamicMethod dynamicMethod = new DynamicMethod("ResolveService", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(object), new Type[2]
			{
				typeof(ILEmitResolverBuilderRuntimeContext),
				typeof(ServiceProviderEngineScope)
			}, GetType(), skipVisibility: true);
			ILGenerator iLGenerator = dynamicMethod.GetILGenerator(512);
			ILEmitResolverBuilderRuntimeContext iLEmitResolverBuilderRuntimeContext = GenerateMethodBody(callSite, iLGenerator);
			DependencyInjectionEventSource.Log.DynamicMethodBuilt(_rootScope.RootProvider, callSite.ServiceType, iLGenerator.ILOffset);
			GeneratedMethod result = default(GeneratedMethod);
			result.Lambda = (Func<ServiceProviderEngineScope, object>)dynamicMethod.CreateDelegate(typeof(Func<ServiceProviderEngineScope, object>), iLEmitResolverBuilderRuntimeContext);
			result.Context = iLEmitResolverBuilderRuntimeContext;
			result.DynamicMethod = dynamicMethod;
			return result;
		}

		protected override object? VisitDisposeCache(ServiceCallSite transientCallSite, ILEmitResolverBuilderContext argument)
		{
			if (transientCallSite.CaptureDisposable)
			{
				BeginCaptureDisposable(argument);
				VisitCallSiteMain(transientCallSite, argument);
				EndCaptureDisposable(argument);
			}
			else
			{
				VisitCallSiteMain(transientCallSite, argument);
			}
			return null;
		}

		protected override object? VisitConstructor(ConstructorCallSite constructorCallSite, ILEmitResolverBuilderContext argument)
		{
			ServiceCallSite[] parameterCallSites = constructorCallSite.ParameterCallSites;
			foreach (ServiceCallSite serviceCallSite in parameterCallSites)
			{
				VisitCallSite(serviceCallSite, argument);
				if (serviceCallSite.ServiceType.IsValueType)
				{
					argument.Generator.Emit(OpCodes.Unbox_Any, serviceCallSite.ServiceType);
				}
			}
			argument.Generator.Emit(OpCodes.Newobj, constructorCallSite.ConstructorInfo);
			if (constructorCallSite.ImplementationType.IsValueType)
			{
				argument.Generator.Emit(OpCodes.Box, constructorCallSite.ImplementationType);
			}
			return null;
		}

		protected override object? VisitRootCache(ServiceCallSite callSite, ILEmitResolverBuilderContext argument)
		{
			AddConstant(argument, CallSiteRuntimeResolver.Instance.Resolve(callSite, _rootScope));
			return null;
		}

		protected override object? VisitScopeCache(ServiceCallSite scopedCallSite, ILEmitResolverBuilderContext argument)
		{
			GeneratedMethod generatedMethod = BuildType(scopedCallSite);
			AddConstant(argument, generatedMethod.Context);
			argument.Generator.Emit(OpCodes.Ldarg_1);
			argument.Generator.Emit(OpCodes.Call, generatedMethod.DynamicMethod);
			return null;
		}

		protected override object? VisitConstant(ConstantCallSite constantCallSite, ILEmitResolverBuilderContext argument)
		{
			AddConstant(argument, constantCallSite.DefaultValue);
			return null;
		}

		protected override object? VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, ILEmitResolverBuilderContext argument)
		{
			argument.Generator.Emit(OpCodes.Ldarg_1);
			return null;
		}

		protected override object? VisitIEnumerable(IEnumerableCallSite enumerableCallSite, ILEmitResolverBuilderContext argument)
		{
			if (enumerableCallSite.ServiceCallSites.Length == 0)
			{
				argument.Generator.Emit(OpCodes.Call, ServiceLookupHelpers.GetArrayEmptyMethodInfo(enumerableCallSite.ItemType));
			}
			else
			{
				argument.Generator.Emit(OpCodes.Ldc_I4, enumerableCallSite.ServiceCallSites.Length);
				argument.Generator.Emit(OpCodes.Newarr, enumerableCallSite.ItemType);
				for (int i = 0; i < enumerableCallSite.ServiceCallSites.Length; i++)
				{
					argument.Generator.Emit(OpCodes.Dup);
					argument.Generator.Emit(OpCodes.Ldc_I4, i);
					ServiceCallSite serviceCallSite = enumerableCallSite.ServiceCallSites[i];
					VisitCallSite(serviceCallSite, argument);
					if (serviceCallSite.ServiceType.IsValueType)
					{
						argument.Generator.Emit(OpCodes.Unbox_Any, serviceCallSite.ServiceType);
					}
					argument.Generator.Emit(OpCodes.Stelem, enumerableCallSite.ItemType);
				}
			}
			return null;
		}

		protected override object? VisitFactory(FactoryCallSite factoryCallSite, ILEmitResolverBuilderContext argument)
		{
			if (argument.Factories == null)
			{
				List<Func<IServiceProvider, object>> list2 = (argument.Factories = new List<Func<IServiceProvider, object>>());
			}
			argument.Generator.Emit(OpCodes.Ldarg_0);
			argument.Generator.Emit(OpCodes.Ldfld, FactoriesField);
			argument.Generator.Emit(OpCodes.Ldc_I4, argument.Factories.Count);
			argument.Generator.Emit(OpCodes.Ldelem, typeof(Func<IServiceProvider, object>));
			argument.Generator.Emit(OpCodes.Ldarg_1);
			argument.Generator.Emit(OpCodes.Call, ServiceLookupHelpers.InvokeFactoryMethodInfo);
			argument.Factories.Add(factoryCallSite.Factory);
			return null;
		}

		private static void AddConstant(ILEmitResolverBuilderContext argument, object value)
		{
			if (argument.Constants == null)
			{
				List<object> list2 = (argument.Constants = new List<object>());
			}
			argument.Generator.Emit(OpCodes.Ldarg_0);
			argument.Generator.Emit(OpCodes.Ldfld, ConstantsField);
			argument.Generator.Emit(OpCodes.Ldc_I4, argument.Constants.Count);
			argument.Generator.Emit(OpCodes.Ldelem, typeof(object));
			argument.Constants.Add(value);
		}

		private static void AddCacheKey(ILEmitResolverBuilderContext argument, ServiceCacheKey key)
		{
			argument.Generator.Emit(OpCodes.Ldtoken, key.Type);
			argument.Generator.Emit(OpCodes.Call, GetTypeFromHandleMethod);
			argument.Generator.Emit(OpCodes.Ldc_I4, key.Slot);
			argument.Generator.Emit(OpCodes.Newobj, CacheKeyCtor);
		}

		private ILEmitResolverBuilderRuntimeContext GenerateMethodBody(ServiceCallSite callSite, ILGenerator generator)
		{
			ILEmitResolverBuilderContext iLEmitResolverBuilderContext = new ILEmitResolverBuilderContext(generator)
			{
				Constants = null,
				Factories = null
			};
			if (callSite.Cache.Location == CallSiteResultCacheLocation.Scope)
			{
				LocalBuilder local = iLEmitResolverBuilderContext.Generator.DeclareLocal(typeof(ServiceCacheKey));
				LocalBuilder local2 = iLEmitResolverBuilderContext.Generator.DeclareLocal(typeof(IDictionary<ServiceCacheKey, object>));
				LocalBuilder local3 = iLEmitResolverBuilderContext.Generator.DeclareLocal(typeof(object));
				LocalBuilder local4 = iLEmitResolverBuilderContext.Generator.DeclareLocal(typeof(bool));
				LocalBuilder local5 = iLEmitResolverBuilderContext.Generator.DeclareLocal(typeof(object));
				Label label = iLEmitResolverBuilderContext.Generator.DefineLabel();
				Label label2 = iLEmitResolverBuilderContext.Generator.DefineLabel();
				Label label3 = iLEmitResolverBuilderContext.Generator.DefineLabel();
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ldarg_1);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Callvirt, ScopeIsRootScope);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Brfalse_S, label3);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Call, CallSiteRuntimeResolverInstanceField);
				AddConstant(iLEmitResolverBuilderContext, callSite);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ldarg_1);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Callvirt, CallSiteRuntimeResolverResolveMethod);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ret);
				iLEmitResolverBuilderContext.Generator.MarkLabel(label3);
				AddCacheKey(iLEmitResolverBuilderContext, callSite.Cache.Key);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Stloc, local);
				iLEmitResolverBuilderContext.Generator.BeginExceptionBlock();
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ldarg_1);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Callvirt, ResolvedServicesGetter);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Stloc, local2);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ldarg_1);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Callvirt, ScopeLockGetter);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Stloc, local3);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ldloc, local3);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ldloca, local4);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Call, ServiceLookupHelpers.MonitorEnterMethodInfo);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ldloc, local2);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ldloc, local);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ldloca, local5);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Callvirt, ServiceLookupHelpers.TryGetValueMethodInfo);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Brtrue, label);
				VisitCallSiteMain(callSite, iLEmitResolverBuilderContext);
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Stloc, local5);
				if (callSite.CaptureDisposable)
				{
					BeginCaptureDisposable(iLEmitResolverBuilderContext);
					iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ldloc, local5);
					EndCaptureDisposable(iLEmitResolverBuilderContext);
					generator.Emit(OpCodes.Pop);
				}
				iLEmitResolverBuilderContext.Generator.Emit(OpCodes.Ldloc, local2);
				iLEmitResolverBuilderContext.Generator.Emit(

Microsoft.NET.StringTools.dll

Decompiled 5 months ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.NET.StringTools.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")]
[assembly: InternalsVisibleTo("Microsoft.NET.StringTools.net35.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("Microsoft.NET.StringTools.Benchmark, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Microsoft.NET.StringTools.dll")]
[assembly: AssemblyFileVersion("17.4.0.51802")]
[assembly: AssemblyInformationalVersion("17.4.0+18d5aef85920037c9d6ff49b1215a4daf515197f")]
[assembly: AssemblyProduct("Microsoft® Build Tools®")]
[assembly: AssemblyTitle("Microsoft.NET.StringTools.dll")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/msbuild")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsByRefLikeAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Microsoft.NET.StringTools
{
	internal ref struct InternableString
	{
		public ref struct Enumerator
		{
			private InternableString _string;

			private int _spanIndex;

			private int _charIndex;

			public ref readonly char Current
			{
				get
				{
					if (_spanIndex == -1)
					{
						return ref _string._inlineSpan[_charIndex];
					}
					return ref _string._spans[_spanIndex].Span[_charIndex];
				}
			}

			internal Enumerator(ref InternableString str)
			{
				_string = str;
				_spanIndex = -1;
				_charIndex = -1;
			}

			public bool MoveNext()
			{
				int num = _charIndex + 1;
				if (_spanIndex == -1)
				{
					if (num < _string._inlineSpan.Length)
					{
						_charIndex = num;
						return true;
					}
					_spanIndex = 0;
					num = 0;
				}
				if (_string._spans != null)
				{
					while (_spanIndex < _string._spans.Count)
					{
						if (num < _string._spans[_spanIndex].Length)
						{
							_charIndex = num;
							return true;
						}
						_spanIndex++;
						num = 0;
					}
				}
				return false;
			}
		}

		private readonly ReadOnlySpan<char> _inlineSpan;

		private string? _inlineSpanString;

		private List<ReadOnlyMemory<char>>? _spans;

		public int Length { get; private set; }

		internal InternableString(ReadOnlySpan<char> span)
		{
			_inlineSpan = span;
			_spans = null;
			Length = span.Length;
			_inlineSpanString = null;
		}

		internal InternableString(string str)
		{
			if (str == null)
			{
				throw new ArgumentNullException("str");
			}
			_inlineSpan = str.AsSpan();
			_spans = null;
			Length = str.Length;
			_inlineSpanString = str;
		}

		internal InternableString(SpanBasedStringBuilder stringBuilder)
		{
			_inlineSpan = default(ReadOnlySpan<char>);
			_spans = stringBuilder.Spans;
			Length = stringBuilder.Length;
			_inlineSpanString = null;
		}

		public Enumerator GetEnumerator()
		{
			return new Enumerator(ref this);
		}

		public bool Equals(string other)
		{
			if (other.Length != Length)
			{
				return false;
			}
			if (_inlineSpan.SequenceCompareTo(other.AsSpan(0, _inlineSpan.Length)) != 0)
			{
				return false;
			}
			if (_spans != null)
			{
				int num = _inlineSpan.Length;
				foreach (ReadOnlyMemory<char> span in _spans)
				{
					if (span.Span.SequenceCompareTo(other.AsSpan(num, span.Length)) != 0)
					{
						return false;
					}
					num += span.Length;
				}
			}
			return true;
		}

		public unsafe string ExpensiveConvertToString()
		{
			if (Length == 0)
			{
				return string.Empty;
			}
			if (_inlineSpan.Length == Length && _inlineSpanString != null)
			{
				return _inlineSpanString;
			}
			if (_inlineSpan.IsEmpty && _spans?[0].Length == Length)
			{
				return _spans[0].ToString();
			}
			string text = new string('\0', Length);
			fixed (char* ptr = text)
			{
				char* ptr2 = ptr;
				if (!_inlineSpan.IsEmpty)
				{
					fixed (char* source = _inlineSpan)
					{
						Unsafe.CopyBlockUnaligned(ptr2, source, (uint)(2 * _inlineSpan.Length));
					}
					ptr2 += _inlineSpan.Length;
				}
				if (_spans != null)
				{
					foreach (ReadOnlyMemory<char> span in _spans)
					{
						if (span.IsEmpty)
						{
							continue;
						}
						fixed (char* source2 = span.Span)
						{
							Unsafe.CopyBlockUnaligned(ptr2, source2, (uint)(2 * span.Length));
						}
						ptr2 += span.Length;
					}
				}
				if (ptr2 != ptr + Length)
				{
					throw new InvalidOperationException($"Length of {Length} does not match the sum of span lengths of {ptr2 - ptr}.");
				}
			}
			return text;
		}

		public bool ReferenceEquals(string str)
		{
			if (_inlineSpan.Length == Length)
			{
				return _inlineSpan == str.AsSpan();
			}
			if (_inlineSpan.IsEmpty)
			{
				List<ReadOnlyMemory<char>>? spans = _spans;
				if (spans != null && spans.Count == 1 && _spans[0].Length == Length)
				{
					return _spans[0].Span == str.AsSpan();
				}
			}
			return false;
		}

		public override string ToString()
		{
			return WeakStringCacheInterner.Instance.InternableToString(ref this);
		}

		public unsafe override int GetHashCode()
		{
			uint hash = 352654597u;
			bool hashedOddNumberOfCharacters = false;
			fixed (char* charPtr = _inlineSpan)
			{
				hash = GetHashCodeHelper(charPtr, _inlineSpan.Length, hash, ref hashedOddNumberOfCharacters);
			}
			if (_spans != null)
			{
				foreach (ReadOnlyMemory<char> span in _spans)
				{
					fixed (char* charPtr = span.Span)
					{
						hash = GetHashCodeHelper(charPtr, span.Length, hash, ref hashedOddNumberOfCharacters);
					}
				}
			}
			return (int)hash;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private unsafe static uint GetHashCodeHelper(char* charPtr, int length, uint hash, ref bool hashedOddNumberOfCharacters)
		{
			if (hashedOddNumberOfCharacters && length > 0)
			{
				hash ^= (BitConverter.IsLittleEndian ? ((uint)(*charPtr) << 16) : (*charPtr));
				length--;
				charPtr++;
				hashedOddNumberOfCharacters = false;
			}
			uint* ptr = (uint*)charPtr;
			while (length >= 2)
			{
				length -= 2;
				hash = (RotateLeft(hash, 5) + hash) ^ *ptr;
				ptr++;
			}
			if (length > 0)
			{
				hash = (RotateLeft(hash, 5) + hash) ^ (uint)(BitConverter.IsLittleEndian ? (*(ushort*)ptr) : (*(ushort*)ptr << 16));
				hashedOddNumberOfCharacters = true;
			}
			return hash;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static uint RotateLeft(uint value, int offset)
		{
			return (value << offset) | (value >> 32 - offset);
		}
	}
	public class SpanBasedStringBuilder : IDisposable
	{
		public struct Enumerator
		{
			private readonly List<ReadOnlyMemory<char>> _spans;

			private int _spanIndex;

			private int _charIndex;

			public readonly char Current => _spans[_spanIndex].Span[_charIndex];

			internal Enumerator(List<ReadOnlyMemory<char>> spans)
			{
				_spans = spans;
				_spanIndex = 0;
				_charIndex = -1;
			}

			public bool MoveNext()
			{
				int num = _charIndex + 1;
				while (_spanIndex < _spans.Count)
				{
					if (num < _spans[_spanIndex].Length)
					{
						_charIndex = num;
						return true;
					}
					_spanIndex++;
					num = 0;
				}
				return false;
			}
		}

		private readonly List<ReadOnlyMemory<char>> _spans;

		internal List<ReadOnlyMemory<char>> Spans => _spans;

		public int Length { get; private set; }

		public int Capacity => _spans.Capacity;

		public SpanBasedStringBuilder(string str)
			: this()
		{
			if (str == null)
			{
				throw new ArgumentNullException("str");
			}
			Append(str);
		}

		public SpanBasedStringBuilder(int capacity = 4)
		{
			_spans = new List<ReadOnlyMemory<char>>(capacity);
			Length = 0;
		}

		public Enumerator GetEnumerator()
		{
			return new Enumerator(_spans);
		}

		public override string ToString()
		{
			return new InternableString(this).ToString();
		}

		public void Dispose()
		{
			Strings.ReturnSpanBasedStringBuilder(this);
		}

		public void Append(string value)
		{
			if (!string.IsNullOrEmpty(value))
			{
				_spans.Add(value.AsMemory());
				Length += value.Length;
			}
		}

		public void Append(string value, int startIndex, int count)
		{
			if (value != null)
			{
				if (count > 0)
				{
					_spans.Add(value.AsMemory(startIndex, count));
					Length += count;
				}
			}
			else if (startIndex != 0 || count != 0)
			{
				throw new ArgumentNullException("value");
			}
		}

		public void Append(ReadOnlyMemory<char> span)
		{
			if (!span.IsEmpty)
			{
				_spans.Add(span);
				Length += span.Length;
			}
		}

		public void TrimStart()
		{
			for (int i = 0; i < _spans.Count; i++)
			{
				ReadOnlyMemory<char> readOnlyMemory = _spans[i];
				ReadOnlySpan<char> span = readOnlyMemory.Span;
				int j;
				for (j = 0; j < span.Length && char.IsWhiteSpace(span[j]); j++)
				{
				}
				if (j > 0)
				{
					List<ReadOnlyMemory<char>> spans = _spans;
					int index = i;
					readOnlyMemory = _spans[i];
					spans[index] = readOnlyMemory.Slice(j);
					Length -= j;
				}
				readOnlyMemory = _spans[i];
				if (!readOnlyMemory.IsEmpty)
				{
					break;
				}
			}
		}

		public void TrimEnd()
		{
			for (int num = _spans.Count - 1; num >= 0; num--)
			{
				ReadOnlyMemory<char> readOnlyMemory = _spans[num];
				ReadOnlySpan<char> span = readOnlyMemory.Span;
				int num2 = span.Length - 1;
				while (num2 >= 0 && char.IsWhiteSpace(span[num2]))
				{
					num2--;
				}
				if (num2 + 1 < span.Length)
				{
					List<ReadOnlyMemory<char>> spans = _spans;
					int index = num;
					readOnlyMemory = _spans[num];
					spans[index] = readOnlyMemory.Slice(0, num2 + 1);
					Length -= span.Length - (num2 + 1);
				}
				readOnlyMemory = _spans[num];
				if (!readOnlyMemory.IsEmpty)
				{
					break;
				}
			}
		}

		public void Trim()
		{
			TrimStart();
			TrimEnd();
		}

		public void Clear()
		{
			_spans.Clear();
			Length = 0;
		}
	}
	public static class Strings
	{
		[ThreadStatic]
		private static SpanBasedStringBuilder? _spanBasedStringBuilder;

		public static string WeakIntern(string str)
		{
			InternableString candidate = new InternableString(str);
			return WeakStringCacheInterner.Instance.InternableToString(ref candidate);
		}

		public static string WeakIntern(ReadOnlySpan<char> str)
		{
			InternableString candidate = new InternableString(str);
			return WeakStringCacheInterner.Instance.InternableToString(ref candidate);
		}

		public static SpanBasedStringBuilder GetSpanBasedStringBuilder()
		{
			SpanBasedStringBuilder spanBasedStringBuilder = _spanBasedStringBuilder;
			if (spanBasedStringBuilder == null)
			{
				return new SpanBasedStringBuilder();
			}
			_spanBasedStringBuilder = null;
			return spanBasedStringBuilder;
		}

		public static void EnableDiagnostics()
		{
			WeakStringCacheInterner.Instance.EnableStatistics();
		}

		public static string CreateDiagnosticReport()
		{
			return WeakStringCacheInterner.Instance.FormatStatistics();
		}

		internal static void ReturnSpanBasedStringBuilder(SpanBasedStringBuilder stringBuilder)
		{
			stringBuilder.Clear();
			_spanBasedStringBuilder = stringBuilder;
		}
	}
	internal sealed class WeakStringCache : IDisposable
	{
		public struct DebugInfo
		{
			public int LiveStringCount;

			public int CollectedStringCount;
		}

		private class StringWeakHandle
		{
			public GCHandle WeakHandle;

			public bool IsUsed => WeakHandle.Target != null;

			public string? GetString(ref InternableString internable)
			{
				if (WeakHandle.IsAllocated && WeakHandle.Target is string text && internable.Equals(text))
				{
					return text;
				}
				return null;
			}

			public void SetString(string str)
			{
				if (!WeakHandle.IsAllocated)
				{
					WeakHandle = GCHandle.Alloc(str, GCHandleType.Weak);
				}
				else
				{
					WeakHandle.Target = str;
				}
			}

			public void Free()
			{
				WeakHandle.Free();
			}
		}

		private readonly ConcurrentDictionary<int, StringWeakHandle> _stringsByHashCode;

		private const int _initialCapacity = 503;

		private int _scavengeThreshold = 503;

		public WeakStringCache()
		{
			_stringsByHashCode = new ConcurrentDictionary<int, StringWeakHandle>(Environment.ProcessorCount, 503);
		}

		public string GetOrCreateEntry(ref InternableString internable, out bool cacheHit)
		{
			int hashCode = internable.GetHashCode();
			string @string;
			if (_stringsByHashCode.TryGetValue(hashCode, out StringWeakHandle value))
			{
				lock (value)
				{
					@string = value.GetString(ref internable);
					if (@string != null)
					{
						cacheHit = true;
						return @string;
					}
					@string = internable.ExpensiveConvertToString();
					value.SetString(@string);
					cacheHit = false;
					return @string;
				}
			}
			@string = internable.ExpensiveConvertToString();
			value = new StringWeakHandle();
			value.SetString(@string);
			_stringsByHashCode.TryAdd(hashCode, value);
			int scavengeThreshold = _scavengeThreshold;
			if (_stringsByHashCode.Count >= scavengeThreshold && Interlocked.CompareExchange(ref _scavengeThreshold, int.MaxValue, scavengeThreshold) == scavengeThreshold)
			{
				try
				{
					Scavenge();
				}
				finally
				{
					_scavengeThreshold = _stringsByHashCode.Count * 2;
				}
			}
			cacheHit = false;
			return @string;
		}

		public void Scavenge()
		{
			foreach (KeyValuePair<int, StringWeakHandle> item in _stringsByHashCode)
			{
				if (item.Value.IsUsed || !_stringsByHashCode.TryRemove(item.Key, out StringWeakHandle value))
				{
					continue;
				}
				lock (value)
				{
					if (!value.IsUsed || !_stringsByHashCode.TryAdd(item.Key, value))
					{
						value.Free();
					}
				}
			}
		}

		public DebugInfo GetDebugInfo()
		{
			return GetDebugInfoImpl();
		}

		private void DisposeImpl()
		{
			foreach (KeyValuePair<int, StringWeakHandle> item in _stringsByHashCode)
			{
				item.Value.Free();
			}
			_stringsByHashCode.Clear();
		}

		public void Dispose()
		{
			DisposeImpl();
			GC.SuppressFinalize(this);
		}

		~WeakStringCache()
		{
			DisposeImpl();
		}

		private DebugInfo GetDebugInfoImpl()
		{
			DebugInfo result = default(DebugInfo);
			foreach (KeyValuePair<int, StringWeakHandle> item in _stringsByHashCode)
			{
				if (item.Value.IsUsed)
				{
					result.LiveStringCount++;
				}
				else
				{
					result.CollectedStringCount++;
				}
			}
			return result;
		}
	}
	internal class WeakStringCacheInterner : IDisposable
	{
		private enum InternResult
		{
			FoundInWeakStringCache,
			AddedToWeakStringCache
		}

		internal static WeakStringCacheInterner Instance = new WeakStringCacheInterner();

		private readonly WeakStringCache _weakStringCache = new WeakStringCache();

		private int _regularInternHits;

		private int _regularInternMisses;

		private int _internEliminatedStrings;

		private int _internEliminatedChars;

		private Dictionary<string, int>? _internCallCountsByString;

		private InternResult Intern(ref InternableString candidate, out string interned)
		{
			interned = _weakStringCache.GetOrCreateEntry(ref candidate, out var cacheHit);
			if (!cacheHit)
			{
				return InternResult.AddedToWeakStringCache;
			}
			return InternResult.FoundInWeakStringCache;
		}

		public string InternableToString(ref InternableString candidate)
		{
			if (candidate.Length == 0)
			{
				return string.Empty;
			}
			string interned;
			InternResult internResult = Intern(ref candidate, out interned);
			if (_internCallCountsByString != null)
			{
				lock (_internCallCountsByString)
				{
					switch (internResult)
					{
					case InternResult.FoundInWeakStringCache:
						_regularInternHits++;
						break;
					case InternResult.AddedToWeakStringCache:
						_regularInternMisses++;
						break;
					}
					_internCallCountsByString.TryGetValue(interned, out var value);
					_internCallCountsByString[interned] = value + 1;
					if (!candidate.ReferenceEquals(interned))
					{
						_internEliminatedStrings++;
						_internEliminatedChars += candidate.Length;
					}
				}
			}
			return interned;
		}

		public void EnableStatistics()
		{
			_internCallCountsByString = new Dictionary<string, int>();
		}

		public string FormatStatistics()
		{
			StringBuilder stringBuilder = new StringBuilder(1024);
			string text = "Opportunistic Intern";
			if (_internCallCountsByString != null)
			{
				stringBuilder.AppendLine(string.Format("\n{0}{1}{0}", new string('=', 41 - text.Length / 2), text));
				stringBuilder.AppendLine(string.Format("||{0,50}|{1,20:N0}|{2,8}|", "WeakStringCache Hits", _regularInternHits, "hits"));
				stringBuilder.AppendLine(string.Format("||{0,50}|{1,20:N0}|{2,8}|", "WeakStringCache Misses", _regularInternMisses, "misses"));
				stringBuilder.AppendLine(string.Format("||{0,50}|{1,20:N0}|{2,8}|", "Eliminated Strings*", _internEliminatedStrings, "strings"));
				stringBuilder.AppendLine(string.Format("||{0,50}|{1,20:N0}|{2,8}|", "Eliminated Chars", _internEliminatedChars, "chars"));
				stringBuilder.AppendLine(string.Format("||{0,50}|{1,20:N0}|{2,8}|", "Estimated Eliminated Bytes", _internEliminatedChars * 2, "bytes"));
				stringBuilder.AppendLine("Elimination assumes that strings provided were unique objects.");
				stringBuilder.AppendLine("|---------------------------------------------------------------------------------|");
				IEnumerable<string> source = from kv in (from kv in _internCallCountsByString
						orderby kv.Value * kv.Key.Length descending
						where kv.Value > 1
						select kv).Take(15)
					select string.Format(CultureInfo.InvariantCulture, "({1} instances x each {2} chars)\n{0}", kv.Key, kv.Value, kv.Key.Length);
				stringBuilder.AppendLine(string.Format("##########Top Top Interned Strings:  \n{0} ", string.Join("\n==============\n", source.ToArray())));
				stringBuilder.AppendLine();
				WeakStringCache.DebugInfo debugInfo = _weakStringCache.GetDebugInfo();
				stringBuilder.AppendLine("WeakStringCache statistics:");
				stringBuilder.AppendLine($"String count live/collected/total = {debugInfo.LiveStringCount}/{debugInfo.CollectedStringCount}/{debugInfo.LiveStringCount + debugInfo.CollectedStringCount}");
			}
			else
			{
				stringBuilder.Append(text);
				stringBuilder.AppendLine(" - EnableStatisticsGathering() has not been called");
			}
			return stringBuilder.ToString();
		}

		public void Dispose()
		{
			_weakStringCache.Dispose();
		}
	}
}

Microsoft.Xaml.Behaviors.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Remoting;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Annotations;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Resources;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.Xaml.Behaviors.Core;
using Microsoft.Xaml.Behaviors.Layout;
using Microsoft.Xaml.Behaviors.Media;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: NeutralResourcesLanguage("en", UltimateResourceFallbackLocation.MainAssembly)]
[assembly: XmlnsPrefix("http://schemas.microsoft.com/xaml/behaviors", "b")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/xaml/behaviors", "Microsoft.Xaml.Behaviors")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/xaml/behaviors", "Microsoft.Xaml.Behaviors.Core")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/xaml/behaviors", "Microsoft.Xaml.Behaviors.Input")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/xaml/behaviors", "Microsoft.Xaml.Behaviors.Layout")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/xaml/behaviors", "Microsoft.Xaml.Behaviors.Media")]
[assembly: AssemblyKeyFile("..\\Behaviors.snk")]
[assembly: InternalsVisibleTo("UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100e5435599803109fe684072f487ec0670f2766325a25d47089633ffb5d9a56bf115a705bc0632660aeecfe00248951540865f481613845080859feafc5d9b55750395e7ca4c2124136d17bc9e73f0371d802fc2c9e8308f6f8b0ab3096661d2d1b0cbbbcb6de3fe711ef415f29271088537081b09ad1ee08ce8020b22031cdebd")]
[assembly: AssemblyFileVersion("1.1.19.35512")]
[assembly: AssemblyInformationalVersion("1.1.19+b88a49dfad")]
[assembly: TargetFramework(".NETCoreApp,Version=v3.0", FrameworkDisplayName = "")]
[assembly: AssemblyMetadata("CommitHash", "b88a49dfadcc98f41634624124ee19f9d9dc4df2")]
[assembly: AssemblyMetadata("CloudBuildNumber", "1.1.19")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Easily add interactivity to your apps using XAML Behaviors for WPF. Behaviors encapsulate reusable functionalities for elements that can be easily added to your XAML without the need for more imperative code.")]
[assembly: AssemblyProduct("Microsoft.Xaml.Behaviors")]
[assembly: AssemblyTitle("Microsoft.Xaml.Behaviors")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
internal sealed class ThisAssembly
{
	internal const string AssemblyVersion = "1.1.0.0";

	internal const string AssemblyFileVersion = "1.1.19.35512";

	internal const string AssemblyInformationalVersion = "1.1.19+b88a49dfad";

	internal const string AssemblyName = "Microsoft.Xaml.Behaviors";

	internal const string AssemblyTitle = "Microsoft.Xaml.Behaviors";

	internal const string AssemblyConfiguration = "Release";

	internal const string GitCommitId = "b88a49dfadcc98f41634624124ee19f9d9dc4df2";

	internal const string PublicKey = "002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293";

	internal const string PublicKeyToken = "b03f5f7f11d50a3a";

	internal const string RootNamespace = "Microsoft.Xaml.Behaviors";

	private ThisAssembly()
	{
	}
}
namespace Microsoft.Xaml.Behaviors
{
	public abstract class AttachableCollection<T> : FreezableCollection<T>, IAttachedObject where T : DependencyObject, IAttachedObject
	{
		private Collection<T> snapshot;

		private DependencyObject associatedObject;

		protected DependencyObject AssociatedObject
		{
			get
			{
				((Freezable)this).ReadPreamble();
				return associatedObject;
			}
		}

		DependencyObject IAttachedObject.AssociatedObject => AssociatedObject;

		internal AttachableCollection()
		{
			((INotifyCollectionChanged)this).CollectionChanged += OnCollectionChanged;
			snapshot = new Collection<T>();
		}

		protected abstract void OnAttached();

		protected abstract void OnDetaching();

		internal abstract void ItemAdded(T item);

		internal abstract void ItemRemoved(T item);

		[Conditional("DEBUG")]
		private void VerifySnapshotIntegrity()
		{
			if (base.Count == snapshot.Count)
			{
				for (int i = 0; i < base.Count && (object)base[i] == (object)snapshot[i]; i++)
				{
				}
			}
		}

		private void VerifyAdd(T item)
		{
			if (snapshot.Contains(item))
			{
				throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.DuplicateItemInCollectionExceptionMessage, typeof(T).Name, ((object)this).GetType().Name));
			}
		}

		private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
		{
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			switch (e.Action)
			{
			case NotifyCollectionChangedAction.Add:
			{
				foreach (T newItem in e.NewItems)
				{
					try
					{
						VerifyAdd(newItem);
						ItemAdded(newItem);
					}
					finally
					{
						snapshot.Insert(base.IndexOf(newItem), newItem);
					}
				}
				break;
			}
			case NotifyCollectionChangedAction.Replace:
				foreach (T oldItem in e.OldItems)
				{
					ItemRemoved(oldItem);
					snapshot.Remove(oldItem);
				}
				{
					foreach (T newItem2 in e.NewItems)
					{
						try
						{
							VerifyAdd(newItem2);
							ItemAdded(newItem2);
						}
						finally
						{
							snapshot.Insert(base.IndexOf(newItem2), newItem2);
						}
					}
					break;
				}
			case NotifyCollectionChangedAction.Remove:
			{
				foreach (T oldItem2 in e.OldItems)
				{
					ItemRemoved(oldItem2);
					snapshot.Remove(oldItem2);
				}
				break;
			}
			case NotifyCollectionChangedAction.Reset:
			{
				foreach (T item in snapshot)
				{
					ItemRemoved(item);
				}
				snapshot = new Collection<T>();
				Enumerator<T> enumerator2 = base.GetEnumerator();
				try
				{
					while (enumerator2.MoveNext())
					{
						T current2 = enumerator2.Current;
						VerifyAdd(current2);
						ItemAdded(current2);
					}
					break;
				}
				finally
				{
					((IDisposable)enumerator2).Dispose();
				}
			}
			case NotifyCollectionChangedAction.Move:
				break;
			}
		}

		public void Attach(DependencyObject dependencyObject)
		{
			if (dependencyObject != AssociatedObject)
			{
				if (AssociatedObject != null)
				{
					throw new InvalidOperationException();
				}
				if (Interaction.ShouldRunInDesignMode || !(bool)((DependencyObject)this).GetValue(DesignerProperties.IsInDesignModeProperty))
				{
					((Freezable)this).WritePreamble();
					associatedObject = dependencyObject;
					((Freezable)this).WritePostscript();
				}
				OnAttached();
			}
		}

		public void Detach()
		{
			OnDetaching();
			((Freezable)this).WritePreamble();
			associatedObject = null;
			((Freezable)this).WritePostscript();
		}
	}
	public abstract class Behavior<T> : Behavior where T : DependencyObject
	{
		protected new T AssociatedObject => (T)(object)base.AssociatedObject;

		protected Behavior()
			: base(typeof(T))
		{
		}
	}
	public abstract class Behavior : Animatable, IAttachedObject
	{
		private Type associatedType;

		private DependencyObject associatedObject;

		protected Type AssociatedType
		{
			get
			{
				((Freezable)this).ReadPreamble();
				return associatedType;
			}
		}

		protected DependencyObject AssociatedObject
		{
			get
			{
				((Freezable)this).ReadPreamble();
				return associatedObject;
			}
		}

		DependencyObject IAttachedObject.AssociatedObject => AssociatedObject;

		internal event EventHandler AssociatedObjectChanged;

		internal Behavior(Type associatedType)
		{
			this.associatedType = associatedType;
		}

		protected virtual void OnAttached()
		{
		}

		protected virtual void OnDetaching()
		{
		}

		protected override Freezable CreateInstanceCore()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			return (Freezable)Activator.CreateInstance(((object)this).GetType());
		}

		private void OnAssociatedObjectChanged()
		{
			if (this.AssociatedObjectChanged != null)
			{
				this.AssociatedObjectChanged(this, new EventArgs());
			}
		}

		public void Attach(DependencyObject dependencyObject)
		{
			if (dependencyObject != AssociatedObject)
			{
				if (AssociatedObject != null)
				{
					throw new InvalidOperationException(ExceptionStringTable.CannotHostBehaviorMultipleTimesExceptionMessage);
				}
				if (dependencyObject != null && !AssociatedType.IsAssignableFrom(((object)dependencyObject).GetType()))
				{
					throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.TypeConstraintViolatedExceptionMessage, ((object)this).GetType().Name, ((object)dependencyObject).GetType().Name, AssociatedType.Name));
				}
				((Freezable)this).WritePreamble();
				associatedObject = dependencyObject;
				((Freezable)this).WritePostscript();
				OnAssociatedObjectChanged();
				OnAttached();
			}
		}

		public void Detach()
		{
			OnDetaching();
			((Freezable)this).WritePreamble();
			associatedObject = null;
			((Freezable)this).WritePostscript();
			OnAssociatedObjectChanged();
		}
	}
	public sealed class BehaviorCollection : AttachableCollection<Behavior>
	{
		internal BehaviorCollection()
		{
		}

		protected override void OnAttached()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<Behavior> enumerator = ((FreezableCollection<Behavior>)this).GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					enumerator.Current.Attach(base.AssociatedObject);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		protected override void OnDetaching()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<Behavior> enumerator = ((FreezableCollection<Behavior>)this).GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					enumerator.Current.Detach();
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		internal override void ItemAdded(Behavior item)
		{
			if (base.AssociatedObject != null)
			{
				item.Attach(base.AssociatedObject);
			}
		}

		internal override void ItemRemoved(Behavior item)
		{
			if (((IAttachedObject)item).AssociatedObject != null)
			{
				item.Detach();
			}
		}

		protected override Freezable CreateInstanceCore()
		{
			return (Freezable)(object)new BehaviorCollection();
		}
	}
	internal static class ComparisonLogic
	{
		internal static bool EvaluateImpl(object leftOperand, ComparisonConditionType operatorType, object rightOperand)
		{
			bool result = false;
			if (leftOperand != null)
			{
				Type type = leftOperand.GetType();
				if (rightOperand != null)
				{
					rightOperand = TypeConverterHelper.DoConversionFrom(TypeConverterHelper.GetTypeConverter(type), rightOperand);
				}
			}
			IComparable comparable = leftOperand as IComparable;
			IComparable comparable2 = rightOperand as IComparable;
			if (comparable != null && comparable2 != null)
			{
				return EvaluateComparable(comparable, operatorType, comparable2);
			}
			switch (operatorType)
			{
			case ComparisonConditionType.Equal:
				result = object.Equals(leftOperand, rightOperand);
				break;
			case ComparisonConditionType.NotEqual:
				result = !object.Equals(leftOperand, rightOperand);
				break;
			case ComparisonConditionType.LessThan:
			case ComparisonConditionType.LessThanOrEqual:
			case ComparisonConditionType.GreaterThan:
			case ComparisonConditionType.GreaterThanOrEqual:
				if (comparable == null && comparable2 == null)
				{
					throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.InvalidOperands, (leftOperand != null) ? leftOperand.GetType().Name : "null", (rightOperand != null) ? rightOperand.GetType().Name : "null", operatorType.ToString()));
				}
				if (comparable == null)
				{
					throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.InvalidLeftOperand, (leftOperand != null) ? leftOperand.GetType().Name : "null", operatorType.ToString()));
				}
				throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.InvalidRightOperand, (rightOperand != null) ? rightOperand.GetType().Name : "null", operatorType.ToString()));
			}
			return result;
		}

		private static bool EvaluateComparable(IComparable leftOperand, ComparisonConditionType operatorType, IComparable rightOperand)
		{
			object obj = null;
			try
			{
				obj = Convert.ChangeType(rightOperand, leftOperand.GetType(), CultureInfo.CurrentCulture);
			}
			catch (FormatException)
			{
			}
			catch (InvalidCastException)
			{
			}
			if (obj == null)
			{
				return operatorType == ComparisonConditionType.NotEqual;
			}
			int num = leftOperand.CompareTo((IComparable)obj);
			bool result = false;
			switch (operatorType)
			{
			case ComparisonConditionType.Equal:
				result = num == 0;
				break;
			case ComparisonConditionType.GreaterThan:
				result = num > 0;
				break;
			case ComparisonConditionType.GreaterThanOrEqual:
				result = num >= 0;
				break;
			case ComparisonConditionType.LessThan:
				result = num < 0;
				break;
			case ComparisonConditionType.LessThanOrEqual:
				result = num <= 0;
				break;
			case ComparisonConditionType.NotEqual:
				result = num != 0;
				break;
			}
			return result;
		}
	}
	public enum CustomPropertyValueEditor
	{
		Element,
		Storyboard,
		StateName,
		ElementBinding,
		PropertyBinding
	}
	[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
	public sealed class CustomPropertyValueEditorAttribute : Attribute
	{
		public CustomPropertyValueEditor CustomPropertyValueEditor { get; private set; }

		public CustomPropertyValueEditorAttribute(CustomPropertyValueEditor customPropertyValueEditor)
		{
			CustomPropertyValueEditor = customPropertyValueEditor;
		}
	}
	internal static class DataBindingHelper
	{
		private static Dictionary<Type, IList<DependencyProperty>> DependenciesPropertyCache = new Dictionary<Type, IList<DependencyProperty>>();

		public static void EnsureDataBindingUpToDateOnMembers(DependencyObject dpObject)
		{
			IList<DependencyProperty> value = null;
			if (!DependenciesPropertyCache.TryGetValue(((object)dpObject).GetType(), out value))
			{
				value = new List<DependencyProperty>();
				Type type = ((object)dpObject).GetType();
				while (type != null)
				{
					FieldInfo[] fields = type.GetFields();
					foreach (FieldInfo fieldInfo in fields)
					{
						if (fieldInfo.IsPublic && fieldInfo.FieldType == typeof(DependencyProperty))
						{
							object? value2 = fieldInfo.GetValue(null);
							DependencyProperty val = (DependencyProperty)((value2 is DependencyProperty) ? value2 : null);
							if (val != null)
							{
								value.Add(val);
							}
						}
					}
					type = type.BaseType;
				}
				DependenciesPropertyCache[((object)dpObject).GetType()] = value;
			}
			if (value == null)
			{
				return;
			}
			foreach (DependencyProperty item in value)
			{
				EnsureBindingUpToDate(dpObject, item);
			}
		}

		public static void EnsureDataBindingOnActionsUpToDate(TriggerBase<DependencyObject> trigger)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<TriggerAction> enumerator = ((FreezableCollection<TriggerAction>)trigger.Actions).GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					EnsureDataBindingUpToDateOnMembers((DependencyObject)(object)enumerator.Current);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		public static void EnsureBindingUpToDate(DependencyObject target, DependencyProperty dp)
		{
			BindingExpression bindingExpression = BindingOperations.GetBindingExpression(target, dp);
			if (bindingExpression != null)
			{
				((BindingExpressionBase)bindingExpression).UpdateTarget();
			}
		}
	}
	[CLSCompliant(false)]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = true)]
	public sealed class DefaultTriggerAttribute : Attribute
	{
		private Type targetType;

		private Type triggerType;

		private object[] parameters;

		public Type TargetType => targetType;

		public Type TriggerType => triggerType;

		public IEnumerable Parameters => parameters;

		public DefaultTriggerAttribute(Type targetType, Type triggerType, object parameter)
			: this(targetType, triggerType, new object[1] { parameter })
		{
		}

		public DefaultTriggerAttribute(Type targetType, Type triggerType, params object[] parameters)
		{
			if (!typeof(TriggerBase).IsAssignableFrom(triggerType))
			{
				throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.DefaultTriggerAttributeInvalidTriggerTypeSpecifiedExceptionMessage, triggerType.Name));
			}
			this.targetType = targetType;
			this.triggerType = triggerType;
			this.parameters = parameters;
		}

		public TriggerBase Instantiate()
		{
			object obj = null;
			try
			{
				obj = Activator.CreateInstance(TriggerType, parameters);
			}
			catch
			{
			}
			return (TriggerBase)obj;
		}
	}
	public static class DependencyObjectHelper
	{
		public static IEnumerable<DependencyObject> GetSelfAndAncestors(this DependencyObject dependencyObject)
		{
			while (dependencyObject != null)
			{
				yield return dependencyObject;
				dependencyObject = VisualTreeHelper.GetParent(dependencyObject);
			}
		}
	}
	public sealed class EventObserver : IDisposable
	{
		private EventInfo eventInfo;

		private object target;

		private Delegate handler;

		public EventObserver(EventInfo eventInfo, object target, Delegate handler)
		{
			if (eventInfo == null)
			{
				throw new ArgumentNullException("eventInfo");
			}
			if ((object)handler == null)
			{
				throw new ArgumentNullException("handler");
			}
			this.eventInfo = eventInfo;
			this.target = target;
			this.handler = handler;
			this.eventInfo.AddEventHandler(this.target, handler);
		}

		public void Dispose()
		{
			eventInfo.RemoveEventHandler(target, handler);
		}
	}
	public class EventTrigger : EventTriggerBase<object>
	{
		public static readonly DependencyProperty EventNameProperty = DependencyProperty.Register("EventName", typeof(string), typeof(EventTrigger), (PropertyMetadata)new FrameworkPropertyMetadata((object)"Loaded", new PropertyChangedCallback(OnEventNameChanged)));

		public string EventName
		{
			get
			{
				return (string)((DependencyObject)this).GetValue(EventNameProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(EventNameProperty, (object)value);
			}
		}

		public EventTrigger()
		{
		}

		public EventTrigger(string eventName)
		{
			EventName = eventName;
		}

		protected override string GetEventName()
		{
			return EventName;
		}

		private static void OnEventNameChanged(object sender, DependencyPropertyChangedEventArgs args)
		{
			((EventTriggerBase)(EventTrigger)sender).OnEventNameChanged((string)((DependencyPropertyChangedEventArgs)(ref args)).OldValue, (string)((DependencyPropertyChangedEventArgs)(ref args)).NewValue);
		}
	}
	public abstract class EventTriggerBase<T> : EventTriggerBase where T : class
	{
		public new T Source => (T)base.Source;

		protected EventTriggerBase()
			: base(typeof(T))
		{
		}

		internal sealed override void OnSourceChangedImpl(object oldSource, object newSource)
		{
			base.OnSourceChangedImpl(oldSource, newSource);
			OnSourceChanged(oldSource as T, newSource as T);
		}

		protected virtual void OnSourceChanged(T oldSource, T newSource)
		{
		}
	}
	public abstract class EventTriggerBase : TriggerBase
	{
		private Type sourceTypeConstraint;

		private bool isSourceChangedRegistered;

		private NameResolver sourceNameResolver;

		private MethodInfo eventHandlerMethodInfo;

		public static readonly DependencyProperty SourceObjectProperty = DependencyProperty.Register("SourceObject", typeof(object), typeof(EventTriggerBase), new PropertyMetadata(new PropertyChangedCallback(OnSourceObjectChanged)));

		public static readonly DependencyProperty SourceNameProperty = DependencyProperty.Register("SourceName", typeof(string), typeof(EventTriggerBase), new PropertyMetadata(new PropertyChangedCallback(OnSourceNameChanged)));

		protected sealed override Type AssociatedObjectTypeConstraint
		{
			get
			{
				if (TypeDescriptor.GetAttributes(((object)this).GetType())[typeof(TypeConstraintAttribute)] is TypeConstraintAttribute typeConstraintAttribute)
				{
					return typeConstraintAttribute.Constraint;
				}
				return typeof(DependencyObject);
			}
		}

		protected Type SourceTypeConstraint => sourceTypeConstraint;

		public object SourceObject
		{
			get
			{
				return ((DependencyObject)this).GetValue(SourceObjectProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(SourceObjectProperty, value);
			}
		}

		public string SourceName
		{
			get
			{
				return (string)((DependencyObject)this).GetValue(SourceNameProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(SourceNameProperty, (object)value);
			}
		}

		public object Source
		{
			get
			{
				object obj = base.AssociatedObject;
				if (SourceObject != null)
				{
					obj = SourceObject;
				}
				else if (IsSourceNameSet)
				{
					obj = SourceNameResolver.Object;
					if (obj != null && !SourceTypeConstraint.IsAssignableFrom(obj.GetType()))
					{
						throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.RetargetedTypeConstraintViolatedExceptionMessage, ((object)this).GetType().Name, obj.GetType(), SourceTypeConstraint, "Source"));
					}
				}
				return obj;
			}
		}

		private NameResolver SourceNameResolver => sourceNameResolver;

		private bool IsSourceChangedRegistered
		{
			get
			{
				return isSourceChangedRegistered;
			}
			set
			{
				isSourceChangedRegistered = value;
			}
		}

		private bool IsSourceNameSet
		{
			get
			{
				if (string.IsNullOrEmpty(SourceName))
				{
					return ((DependencyObject)this).ReadLocalValue(SourceNameProperty) != DependencyProperty.UnsetValue;
				}
				return true;
			}
		}

		private bool IsLoadedRegistered { get; set; }

		internal EventTriggerBase(Type sourceTypeConstraint)
			: base(typeof(DependencyObject))
		{
			this.sourceTypeConstraint = sourceTypeConstraint;
			sourceNameResolver = new NameResolver();
			RegisterSourceChanged();
		}

		protected abstract string GetEventName();

		protected virtual void OnEvent(EventArgs eventArgs)
		{
			InvokeActions(eventArgs);
		}

		private void OnSourceChanged(object oldSource, object newSource)
		{
			if (base.AssociatedObject != null)
			{
				OnSourceChangedImpl(oldSource, newSource);
			}
		}

		internal virtual void OnSourceChangedImpl(object oldSource, object newSource)
		{
			if (!string.IsNullOrEmpty(GetEventName()) && string.Compare(GetEventName(), "Loaded", StringComparison.Ordinal) != 0)
			{
				if (oldSource != null && SourceTypeConstraint.IsAssignableFrom(oldSource.GetType()))
				{
					UnregisterEvent(oldSource, GetEventName());
				}
				if (newSource != null && SourceTypeConstraint.IsAssignableFrom(newSource.GetType()))
				{
					RegisterEvent(newSource, GetEventName());
				}
			}
		}

		protected override void OnAttached()
		{
			base.OnAttached();
			DependencyObject obj = base.AssociatedObject;
			Behavior behavior = obj as Behavior;
			FrameworkElement val = (FrameworkElement)(object)((obj is FrameworkElement) ? obj : null);
			RegisterSourceChanged();
			if (behavior != null)
			{
				_ = ((IAttachedObject)behavior).AssociatedObject;
				behavior.AssociatedObjectChanged += OnBehaviorHostChanged;
			}
			else if (SourceObject != null || val == null)
			{
				try
				{
					OnSourceChanged(null, Source);
				}
				catch (InvalidOperationException)
				{
				}
			}
			else
			{
				SourceNameResolver.NameScopeReferenceElement = val;
			}
			if (string.Compare(GetEventName(), "Loaded", StringComparison.Ordinal) == 0 && val != null && !Interaction.IsElementLoaded(val))
			{
				RegisterLoaded(val);
			}
		}

		protected override void OnDetaching()
		{
			base.OnDetaching();
			Behavior behavior = base.AssociatedObject as Behavior;
			DependencyObject obj = base.AssociatedObject;
			FrameworkElement val = (FrameworkElement)(object)((obj is FrameworkElement) ? obj : null);
			try
			{
				OnSourceChanged(Source, null);
			}
			catch (InvalidOperationException)
			{
			}
			UnregisterSourceChanged();
			if (behavior != null)
			{
				behavior.AssociatedObjectChanged -= OnBehaviorHostChanged;
			}
			SourceNameResolver.NameScopeReferenceElement = null;
			if (string.Compare(GetEventName(), "Loaded", StringComparison.Ordinal) == 0 && val != null)
			{
				UnregisterLoaded(val);
			}
		}

		private void OnBehaviorHostChanged(object sender, EventArgs e)
		{
			NameResolver nameResolver = SourceNameResolver;
			DependencyObject obj = ((IAttachedObject)sender).AssociatedObject;
			nameResolver.NameScopeReferenceElement = (FrameworkElement)(object)((obj is FrameworkElement) ? obj : null);
		}

		private static void OnSourceObjectChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
		{
			EventTriggerBase eventTriggerBase = (EventTriggerBase)(object)obj;
			object @object = eventTriggerBase.SourceNameResolver.Object;
			if (((DependencyPropertyChangedEventArgs)(ref args)).NewValue == null)
			{
				eventTriggerBase.OnSourceChanged(((DependencyPropertyChangedEventArgs)(ref args)).OldValue, @object);
				return;
			}
			if (((DependencyPropertyChangedEventArgs)(ref args)).OldValue == null && @object != null)
			{
				eventTriggerBase.UnregisterEvent(@object, eventTriggerBase.GetEventName());
			}
			eventTriggerBase.OnSourceChanged(((DependencyPropertyChangedEventArgs)(ref args)).OldValue, ((DependencyPropertyChangedEventArgs)(ref args)).NewValue);
		}

		private static void OnSourceNameChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
		{
			((EventTriggerBase)(object)obj).SourceNameResolver.Name = (string)((DependencyPropertyChangedEventArgs)(ref args)).NewValue;
		}

		private void RegisterSourceChanged()
		{
			if (!IsSourceChangedRegistered)
			{
				SourceNameResolver.ResolvedElementChanged += OnSourceNameResolverElementChanged;
				IsSourceChangedRegistered = true;
			}
		}

		private void UnregisterSourceChanged()
		{
			if (IsSourceChangedRegistered)
			{
				SourceNameResolver.ResolvedElementChanged -= OnSourceNameResolverElementChanged;
				IsSourceChangedRegistered = false;
			}
		}

		private void OnSourceNameResolverElementChanged(object sender, NameResolvedEventArgs e)
		{
			if (SourceObject == null)
			{
				OnSourceChanged(e.OldObject, e.NewObject);
			}
		}

		private void RegisterLoaded(FrameworkElement associatedElement)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (!IsLoadedRegistered && associatedElement != null)
			{
				associatedElement.Loaded += new RoutedEventHandler(OnEventImpl);
				IsLoadedRegistered = true;
			}
		}

		private void UnregisterLoaded(FrameworkElement associatedElement)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (IsLoadedRegistered && associatedElement != null)
			{
				associatedElement.Loaded -= new RoutedEventHandler(OnEventImpl);
				IsLoadedRegistered = false;
			}
		}

		private void RegisterEvent(object obj, string eventName)
		{
			EventInfo @event = obj.GetType().GetEvent(eventName);
			if (@event == null)
			{
				if (SourceObject != null)
				{
					throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.EventTriggerCannotFindEventNameExceptionMessage, eventName, obj.GetType().Name));
				}
			}
			else if (!IsValidEvent(@event))
			{
				if (SourceObject != null)
				{
					throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.EventTriggerBaseInvalidEventExceptionMessage, eventName, obj.GetType().Name));
				}
			}
			else
			{
				eventHandlerMethodInfo = typeof(EventTriggerBase).GetMethod("OnEventImpl", BindingFlags.Instance | BindingFlags.NonPublic);
				@event.AddEventHandler(obj, Delegate.CreateDelegate(@event.EventHandlerType, this, eventHandlerMethodInfo));
			}
		}

		private static bool IsValidEvent(EventInfo eventInfo)
		{
			Type eventHandlerType = eventInfo.EventHandlerType;
			if (typeof(Delegate).IsAssignableFrom(eventInfo.EventHandlerType))
			{
				ParameterInfo[] parameters = eventHandlerType.GetMethod("Invoke").GetParameters();
				if (parameters.Length == 2 && typeof(object).IsAssignableFrom(parameters[0].ParameterType))
				{
					return typeof(EventArgs).IsAssignableFrom(parameters[1].ParameterType);
				}
				return false;
			}
			return false;
		}

		private void UnregisterEvent(object obj, string eventName)
		{
			if (string.Compare(eventName, "Loaded", StringComparison.Ordinal) == 0)
			{
				FrameworkElement val = (FrameworkElement)((obj is FrameworkElement) ? obj : null);
				if (val != null)
				{
					UnregisterLoaded(val);
				}
			}
			else
			{
				UnregisterEventImpl(obj, eventName);
			}
		}

		private void UnregisterEventImpl(object obj, string eventName)
		{
			Type type = obj.GetType();
			if (!(eventHandlerMethodInfo == null))
			{
				EventInfo @event = type.GetEvent(eventName);
				@event.RemoveEventHandler(obj, Delegate.CreateDelegate(@event.EventHandlerType, this, eventHandlerMethodInfo));
				eventHandlerMethodInfo = null;
			}
		}

		private void OnEventImpl(object sender, EventArgs eventArgs)
		{
			OnEvent(eventArgs);
		}

		internal void OnEventNameChanged(string oldEventName, string newEventName)
		{
			if (base.AssociatedObject != null)
			{
				object source = Source;
				FrameworkElement val = (FrameworkElement)((source is FrameworkElement) ? source : null);
				if (val != null && string.Compare(oldEventName, "Loaded", StringComparison.Ordinal) == 0)
				{
					UnregisterLoaded(val);
				}
				else if (!string.IsNullOrEmpty(oldEventName))
				{
					UnregisterEvent(Source, oldEventName);
				}
				if (val != null && string.Compare(newEventName, "Loaded", StringComparison.Ordinal) == 0)
				{
					RegisterLoaded(val);
				}
				else if (!string.IsNullOrEmpty(newEventName))
				{
					RegisterEvent(Source, newEventName);
				}
			}
		}
	}
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class ExceptionStringTable
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("Microsoft.Xaml.Behaviors.ExceptionStringTable", typeof(ExceptionStringTable).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static string CallMethodActionValidMethodNotFoundExceptionMessage => ResourceManager.GetString("CallMethodActionValidMethodNotFoundExceptionMessage", resourceCulture);

		internal static string CannotHostBehaviorCollectionMultipleTimesExceptionMessage => ResourceManager.GetString("CannotHostBehaviorCollectionMultipleTimesExceptionMessage", resourceCulture);

		internal static string CannotHostBehaviorMultipleTimesExceptionMessage => ResourceManager.GetString("CannotHostBehaviorMultipleTimesExceptionMessage", resourceCulture);

		internal static string CannotHostTriggerActionMultipleTimesExceptionMessage => ResourceManager.GetString("CannotHostTriggerActionMultipleTimesExceptionMessage", resourceCulture);

		internal static string CannotHostTriggerCollectionMultipleTimesExceptionMessage => ResourceManager.GetString("CannotHostTriggerCollectionMultipleTimesExceptionMessage", resourceCulture);

		internal static string CannotHostTriggerMultipleTimesExceptionMessage => ResourceManager.GetString("CannotHostTriggerMultipleTimesExceptionMessage", resourceCulture);

		internal static string ChangePropertyActionAmbiguousAdditionOperationExceptionMessage => ResourceManager.GetString("ChangePropertyActionAmbiguousAdditionOperationExceptionMessage", resourceCulture);

		internal static string ChangePropertyActionCannotAnimateTargetTypeExceptionMessage => ResourceManager.GetString("ChangePropertyActionCannotAnimateTargetTypeExceptionMessage", resourceCulture);

		internal static string ChangePropertyActionCannotFindPropertyNameExceptionMessage => ResourceManager.GetString("ChangePropertyActionCannotFindPropertyNameExceptionMessage", resourceCulture);

		internal static string ChangePropertyActionCannotIncrementAnimatedPropertyChangeExceptionMessage => ResourceManager.GetString("ChangePropertyActionCannotIncrementAnimatedPropertyChangeExceptionMessage", resourceCulture);

		internal static string ChangePropertyActionCannotIncrementWriteOnlyPropertyExceptionMessage => ResourceManager.GetString("ChangePropertyActionCannotIncrementWriteOnlyPropertyExceptionMessage", resourceCulture);

		internal static string ChangePropertyActionCannotSetValueExceptionMessage => ResourceManager.GetString("ChangePropertyActionCannotSetValueExceptionMessage", resourceCulture);

		internal static string ChangePropertyActionPropertyIsReadOnlyExceptionMessage => ResourceManager.GetString("ChangePropertyActionPropertyIsReadOnlyExceptionMessage", resourceCulture);

		internal static string CommandDoesNotExistOnBehaviorWarningMessage => ResourceManager.GetString("CommandDoesNotExistOnBehaviorWarningMessage", resourceCulture);

		internal static string DataStateBehaviorStateNameNotFoundExceptionMessage => ResourceManager.GetString("DataStateBehaviorStateNameNotFoundExceptionMessage", resourceCulture);

		internal static string DefaultTriggerAttributeInvalidTriggerTypeSpecifiedExceptionMessage => ResourceManager.GetString("DefaultTriggerAttributeInvalidTriggerTypeSpecifiedExceptionMessage", resourceCulture);

		internal static string DuplicateItemInCollectionExceptionMessage => ResourceManager.GetString("DuplicateItemInCollectionExceptionMessage", resourceCulture);

		internal static string EventTriggerBaseInvalidEventExceptionMessage => ResourceManager.GetString("EventTriggerBaseInvalidEventExceptionMessage", resourceCulture);

		internal static string EventTriggerCannotFindEventNameExceptionMessage => ResourceManager.GetString("EventTriggerCannotFindEventNameExceptionMessage", resourceCulture);

		internal static string GoToStateActionTargetHasNoStateGroups => ResourceManager.GetString("GoToStateActionTargetHasNoStateGroups", resourceCulture);

		internal static string InvalidLeftOperand => ResourceManager.GetString("InvalidLeftOperand", resourceCulture);

		internal static string InvalidOperands => ResourceManager.GetString("InvalidOperands", resourceCulture);

		internal static string InvalidRightOperand => ResourceManager.GetString("InvalidRightOperand", resourceCulture);

		internal static string RetargetedTypeConstraintViolatedExceptionMessage => ResourceManager.GetString("RetargetedTypeConstraintViolatedExceptionMessage", resourceCulture);

		internal static string TypeConstraintViolatedExceptionMessage => ResourceManager.GetString("TypeConstraintViolatedExceptionMessage", resourceCulture);

		internal static string UnableToResolveTargetNameWarningMessage => ResourceManager.GetString("UnableToResolveTargetNameWarningMessage", resourceCulture);

		internal static string UnsupportedRemoveTargetExceptionMessage => ResourceManager.GetString("UnsupportedRemoveTargetExceptionMessage", resourceCulture);

		internal ExceptionStringTable()
		{
		}
	}
	public interface IAttachedObject
	{
		DependencyObject AssociatedObject { get; }

		void Attach(DependencyObject dependencyObject);

		void Detach();
	}
	public static class Interaction
	{
		private static readonly DependencyProperty TriggersProperty = DependencyProperty.RegisterAttached("ShadowTriggers", typeof(TriggerCollection), typeof(Interaction), (PropertyMetadata)new FrameworkPropertyMetadata(new PropertyChangedCallback(OnTriggersChanged)));

		private static readonly DependencyProperty BehaviorsProperty = DependencyProperty.RegisterAttached("ShadowBehaviors", typeof(BehaviorCollection), typeof(Interaction), (PropertyMetadata)new FrameworkPropertyMetadata(new PropertyChangedCallback(OnBehaviorsChanged)));

		internal static bool ShouldRunInDesignMode { get; set; }

		public static TriggerCollection GetTriggers(DependencyObject obj)
		{
			TriggerCollection triggerCollection = (TriggerCollection)obj.GetValue(TriggersProperty);
			if (triggerCollection == null)
			{
				triggerCollection = new TriggerCollection();
				obj.SetValue(TriggersProperty, (object)triggerCollection);
			}
			return triggerCollection;
		}

		public static BehaviorCollection GetBehaviors(DependencyObject obj)
		{
			BehaviorCollection behaviorCollection = (BehaviorCollection)obj.GetValue(BehaviorsProperty);
			if (behaviorCollection == null)
			{
				behaviorCollection = new BehaviorCollection();
				obj.SetValue(BehaviorsProperty, (object)behaviorCollection);
			}
			return behaviorCollection;
		}

		private static void OnBehaviorsChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
		{
			BehaviorCollection behaviorCollection = (BehaviorCollection)((DependencyPropertyChangedEventArgs)(ref args)).OldValue;
			BehaviorCollection behaviorCollection2 = (BehaviorCollection)((DependencyPropertyChangedEventArgs)(ref args)).NewValue;
			if (behaviorCollection == behaviorCollection2)
			{
				return;
			}
			if (behaviorCollection != null && ((IAttachedObject)behaviorCollection).AssociatedObject != null)
			{
				behaviorCollection.Detach();
			}
			if (behaviorCollection2 != null && obj != null)
			{
				if (((IAttachedObject)behaviorCollection2).AssociatedObject != null)
				{
					throw new InvalidOperationException(ExceptionStringTable.CannotHostBehaviorCollectionMultipleTimesExceptionMessage);
				}
				behaviorCollection2.Attach(obj);
			}
		}

		private static void OnTriggersChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
		{
			TriggerCollection triggerCollection = ((DependencyPropertyChangedEventArgs)(ref args)).OldValue as TriggerCollection;
			TriggerCollection triggerCollection2 = ((DependencyPropertyChangedEventArgs)(ref args)).NewValue as TriggerCollection;
			if (triggerCollection == triggerCollection2)
			{
				return;
			}
			if (triggerCollection != null && ((IAttachedObject)triggerCollection).AssociatedObject != null)
			{
				triggerCollection.Detach();
			}
			if (triggerCollection2 != null && obj != null)
			{
				if (((IAttachedObject)triggerCollection2).AssociatedObject != null)
				{
					throw new InvalidOperationException(ExceptionStringTable.CannotHostTriggerCollectionMultipleTimesExceptionMessage);
				}
				triggerCollection2.Attach(obj);
			}
		}

		internal static bool IsElementLoaded(FrameworkElement element)
		{
			return element.IsLoaded;
		}
	}
	internal static class InteractionContext
	{
		private static Assembly runtimeAssembly;

		private static object playerContextInstance;

		private static object activeNavigationViewModelObject;

		private static PropertyInfo libraryNamePropertyInfo;

		private static PropertyInfo activeNavigationViewModelPropertyInfo;

		private static PropertyInfo canGoBackPropertyInfo;

		private static PropertyInfo canGoForwardPropertyInfo;

		private static PropertyInfo sketchFlowAnimationPlayerPropertyInfo;

		private static MethodInfo goBackMethodInfo;

		private static MethodInfo goForwardMethodInfo;

		private static MethodInfo navigateToScreenMethodInfo;

		private static MethodInfo invokeStateChangeMethodInfo;

		private static MethodInfo playSketchFlowAnimationMethodInfo;

		private static NavigationService navigationService;

		private static readonly string LibraryName;

		private static readonly Dictionary<string, Serializer.Data> NavigationData;

		public static object ActiveNavigationViewModelObject
		{
			get
			{
				return activeNavigationViewModelObject ?? activeNavigationViewModelPropertyInfo.GetValue(playerContextInstance, null);
			}
			internal set
			{
				activeNavigationViewModelObject = value;
			}
		}

		private static bool IsPrototypingRuntimeLoaded => runtimeAssembly != null;

		private static bool CanGoBack => (bool)canGoBackPropertyInfo.GetValue(ActiveNavigationViewModelObject, null);

		private static bool CanGoForward => (bool)canGoForwardPropertyInfo.GetValue(ActiveNavigationViewModelObject, null);

		private static bool PlatformCanGoBack
		{
			get
			{
				if (navigationService != null)
				{
					return navigationService.CanGoBack;
				}
				return false;
			}
		}

		private static bool PlatformCanGoForward
		{
			get
			{
				if (navigationService != null)
				{
					return navigationService.CanGoForward;
				}
				return false;
			}
		}

		static InteractionContext()
		{
			NavigationData = new Dictionary<string, Serializer.Data>(StringComparer.OrdinalIgnoreCase);
			runtimeAssembly = FindPlatformRuntimeAssembly();
			if (runtimeAssembly != null)
			{
				InitializeRuntimeNavigation();
				LibraryName = (string)libraryNamePropertyInfo.GetValue(playerContextInstance, null);
				LoadNavigationData(LibraryName);
			}
			else
			{
				InitalizePlatformNavigation();
			}
		}

		public static void GoBack()
		{
			if (IsPrototypingRuntimeLoaded)
			{
				if (CanGoBack)
				{
					goBackMethodInfo.Invoke(ActiveNavigationViewModelObject, null);
				}
			}
			else
			{
				PlatformGoBack();
			}
		}

		public static void GoForward()
		{
			if (IsPrototypingRuntimeLoaded)
			{
				if (CanGoForward)
				{
					goForwardMethodInfo.Invoke(ActiveNavigationViewModelObject, null);
				}
			}
			else
			{
				PlatformGoForward();
			}
		}

		public static bool IsScreen(string screenName)
		{
			if (!IsPrototypingRuntimeLoaded)
			{
				return false;
			}
			return GetScreenClassName(screenName) != null;
		}

		public static void GoToScreen(string screenName, Assembly assembly)
		{
			if (IsPrototypingRuntimeLoaded)
			{
				string screenClassName = GetScreenClassName(screenName);
				if (!string.IsNullOrEmpty(screenClassName))
				{
					object[] parameters = new object[2] { screenClassName, true };
					navigateToScreenMethodInfo.Invoke(ActiveNavigationViewModelObject, parameters);
				}
			}
			else if (!(assembly == null))
			{
				AssemblyName assemblyName = new AssemblyName(assembly.FullName);
				if (assemblyName != null)
				{
					PlatformGoToScreen(assemblyName.Name, screenName);
				}
			}
		}

		public static void GoToState(string screen, string state)
		{
			if (!string.IsNullOrEmpty(screen) && !string.IsNullOrEmpty(state) && IsPrototypingRuntimeLoaded)
			{
				object[] parameters = new object[3] { screen, state, false };
				invokeStateChangeMethodInfo.Invoke(ActiveNavigationViewModelObject, parameters);
			}
		}

		public static void PlaySketchFlowAnimation(string sketchFlowAnimation, string owningScreen)
		{
			if (!string.IsNullOrEmpty(sketchFlowAnimation) && !string.IsNullOrEmpty(owningScreen) && IsPrototypingRuntimeLoaded)
			{
				object value = activeNavigationViewModelPropertyInfo.GetValue(playerContextInstance, null);
				object[] parameters = new object[2] { sketchFlowAnimation, owningScreen };
				playSketchFlowAnimationMethodInfo.Invoke(value, parameters);
			}
		}

		private static void InitializeRuntimeNavigation()
		{
			Type? type = runtimeAssembly.GetType("Microsoft.Expression.Prototyping.Services.PlayerContext");
			PropertyInfo property = type.GetProperty("Instance");
			activeNavigationViewModelPropertyInfo = type.GetProperty("ActiveNavigationViewModel");
			libraryNamePropertyInfo = type.GetProperty("LibraryName");
			playerContextInstance = property.GetValue(null, null);
			Type? type2 = runtimeAssembly.GetType("Microsoft.Expression.Prototyping.Navigation.NavigationViewModel");
			canGoBackPropertyInfo = type2.GetProperty("CanGoBack");
			canGoForwardPropertyInfo = type2.GetProperty("CanGoForward");
			goBackMethodInfo = type2.GetMethod("GoBack");
			goForwardMethodInfo = type2.GetMethod("GoForward");
			navigateToScreenMethodInfo = type2.GetMethod("NavigateToScreen");
			invokeStateChangeMethodInfo = type2.GetMethod("InvokeStateChange");
			playSketchFlowAnimationMethodInfo = type2.GetMethod("PlaySketchFlowAnimation");
			sketchFlowAnimationPlayerPropertyInfo = type2.GetProperty("SketchFlowAnimationPlayer");
		}

		private static Serializer.Data LoadNavigationData(string assemblyName)
		{
			Serializer.Data value = null;
			if (NavigationData.TryGetValue(assemblyName, out value))
			{
				return value;
			}
			_ = Application.Current;
			string uriString = string.Format(CultureInfo.InvariantCulture, "/{0};component/Sketch.Flow", assemblyName);
			try
			{
				StreamResourceInfo resourceStream = Application.GetResourceStream(new Uri(uriString, UriKind.Relative));
				if (resourceStream != null)
				{
					value = Serializer.Deserialize(resourceStream.Stream);
					NavigationData[assemblyName] = value;
				}
			}
			catch (IOException)
			{
			}
			catch (InvalidOperationException)
			{
			}
			return value ?? new Serializer.Data();
		}

		private static string GetScreenClassName(string screenName)
		{
			Serializer.Data value = null;
			NavigationData.TryGetValue(LibraryName, out value);
			if (value == null || value.Screens == null)
			{
				return null;
			}
			if (!value.Screens.Any((Serializer.Data.Screen screen) => screen.ClassName == screenName))
			{
				screenName = (from screen in value.Screens
					where screen.DisplayName == screenName
					select screen.ClassName).FirstOrDefault();
			}
			return screenName;
		}

		private static void InitalizePlatformNavigation()
		{
			Window mainWindow = Application.Current.MainWindow;
			NavigationWindow val = (NavigationWindow)(object)((mainWindow is NavigationWindow) ? mainWindow : null);
			if (val != null)
			{
				navigationService = val.NavigationService;
			}
		}

		private static Assembly FindPlatformRuntimeAssembly()
		{
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				if (assembly.GetName().Name.Equals("Microsoft.Expression.Prototyping.Runtime"))
				{
					return assembly;
				}
			}
			return null;
		}

		public static void PlatformGoBack()
		{
			if (navigationService != null && PlatformCanGoBack)
			{
				navigationService.GoBack();
			}
		}

		public static void PlatformGoForward()
		{
			if (navigationService != null && PlatformCanGoForward)
			{
				navigationService.GoForward();
			}
		}

		public static void PlatformGoToScreen(string assemblyName, string screen)
		{
			ObjectHandle objectHandle = Activator.CreateInstance(assemblyName, screen);
			navigationService.Navigate(objectHandle.Unwrap());
		}
	}
	public sealed class InvokeCommandAction : TriggerAction<DependencyObject>
	{
		private string commandName;

		public static readonly DependencyProperty CommandProperty = DependencyProperty.Register("Command", typeof(ICommand), typeof(InvokeCommandAction), (PropertyMetadata)null);

		public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register("CommandParameter", typeof(object), typeof(InvokeCommandAction), (PropertyMetadata)null);

		public static readonly DependencyProperty EventArgsConverterProperty = DependencyProperty.Register("EventArgsConverter", typeof(IValueConverter), typeof(InvokeCommandAction), new PropertyMetadata((PropertyChangedCallback)null));

		public static readonly DependencyProperty EventArgsConverterParameterProperty = DependencyProperty.Register("EventArgsConverterParameter", typeof(object), typeof(InvokeCommandAction), new PropertyMetadata((PropertyChangedCallback)null));

		public static readonly DependencyProperty EventArgsParameterPathProperty = DependencyProperty.Register("EventArgsParameterPath", typeof(string), typeof(InvokeCommandAction), new PropertyMetadata((PropertyChangedCallback)null));

		public string CommandName
		{
			get
			{
				((Freezable)this).ReadPreamble();
				return commandName;
			}
			set
			{
				if (CommandName != value)
				{
					((Freezable)this).WritePreamble();
					commandName = value;
					((Freezable)this).WritePostscript();
				}
			}
		}

		public ICommand Command
		{
			get
			{
				return (ICommand)((DependencyObject)this).GetValue(CommandProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(CommandProperty, (object)value);
			}
		}

		public object CommandParameter
		{
			get
			{
				return ((DependencyObject)this).GetValue(CommandParameterProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(CommandParameterProperty, value);
			}
		}

		public IValueConverter EventArgsConverter
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (IValueConverter)((DependencyObject)this).GetValue(EventArgsConverterProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(EventArgsConverterProperty, (object)value);
			}
		}

		public object EventArgsConverterParameter
		{
			get
			{
				return ((DependencyObject)this).GetValue(EventArgsConverterParameterProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(EventArgsConverterParameterProperty, value);
			}
		}

		public string EventArgsParameterPath
		{
			get
			{
				return (string)((DependencyObject)this).GetValue(EventArgsParameterPathProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(EventArgsParameterPathProperty, (object)value);
			}
		}

		public bool PassEventArgsToCommand { get; set; }

		protected override void Invoke(object parameter)
		{
			if (base.AssociatedObject == null)
			{
				return;
			}
			ICommand command = ResolveCommand();
			if (command != null)
			{
				object obj = CommandParameter;
				if (obj == null && !string.IsNullOrWhiteSpace(EventArgsParameterPath))
				{
					obj = GetEventArgsPropertyPathValue(parameter);
				}
				if (obj == null && EventArgsConverter != null)
				{
					obj = EventArgsConverter.Convert(parameter, typeof(object), EventArgsConverterParameter, CultureInfo.CurrentCulture);
				}
				if (obj == null && PassEventArgsToCommand)
				{
					obj = parameter;
				}
				if (command.CanExecute(obj))
				{
					command.Execute(obj);
				}
			}
		}

		private object GetEventArgsPropertyPathValue(object parameter)
		{
			object obj = parameter;
			string[] array = EventArgsParameterPath.Split('.');
			foreach (string name in array)
			{
				obj = obj.GetType().GetProperty(name).GetValue(obj, null);
			}
			return obj;
		}

		private ICommand ResolveCommand()
		{
			ICommand result = null;
			if (Command != null)
			{
				result = Command;
			}
			else if (base.AssociatedObject != null)
			{
				PropertyInfo[] properties = ((object)base.AssociatedObject).GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);
				foreach (PropertyInfo propertyInfo in properties)
				{
					if (typeof(ICommand).IsAssignableFrom(propertyInfo.PropertyType) && string.Equals(propertyInfo.Name, CommandName, StringComparison.Ordinal))
					{
						result = (ICommand)propertyInfo.GetValue(base.AssociatedObject, null);
					}
				}
			}
			return result;
		}
	}
	internal interface ITickTimer
	{
		TimeSpan Interval { get; set; }

		event EventHandler Tick;

		void Start();

		void Stop();
	}
	internal sealed class NameResolvedEventArgs : EventArgs
	{
		private object oldObject;

		private object newObject;

		public object OldObject => oldObject;

		public object NewObject => newObject;

		public NameResolvedEventArgs(object oldObject, object newObject)
		{
			this.oldObject = oldObject;
			this.newObject = newObject;
		}
	}
	internal sealed class NameResolver
	{
		private string name;

		private FrameworkElement nameScopeReferenceElement;

		public string Name
		{
			get
			{
				return name;
			}
			set
			{
				DependencyObject @object = Object;
				name = value;
				UpdateObjectFromName(@object);
			}
		}

		public DependencyObject Object
		{
			get
			{
				if (string.IsNullOrEmpty(Name) && HasAttempedResolve)
				{
					return (DependencyObject)(object)NameScopeReferenceElement;
				}
				return ResolvedObject;
			}
		}

		public FrameworkElement NameScopeReferenceElement
		{
			get
			{
				return nameScopeReferenceElement;
			}
			set
			{
				FrameworkElement oldNameScopeReference = NameScopeReferenceElement;
				nameScopeReferenceElement = value;
				OnNameScopeReferenceElementChanged(oldNameScopeReference);
			}
		}

		private FrameworkElement ActualNameScopeReferenceElement
		{
			get
			{
				if (NameScopeReferenceElement == null || !Interaction.IsElementLoaded(NameScopeReferenceElement))
				{
					return null;
				}
				return GetActualNameScopeReference(NameScopeReferenceElement);
			}
		}

		private DependencyObject ResolvedObject { get; set; }

		private bool PendingReferenceElementLoad { get; set; }

		private bool HasAttempedResolve { get; set; }

		public event EventHandler<NameResolvedEventArgs> ResolvedElementChanged;

		private void OnNameScopeReferenceElementChanged(FrameworkElement oldNameScopeReference)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			if (PendingReferenceElementLoad)
			{
				oldNameScopeReference.Loaded -= new RoutedEventHandler(OnNameScopeReferenceLoaded);
				PendingReferenceElementLoad = false;
			}
			HasAttempedResolve = false;
			UpdateObjectFromName(Object);
		}

		private void UpdateObjectFromName(DependencyObject oldObject)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			DependencyObject resolvedObject = null;
			ResolvedObject = null;
			if (NameScopeReferenceElement != null)
			{
				if (!Interaction.IsElementLoaded(NameScopeReferenceElement))
				{
					NameScopeReferenceElement.Loaded += new RoutedEventHandler(OnNameScopeReferenceLoaded);
					PendingReferenceElementLoad = true;
					return;
				}
				if (!string.IsNullOrEmpty(Name))
				{
					FrameworkElement actualNameScopeReferenceElement = ActualNameScopeReferenceElement;
					if (actualNameScopeReferenceElement != null)
					{
						object obj = actualNameScopeReferenceElement.FindName(Name);
						resolvedObject = (DependencyObject)((obj is DependencyObject) ? obj : null);
					}
				}
			}
			HasAttempedResolve = true;
			ResolvedObject = resolvedObject;
			if (oldObject != Object)
			{
				OnObjectChanged(oldObject, Object);
			}
		}

		private void OnObjectChanged(DependencyObject oldTarget, DependencyObject newTarget)
		{
			if (this.ResolvedElementChanged != null)
			{
				this.ResolvedElementChanged(this, new NameResolvedEventArgs(oldTarget, newTarget));
			}
		}

		private FrameworkElement GetActualNameScopeReference(FrameworkElement initialReferenceElement)
		{
			FrameworkElement val = initialReferenceElement;
			if (IsNameScope(initialReferenceElement))
			{
				DependencyObject parent = initialReferenceElement.Parent;
				val = (FrameworkElement)(((object)((parent is FrameworkElement) ? parent : null)) ?? ((object)val));
			}
			return val;
		}

		private bool IsNameScope(FrameworkElement frameworkElement)
		{
			DependencyObject parent = frameworkElement.Parent;
			FrameworkElement val = (FrameworkElement)(object)((parent is FrameworkElement) ? parent : null);
			if (val != null)
			{
				return val.FindName(Name) != null;
			}
			return false;
		}

		private void OnNameScopeReferenceLoaded(object sender, RoutedEventArgs e)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			PendingReferenceElementLoad = false;
			NameScopeReferenceElement.Loaded -= new RoutedEventHandler(OnNameScopeReferenceLoaded);
			UpdateObjectFromName(Object);
		}
	}
	internal enum ScreenType
	{
		None,
		Navigation,
		Composition
	}
	internal sealed class Serializer
	{
		public class Data
		{
			public class RuntimeOptionsData
			{
				public bool HideNavigation { get; set; }

				public bool HideAnnotationAndInk { get; set; }

				public bool DisableInking { get; set; }

				public bool HideDesignTimeAnnotations { get; set; }

				public bool ShowDesignTimeAnnotationsAtStart { get; set; }
			}

			public class ViewStateData
			{
				public double Zoom { get; set; }

				public Point? Center { get; set; }
			}

			public class Screen
			{
				public ScreenType Type { get; set; }

				public string ClassName { get; set; }

				public string DisplayName { get; set; }

				public string FileName { get; set; }

				public List<Annotation> Annotations { get; set; }

				public Point Position { get; set; }

				public int? VisualTag { get; set; }

				public Screen()
				{
					Annotations = new List<Annotation>();
				}
			}

			public class VisualTag
			{
				public string Name { get; set; }

				public string Color { get; set; }
			}

			public static readonly int CurrentSchemaVersion = 2;

			public static readonly int DefaultSchemaVersion = 1;

			public static readonly int MinValidSchemaVersion = 1;

			[XmlAttribute]
			public int SchemaVersion { get; set; }

			public Guid SketchFlowGuid { get; set; }

			public string StartScreen { get; set; }

			public List<Screen> Screens { get; set; }

			public string SharePointDocumentLibrary { get; set; }

			public string SharePointProjectName { get; set; }

			public int PrototypeRevision { get; set; }

			public string BrandingText { get; set; }

			public RuntimeOptionsData RuntimeOptions { get; set; }

			public List<VisualTag> VisualTags { get; set; }

			public ViewStateData ViewState { get; set; }

			public Data()
			{
				SchemaVersion = DefaultSchemaVersion;
				RuntimeOptions = new RuntimeOptionsData();
				ViewState = new ViewStateData();
				VisualTags = new List<VisualTag>();
				Screens = new List<Screen>();
			}
		}

		private Serializer()
		{
		}

		public static Color HexStringToColor(string value)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			if (value.Length != 8)
			{
				throw new InvalidOperationException("Serializer.HexStringToColor requires input of a 8-character hexadecimal string, but received '" + value + "'.");
			}
			byte num = byte.Parse(value.Substring(0, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
			byte b = byte.Parse(value.Substring(2, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
			byte b2 = byte.Parse(value.Substring(4, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
			byte b3 = byte.Parse(value.Substring(6, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
			return Color.FromArgb(num, b, b2, b3);
		}

		public static string ColorToHexString(Color color)
		{
			string text = ((Color)(ref color)).A.ToString("X2", CultureInfo.InvariantCulture);
			string text2 = ((Color)(ref color)).R.ToString("X2", CultureInfo.InvariantCulture);
			string text3 = ((Color)(ref color)).G.ToString("X2", CultureInfo.InvariantCulture);
			string text4 = ((Color)(ref color)).B.ToString("X2", CultureInfo.InvariantCulture);
			return text + text2 + text3 + text4;
		}

		public static void Serialize(Data data, Stream stream)
		{
			data.SchemaVersion = Data.CurrentSchemaVersion;
			XmlWriterSettings settings = new XmlWriterSettings
			{
				Encoding = Encoding.UTF8,
				Indent = true
			};
			using XmlWriter xmlWriter = XmlWriter.Create(stream, settings);
			new XmlSerializer(typeof(Data)).Serialize(xmlWriter, data);
		}

		public static Data Deserialize(string filePath)
		{
			using FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
			return Deserialize(stream);
		}

		public static Data Deserialize(Stream stream)
		{
			try
			{
				return new XmlSerializer(typeof(Data)).Deserialize(stream) as Data;
			}
			catch (InvalidOperationException)
			{
				return null;
			}
		}

		public static int? GetSchemaVersion(string filePath)
		{
			using FileStream input = new FileStream(filePath, FileMode.Open, FileAccess.Read);
			using XmlReader xmlReader = XmlReader.Create(input);
			while (xmlReader.Read())
			{
				if (xmlReader.NodeType == XmlNodeType.Element && StringComparer.InvariantCultureIgnoreCase.Equals(xmlReader.LocalName, "Data"))
				{
					xmlReader.MoveToAttribute("SchemaVersion");
					break;
				}
			}
			int? result = null;
			if (!xmlReader.EOF && int.TryParse(xmlReader.Value, out var result2))
			{
				result = result2;
			}
			return result;
		}
	}
	public abstract class TargetedTriggerAction<T> : TargetedTriggerAction where T : class
	{
		protected new T Target => (T)base.Target;

		protected TargetedTriggerAction()
			: base(typeof(T))
		{
		}

		internal sealed override void OnTargetChangedImpl(object oldTarget, object newTarget)
		{
			base.OnTargetChangedImpl(oldTarget, newTarget);
			OnTargetChanged(oldTarget as T, newTarget as T);
		}

		protected virtual void OnTargetChanged(T oldTarget, T newTarget)
		{
		}
	}
	public abstract class TargetedTriggerAction : TriggerAction
	{
		private Type targetTypeConstraint;

		private bool isTargetChangedRegistered;

		private NameResolver targetResolver;

		public static readonly DependencyProperty TargetObjectProperty = DependencyProperty.Register("TargetObject", typeof(object), typeof(TargetedTriggerAction), (PropertyMetadata)new FrameworkPropertyMetadata(new PropertyChangedCallback(OnTargetObjectChanged)));

		public static readonly DependencyProperty TargetNameProperty = DependencyProperty.Register("TargetName", typeof(string), typeof(TargetedTriggerAction), (PropertyMetadata)new FrameworkPropertyMetadata(new PropertyChangedCallback(OnTargetNameChanged)));

		public object TargetObject
		{
			get
			{
				return ((DependencyObject)this).GetValue(TargetObjectProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(TargetObjectProperty, value);
			}
		}

		public string TargetName
		{
			get
			{
				return (string)((DependencyObject)this).GetValue(TargetNameProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(TargetNameProperty, (object)value);
			}
		}

		protected object Target
		{
			get
			{
				object obj = base.AssociatedObject;
				if (TargetObject != null)
				{
					obj = TargetObject;
				}
				else if (IsTargetNameSet)
				{
					obj = TargetResolver.Object;
				}
				if (obj != null && !TargetTypeConstraint.IsAssignableFrom(obj.GetType()))
				{
					throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.RetargetedTypeConstraintViolatedExceptionMessage, ((object)this).GetType().Name, obj.GetType(), TargetTypeConstraint, "Target"));
				}
				return obj;
			}
		}

		protected sealed override Type AssociatedObjectTypeConstraint
		{
			get
			{
				if (TypeDescriptor.GetAttributes(((object)this).GetType())[typeof(TypeConstraintAttribute)] is TypeConstraintAttribute typeConstraintAttribute)
				{
					return typeConstraintAttribute.Constraint;
				}
				return typeof(DependencyObject);
			}
		}

		protected Type TargetTypeConstraint
		{
			get
			{
				((Freezable)this).ReadPreamble();
				return targetTypeConstraint;
			}
		}

		private bool IsTargetNameSet
		{
			get
			{
				if (string.IsNullOrEmpty(TargetName))
				{
					return ((DependencyObject)this).ReadLocalValue(TargetNameProperty) != DependencyProperty.UnsetValue;
				}
				return true;
			}
		}

		private NameResolver TargetResolver => targetResolver;

		private bool IsTargetChangedRegistered
		{
			get
			{
				return isTargetChangedRegistered;
			}
			set
			{
				isTargetChangedRegistered = value;
			}
		}

		internal TargetedTriggerAction(Type targetTypeConstraint)
			: base(typeof(DependencyObject))
		{
			this.targetTypeConstraint = targetTypeConstraint;
			targetResolver = new NameResolver();
			RegisterTargetChanged();
		}

		internal virtual void OnTargetChangedImpl(object oldTarget, object newTarget)
		{
		}

		protected override void OnAttached()
		{
			base.OnAttached();
			DependencyObject val = base.AssociatedObject;
			Behavior behavior = val as Behavior;
			RegisterTargetChanged();
			if (behavior != null)
			{
				val = ((IAttachedObject)behavior).AssociatedObject;
				behavior.AssociatedObjectChanged += OnBehaviorHostChanged;
			}
			TargetResolver.NameScopeReferenceElement = (FrameworkElement)(object)((val is FrameworkElement) ? val : null);
		}

		protected override void OnDetaching()
		{
			Behavior behavior = base.AssociatedObject as Behavior;
			base.OnDetaching();
			OnTargetChangedImpl(TargetResolver.Object, null);
			UnregisterTargetChanged();
			if (behavior != null)
			{
				behavior.AssociatedObjectChanged -= OnBehaviorHostChanged;
			}
			TargetResolver.NameScopeReferenceElement = null;
		}

		private void OnBehaviorHostChanged(object sender, EventArgs e)
		{
			NameResolver nameResolver = TargetResolver;
			DependencyObject obj = ((IAttachedObject)sender).AssociatedObject;
			nameResolver.NameScopeReferenceElement = (FrameworkElement)(object)((obj is FrameworkElement) ? obj : null);
		}

		private void RegisterTargetChanged()
		{
			if (!IsTargetChangedRegistered)
			{
				TargetResolver.ResolvedElementChanged += OnTargetChanged;
				IsTargetChangedRegistered = true;
			}
		}

		private void UnregisterTargetChanged()
		{
			if (IsTargetChangedRegistered)
			{
				TargetResolver.ResolvedElementChanged -= OnTargetChanged;
				IsTargetChangedRegistered = false;
			}
		}

		private static void OnTargetObjectChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
		{
			((TargetedTriggerAction)(object)obj).OnTargetChanged(obj, new NameResolvedEventArgs(((DependencyPropertyChangedEventArgs)(ref args)).OldValue, ((DependencyPropertyChangedEventArgs)(ref args)).NewValue));
		}

		private static void OnTargetNameChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
		{
			((TargetedTriggerAction)(object)obj).TargetResolver.Name = (string)((DependencyPropertyChangedEventArgs)(ref args)).NewValue;
		}

		private void OnTargetChanged(object sender, NameResolvedEventArgs e)
		{
			if (base.AssociatedObject != null)
			{
				OnTargetChangedImpl(e.OldObject, e.NewObject);
			}
		}
	}
	public abstract class TriggerAction<T> : TriggerAction where T : DependencyObject
	{
		protected new T AssociatedObject => (T)(object)base.AssociatedObject;

		protected sealed override Type AssociatedObjectTypeConstraint => base.AssociatedObjectTypeConstraint;

		protected TriggerAction()
			: base(typeof(T))
		{
		}
	}
	[DefaultTrigger(typeof(UIElement), typeof(EventTrigger), "MouseLeftButtonDown")]
	[DefaultTrigger(typeof(ButtonBase), typeof(EventTrigger), "Click")]
	public abstract class TriggerAction : Animatable, IAttachedObject
	{
		private bool isHosted;

		private DependencyObject associatedObject;

		private Type associatedObjectTypeConstraint;

		public static readonly DependencyProperty IsEnabledProperty = DependencyProperty.Register("IsEnabled", typeof(bool), typeof(TriggerAction), (PropertyMetadata)new FrameworkPropertyMetadata((object)true));

		public bool IsEnabled
		{
			get
			{
				return (bool)((DependencyObject)this).GetValue(IsEnabledProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(IsEnabledProperty, (object)value);
			}
		}

		protected DependencyObject AssociatedObject
		{
			get
			{
				((Freezable)this).ReadPreamble();
				return associatedObject;
			}
		}

		protected virtual Type AssociatedObjectTypeConstraint
		{
			get
			{
				((Freezable)this).ReadPreamble();
				return associatedObjectTypeConstraint;
			}
		}

		internal bool IsHosted
		{
			get
			{
				((Freezable)this).ReadPreamble();
				return isHosted;
			}
			set
			{
				((Freezable)this).WritePreamble();
				isHosted = value;
				((Freezable)this).WritePostscript();
			}
		}

		DependencyObject IAttachedObject.AssociatedObject => AssociatedObject;

		internal TriggerAction(Type associatedObjectTypeConstraint)
		{
			this.associatedObjectTypeConstraint = associatedObjectTypeConstraint;
		}

		internal void CallInvoke(object parameter)
		{
			if (IsEnabled)
			{
				Invoke(parameter);
			}
		}

		protected abstract void Invoke(object parameter);

		protected virtual void OnAttached()
		{
		}

		protected virtual void OnDetaching()
		{
		}

		protected override Freezable CreateInstanceCore()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			return (Freezable)Activator.CreateInstance(((object)this).GetType());
		}

		public void Attach(DependencyObject dependencyObject)
		{
			if (dependencyObject != AssociatedObject)
			{
				if (AssociatedObject != null)
				{
					throw new InvalidOperationException(ExceptionStringTable.CannotHostTriggerActionMultipleTimesExceptionMessage);
				}
				if (dependencyObject != null && !AssociatedObjectTypeConstraint.IsAssignableFrom(((object)dependencyObject).GetType()))
				{
					throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.TypeConstraintViolatedExceptionMessage, ((object)this).GetType().Name, ((object)dependencyObject).GetType().Name, AssociatedObjectTypeConstraint.Name));
				}
				((Freezable)this).WritePreamble();
				associatedObject = dependencyObject;
				((Freezable)this).WritePostscript();
				OnAttached();
			}
		}

		public void Detach()
		{
			OnDetaching();
			((Freezable)this).WritePreamble();
			associatedObject = null;
			((Freezable)this).WritePostscript();
		}
	}
	public class TriggerActionCollection : AttachableCollection<TriggerAction>
	{
		internal TriggerActionCollection()
		{
		}

		protected override void OnAttached()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<TriggerAction> enumerator = ((FreezableCollection<TriggerAction>)this).GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					enumerator.Current.Attach(base.AssociatedObject);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		protected override void OnDetaching()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<TriggerAction> enumerator = ((FreezableCollection<TriggerAction>)this).GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					enumerator.Current.Detach();
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		internal override void ItemAdded(TriggerAction item)
		{
			if (item.IsHosted)
			{
				throw new InvalidOperationException(ExceptionStringTable.CannotHostTriggerActionMultipleTimesExceptionMessage);
			}
			if (base.AssociatedObject != null)
			{
				item.Attach(base.AssociatedObject);
			}
			item.IsHosted = true;
		}

		internal override void ItemRemoved(TriggerAction item)
		{
			if (((IAttachedObject)item).AssociatedObject != null)
			{
				item.Detach();
			}
			item.IsHosted = false;
		}

		protected override Freezable CreateInstanceCore()
		{
			return (Freezable)(object)new TriggerActionCollection();
		}
	}
	public abstract class TriggerBase<T> : TriggerBase where T : DependencyObject
	{
		protected new T AssociatedObject => (T)(object)base.AssociatedObject;

		protected sealed override Type AssociatedObjectTypeConstraint => base.AssociatedObjectTypeConstraint;

		protected TriggerBase()
			: base(typeof(T))
		{
		}
	}
	public class PreviewInvokeEventArgs : EventArgs
	{
		public bool Cancelling { get; set; }
	}
	[ContentProperty("Actions")]
	public abstract class TriggerBase : Animatable, IAttachedObject
	{
		private DependencyObject associatedObject;

		private Type associatedObjectTypeConstraint;

		private static readonly DependencyPropertyKey ActionsPropertyKey = DependencyProperty.RegisterReadOnly("Actions", typeof(TriggerActionCollection), typeof(TriggerBase), (PropertyMetadata)new FrameworkPropertyMetadata());

		public static readonly DependencyProperty ActionsProperty = ActionsPropertyKey.DependencyProperty;

		protected DependencyObject AssociatedObject
		{
			get
			{
				((Freezable)this).ReadPreamble();
				return associatedObject;
			}
		}

		protected virtual Type AssociatedObjectTypeConstraint
		{
			get
			{
				((Freezable)this).ReadPreamble();
				return associatedObjectTypeConstraint;
			}
		}

		public TriggerActionCollection Actions => (TriggerActionCollection)((DependencyObject)this).GetValue(ActionsProperty);

		DependencyObject IAttachedObject.AssociatedObject => AssociatedObject;

		public event EventHandler<PreviewInvokeEventArgs> PreviewInvoke;

		internal TriggerBase(Type associatedObjectTypeConstraint)
		{
			this.associatedObjectTypeConstraint = associatedObjectTypeConstraint;
			TriggerActionCollection triggerActionCollection = new TriggerActionCollection();
			((DependencyObject)this).SetValue(ActionsPropertyKey, (object)triggerActionCollection);
		}

		protected void InvokeActions(object parameter)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (this.PreviewInvoke != null)
			{
				PreviewInvokeEventArgs previewInvokeEventArgs = new PreviewInvokeEventArgs();
				this.PreviewInvoke(this, previewInvokeEventArgs);
				if (previewInvokeEventArgs.Cancelling)
				{
					return;
				}
			}
			Enumerator<TriggerAction> enumerator = ((FreezableCollection<TriggerAction>)Actions).GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					enumerator.Current.CallInvoke(parameter);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		protected virtual void OnAttached()
		{
		}

		protected virtual void OnDetaching()
		{
		}

		protected override Freezable CreateInstanceCore()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			return (Freezable)Activator.CreateInstance(((object)this).GetType());
		}

		public void Attach(DependencyObject dependencyObject)
		{
			if (dependencyObject != AssociatedObject)
			{
				if (AssociatedObject != null)
				{
					throw new InvalidOperationException(ExceptionStringTable.CannotHostTriggerMultipleTimesExceptionMessage);
				}
				if (dependencyObject != null && !AssociatedObjectTypeConstraint.IsAssignableFrom(((object)dependencyObject).GetType()))
				{
					throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.TypeConstraintViolatedExceptionMessage, ((object)this).GetType().Name, ((object)dependencyObject).GetType().Name, AssociatedObjectTypeConstraint.Name));
				}
				((Freezable)this).WritePreamble();
				associatedObject = dependencyObject;
				((Freezable)this).WritePostscript();
				Actions.Attach(dependencyObject);
				OnAttached();
			}
		}

		public void Detach()
		{
			OnDetaching();
			((Freezable)this).WritePreamble();
			associatedObject = null;
			((Freezable)this).WritePostscript();
			Actions.Detach();
		}
	}
	public sealed class TriggerCollection : AttachableCollection<TriggerBase>
	{
		internal TriggerCollection()
		{
		}

		protected override void OnAttached()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<TriggerBase> enumerator = ((FreezableCollection<TriggerBase>)this).GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					enumerator.Current.Attach(base.AssociatedObject);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		protected override void OnDetaching()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<TriggerBase> enumerator = ((FreezableCollection<TriggerBase>)this).GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					enumerator.Current.Detach();
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		internal override void ItemAdded(TriggerBase item)
		{
			if (base.AssociatedObject != null)
			{
				item.Attach(base.AssociatedObject);
			}
		}

		internal override void ItemRemoved(TriggerBase item)
		{
			if (((IAttachedObject)item).AssociatedObject != null)
			{
				item.Detach();
			}
		}

		protected override Freezable CreateInstanceCore()
		{
			return (Freezable)(object)new TriggerCollection();
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	public sealed class TypeConstraintAttribute : Attribute
	{
		public Type Constraint { get; private set; }

		public TypeConstraintAttribute(Type constraint)
		{
			Constraint = constraint;
		}
	}
	internal static class TypeConverterHelper
	{
		internal static object DoConversionFrom(TypeConverter converter, object value)
		{
			object result = value;
			try
			{
				if (converter != null && value != null && converter.CanConvertFrom(value.GetType()))
				{
					result = converter.ConvertFrom(null, CultureInfo.InvariantCulture, value);
				}
			}
			catch (Exception e)
			{
				if (!ShouldEatException(e))
				{
					throw;
				}
			}
			return result;
		}

		private static bool ShouldEatException(Exception e)
		{
			bool flag = false;
			if (e.InnerException != null)
			{
				flag |= ShouldEatException(e.InnerException);
			}
			return flag || e is FormatException;
		}

		internal static TypeConverter GetTypeConverter(Type type)
		{
			return TypeDescriptor.GetConverter(type);
		}
	}
	public static class VisualStateUtilities
	{
		public static bool GoToState(FrameworkElement element, string stateName, bool useTransitions)
		{
			bool result = false;
			if (!string.IsNullOrEmpty(stateName))
			{
				Control val = (Control)(object)((element is Control) ? element : null);
				if (val != null)
				{
					((FrameworkElement)val).ApplyTemplate();
					result = VisualStateManager.GoToState((FrameworkElement)(object)val, stateName, useTransitions);
				}
				else
				{
					result = VisualStateManager.GoToElementState(element, stateName, useTransitions);
				}
			}
			return result;
		}

		public static IList GetVisualStateGroups(FrameworkElement targetObject)
		{
			IList list = new List<VisualStateGroup>();
			if (targetObject != null)
			{
				list = VisualStateManager.GetVisualStateGroups(targetObject);
				if (list.Count == 0 && VisualTreeHelper.GetChildrenCount((DependencyObject)(object)targetObject) > 0)
				{
					DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(object)targetObject, 0);
					list = VisualStateManager.GetVisualStateGroups((FrameworkElement)(object)((child is FrameworkElement) ? child : null));
				}
				if (list.Count == 0)
				{
					UserControl val = (UserControl)(object)((targetObject is UserControl) ? targetObject : null);
					if (val != null)
					{
						object content = ((ContentControl)val).Content;
						FrameworkElement val2 = (FrameworkElement)((content is FrameworkElement) ? content : null);
						if (val2 != null)
						{
							list = VisualStateManager.GetVisualStateGroups(val2);
						}
					}
				}
			}
			return list;
		}

		public static bool TryFindNearestStatefulControl(FrameworkElement contextElement, out FrameworkElement resolvedControl)
		{
			FrameworkElement val = contextElement;
			if (val == null)
			{
				resolvedControl = null;
				return false;
			}
			DependencyObject parent = val.Parent;
			FrameworkElement val2 = (FrameworkElement)(object)((parent is FrameworkElement) ? parent : null);
			bool result = true;
			while (!HasVisualStateGroupsDefined(val) && ShouldContinueTreeWalk(val2))
			{
				val = val2;
				DependencyObject parent2 = val2.Parent;
				val2 = (FrameworkElement)(object)((parent2 is FrameworkElement) ? parent2 : null);
			}
			if (HasVisualStateGroupsDefined(val))
			{
				if (val.TemplatedParent != null && val.TemplatedParent is Control)
				{
					DependencyObject templatedParent = val.TemplatedParent;
					val = (FrameworkElement)(object)((templatedParent is FrameworkElement) ? templatedParent : null);
				}
				else if (val2 != null && val2 is UserControl)
				{
					val = val2;
				}
			}
			else
			{
				result = false;
			}
			resolvedControl = val;
			return result;
		}

		private static bool HasVisualStateGroupsDefined(FrameworkElement frameworkElement)
		{
			if (frameworkElement != null)
			{
				return VisualStateManager.GetVisualStateGroups(frameworkElement).Count != 0;
			}
			return false;
		}

		internal static FrameworkElement FindNearestStatefulControl(FrameworkElement contextElement)
		{
			FrameworkElement resolvedControl = null;
			TryFindNearestStatefulControl(contextElement, out resolvedControl);
			return resolvedControl;
		}

		private static bool ShouldContinueTreeWalk(FrameworkElement element)
		{
			if (element == null)
			{
				return false;
			}
			if (element is UserControl)
			{
				return false;
			}
			if (element.Parent == null)
			{
				FrameworkElement val = FindTemplatedParent(element);
				if (val == null || (!(val is Control) && !(val is ContentPresenter)))
				{
					return false;
				}
			}
			return true;
		}

		private static FrameworkElement FindTemplatedParent(FrameworkElement parent)
		{
			DependencyObject templatedParent = parent.TemplatedParent;
			return (FrameworkElement)(object)((templatedParent is FrameworkElement) ? templatedParent : null);
		}
	}
}
namespace Microsoft.Xaml.Behaviors.Media
{
	public class PlaySoundAction : TriggerAction<DependencyObject>
	{
		public static readonly DependencyProperty SourceProperty = DependencyProperty.Register("Source", typeof(Uri), typeof(PlaySoundAction), (PropertyMetadata)null);

		public static readonly DependencyProperty VolumeProperty = DependencyProperty.Register("Volume", typeof(double), typeof(PlaySoundAction), new PropertyMetadata((object)0.5));

		public Uri Source
		{
			get
			{
				return (Uri)((DependencyObject)this).GetValue(SourceProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(SourceProperty, (object)value);
			}
		}

		public double Volume
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(VolumeProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(VolumeProperty, (object)value);
			}
		}

		protected virtual void SetMediaElementProperties(MediaElement mediaElement)
		{
			if (mediaElement != null)
			{
				mediaElement.Source = Source;
				mediaElement.Volume = Volume;
			}
		}

		protected override void Invoke(object parameter)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			if (!(Source == null) && base.AssociatedObject != null)
			{
				Popup popup = new Popup();
				MediaElement val = new MediaElement();
				popup.Child = (UIElement)(object)val;
				((UIElement)val).Visibility = (Visibility)2;
				SetMediaElementProperties(val);
				val.MediaEnded += (RoutedEventHandler)delegate
				{
					popup.Child = null;
					popup.IsOpen = false;
				};
				val.MediaFailed += delegate
				{
					popup.Child = null;
					popup.IsOpen = false;
				};
				popup.IsOpen = true;
			}
		}
	}
	public abstract class StoryboardAction : TriggerAction<DependencyObject>
	{
		public static readonly DependencyProperty StoryboardProperty = DependencyProperty.Register("Storyboard", typeof(Storyboard), typeof(StoryboardAction), (PropertyMetadata)new FrameworkPropertyMetadata(new PropertyChangedCallback(OnStoryboardChanged)));

		public Storyboard Storyboard
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Storyboard)((DependencyObject)this).GetValue(StoryboardProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(StoryboardProperty, (object)value);
			}
		}

		private static void OnStoryboardChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if (sender is StoryboardAction storyboardAction)
			{
				storyboardAction.OnStoryboardChanged(args);
			}
		}

		protected virtual void OnStoryboardChanged(DependencyPropertyChangedEventArgs args)
		{
		}
	}
	public enum ControlStoryboardOption
	{
		Play,
		Stop,
		TogglePlayPause,
		Pause,
		Resume,
		SkipToFill
	}
	[CLSCompliant(false)]
	public class ControlStoryboardAction : StoryboardAction
	{
		public static readonly DependencyProperty ControlStoryboardProperty = DependencyProperty.Register("ControlStoryboardOption", typeof(ControlStoryboardOption), typeof(ControlStoryboardAction));

		public ControlStoryboardOption ControlStoryboardOption
		{
			get
			{
				return (ControlStoryboardOption)((DependencyObject)this).GetValue(ControlStoryboardProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(ControlStoryboardProperty, (object)value);
			}
		}

		protected override void Invoke(object parameter)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Invalid comparison between Unknown and I4
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (base.AssociatedObject == null || base.Storyboard == null)
			{
				return;
			}
			switch (ControlStoryboardOption)
			{
			case ControlStoryboardOption.Play:
				base.Storyboard.Begin();
				break;
			case ControlStoryboardOption.Stop:
				base.Storyboard.Stop();
				break;
			case ControlStoryboardOption.TogglePlayPause:
			{
				ClockState val = (ClockState)2;
				bool flag = false;
				try
				{
					val = base.Storyboard.GetCurrentState();
					flag = base.Storyboard.GetIsPaused();
				}
				catch (InvalidOperationException)
				{
				}
				if ((int)val == 2)
				{
					base.Storyboard.Begin();
				}
				else if (flag)
				{
					base.Storyboard.Resume();
				}
				else
				{
					base.Storyboard.Pause();
				}
				break;
			}
			case ControlStoryboardOption.Pause:
				base.Storyboard.Pause();
				break;
			case ControlStoryboardOption.Resume:
				base.Storyboard.Resume();
				break;
			case ControlStoryboardOption.SkipToFill:
				base.Storyboard.SkipToFill();
				break;
			}
		}
	}
	public abstract class StoryboardTrigger : TriggerBase<DependencyObject>
	{
		public static readonly DependencyProperty StoryboardProperty = DependencyProperty.Register("Storyboard", typeof(Storyboard), typeof(StoryboardTrigger), (PropertyMetadata)new FrameworkPropertyMetadata(new PropertyChangedCallback(OnStoryboardChanged)));

		public Storyboard Storyboard
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Storyboard)((DependencyObject)this).GetValue(StoryboardProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(StoryboardProperty, (object)value);
			}
		}

		private static void OnStoryboardChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if (sender is StoryboardTrigger storyboardTrigger)
			{
				storyboardTrigger.OnStoryboardChanged(args);
			}
		}

		protected virtual void OnStoryboardChanged(DependencyPropertyChangedEventArgs args)
		{
		}
	}
	public class StoryboardCompletedTrigger : StoryboardTrigger
	{
		protected override void OnDetaching()
		{
			base.OnDetaching();
			if (base.Storyboard != null)
			{
				((Timeline)base.Storyboard).Completed -= Storyboard_Completed;
			}
		}

		protected override void OnStoryboardChanged(DependencyPropertyChangedEventArgs args)
		{
			object oldValue = ((DependencyPropertyChangedEventArgs)(ref args)).OldValue;
			Storyboard val = (Storyboard)((oldValue is Storyboard) ? oldValue : null);
			object newValue = ((DependencyPropertyChangedEventArgs)(ref args)).NewValue;
			Storyboard val2 = (Storyboard)((newValue is Storyboard) ? newValue : null);
			if (val != val2)
			{
				if (val != null)
				{
					((Timeline)val).Completed -= Storyboard_Completed;
				}
				if (val2 != null)
				{
					((Timeline)val2).Completed += Storyboard_Completed;
				}
			}
		}

		private void Storyboard_Completed(object sender, EventArgs e)
		{
			InvokeActions(e);
		}
	}
	public abstract class TransitionEffect : ShaderEffect
	{
		public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(TransitionEffect), 0, (SamplingMode)0);

		public static readonly DependencyProperty OldImageProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("OldImage", typeof(TransitionEffect), 1, (SamplingMode)0);

		public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register("Progress", typeof(double), typeof(TransitionEffect), new PropertyMetadata((object)0.0, ShaderEffect.PixelShaderConstantCallback(0)));

		public Brush Input
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Brush)((DependencyObject)this).GetValue(InputProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(InputProperty, (object)value);
			}
		}

		public Brush OldImage
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Brush)((DependencyObject)this).GetValue(OldImageProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(OldImageProperty, (object)value);
			}
		}

		public double Progress
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(ProgressProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(ProgressProperty, (object)value);
			}
		}

		public TransitionEffect CloneCurrentValue()
		{
			return (TransitionEffect)(object)((ShaderEffect)this).CloneCurrentValue();
		}

		protected abstract TransitionEffect DeepCopy();

		protected TransitionEffect()
		{
			((ShaderEffect)this).UpdateShaderValue(InputProperty);
			((ShaderEffect)this).UpdateShaderValue(OldImageProperty);
			((ShaderEffect)this).UpdateShaderValue(ProgressProperty);
		}
	}
}
namespace Microsoft.Xaml.Behaviors.Layout
{
	public enum FluidMoveScope
	{
		Self,
		Children
	}
	public enum TagType
	{
		Element,
		DataContext
	}
	public abstract class FluidMoveBehaviorBase : Behavior<FrameworkElement>
	{
		internal class TagData
		{
			public FrameworkElement Child { get; set; }

			public FrameworkElement Parent { get; set; }

			public Rect ParentRect { get; set; }

			public Rect AppRect { get; set; }

			public DateTime Timestamp { get; set; }

			public object InitialTag { get; set; }
		}

		public static readonly DependencyProperty AppliesToProperty = DependencyProperty.Register("AppliesTo", typeof(FluidMoveScope), typeof(FluidMoveBehaviorBase), new PropertyMetadata((object)FluidMoveScope.Self));

		public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register("IsActive", typeof(bool), typeof(FluidMoveBehaviorBase), new PropertyMetadata((object)true));

		public static readonly DependencyProperty TagProperty = DependencyProperty.Register("Tag", typeof(TagType), typeof(FluidMoveBehaviorBase), new PropertyMetadata((object)TagType.Element));

		public static readonly DependencyProperty TagPathProperty = DependencyProperty.Register("TagPath", typeof(string), typeof(FluidMoveBehaviorBase), new PropertyMetadata((object)string.Empty));

		protected static readonly DependencyProperty IdentityTagProperty = DependencyProperty.RegisterAttached("IdentityTag", typeof(object), typeof(FluidMoveBehaviorBase), new PropertyMetadata((PropertyChangedCallback)null));

		internal static Dictionary<object, TagData> TagDictionary = new Dictionary<object, TagData>();

		private static DateTime nextToLastPurgeTick = DateTime.MinValue;

		private static DateTime lastPurgeTick = DateTime.MinValue;

		private static TimeSpan minTickDelta = TimeSpan.FromSeconds(0.5);

		public FluidMoveScope AppliesTo
		{
			get
			{
				return (FluidMoveScope)((DependencyObject)this).GetValue(AppliesToProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(AppliesToProperty, (object)value);
			}
		}

		public bool IsActive
		{
			get
			{
				return (bool)((DependencyObject)this).GetValue(IsActiveProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(IsActiveProperty, (object)value);
			}
		}

		public TagType Tag
		{
			get
			{
				return (TagType)((DependencyObject)this).GetValue(TagProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(TagProperty, (object)value);
			}
		}

		public string TagPath
		{
			get
			{
				return (string)((DependencyObject)this).GetValue(TagPathProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(TagPathProperty, (object)value);
			}
		}

		protected virtual bool ShouldSkipInitialLayout => Tag == TagType.DataContext;

		protected static object GetIdentityTag(DependencyObject obj)
		{
			return obj.GetValue(IdentityTagProperty);
		}

		protected static void SetIdentityTag(DependencyObject obj, object value)
		{
			obj.SetValue(IdentityTagProperty, value);
		}

		protected override void OnAttached()
		{
			base.OnAttached();
			((UIElement)base.AssociatedObject).LayoutUpdated += AssociatedObject_LayoutUpdated;
		}

		protected override void OnDetaching()
		{
			base.OnDetaching();
			((UIElement)base.AssociatedObject).LayoutUpdated -= AssociatedObject_LayoutUpdated;
		}

		private void AssociatedObject_LayoutUpdated(object sender, EventArgs e)
		{
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			if (!IsActive)
			{
				return;
			}
			if (DateTime.Now - lastPurgeTick >= minTickDelta)
			{
				List<object> list = null;
				foreach (KeyValuePair<object, TagData> item in TagDictionary)
				{
					if (item.Value.Timestamp < nextToLastPurgeTick)
					{
						if (list == null)
						{
							list = new List<object>();
						}
						list.Add(item.Key);
					}
				}
				if (list != null)
				{
					foreach (object item2 in list)
					{
						TagDictionary.Remove(item2);
					}
				}
				nextToLastPurgeTick = lastPurgeTick;
				lastPurgeTick = DateTime.Now;
			}
			if (AppliesTo == FluidMoveScope.Self)
			{
				UpdateLayoutTransition(base.AssociatedObject);
				return;
			}
			FrameworkElement obj = base.AssociatedObject;
			Panel val = (Panel)(object)((obj is Panel) ? obj : null);
			if (val == null)
			{
				return;
			}
			foreach (FrameworkElement child2 in val.Children)
			{
				FrameworkElement child = child2;
				UpdateLayoutTransition(child);
			}
		}

		private void UpdateLayoutTransition(FrameworkElement child)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (((int)((UIElement)child).Visibility == 2 || !child.IsLoaded) && ShouldSkipInitialLayout)
			{
				return;
			}
			FrameworkElement visualRoot = GetVisualRoot(child);
			TagData tagData = new TagData();
			DependencyObject parent = VisualTreeHelper.GetParent((DependencyObject)(object)child);
			tagData.Parent = (FrameworkElement)(object)((parent is FrameworkElement) ? parent : null);
			tagData.ParentRect = ExtendedVisualStateManager.GetLayoutRect(child);
			tagData.Child = child;
			tagData.Timestamp = DateTime.Now;
			try
			{
				tagData.AppRect = TranslateRect(tagData.ParentRect, tagData.Parent, visualRoot);
			}
			catch (ArgumentException)
			{
				if (ShouldSkipInitialLayout)
				{
					return;
				}
			}
			EnsureTags(child);
			object obj = GetIdentityTag((DependencyObject)(object)child);
			if (obj == null)
			{
				obj = child;
			}
			UpdateLayoutTransitionCore(child, visualRoot, obj, tagData);
		}

		internal abstract void UpdateLayoutTransitionCore(FrameworkElement child, FrameworkElement root, object tag, TagData newTagData);

		protected virtual void EnsureTags(FrameworkElement child)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			if (Tag == TagType.DataContext && !(((DependencyObject)child).ReadLocalValue(IdentityTagProperty) is BindingExpression))
			{
				child.SetBinding(IdentityTagProperty, (BindingBase)new Binding(TagPath));
			}
		}

		private static FrameworkElement GetVisualRoot(FrameworkElement child)
		{
			while (true)
			{
				DependencyObject parent = VisualTreeHelper.GetParent((DependencyObject)(object)child);
				FrameworkElement val = (FrameworkElement)(object)((parent is FrameworkElement) ? parent : null);
				if (val == null)
				{
					return child;
				}
				if (AdornerLayer.GetAdornerLayer((Visual)(object)val) == null)
				{
					break;
				}
				child = val;
			}
			return child;
		}

		internal static Rect TranslateRect(Rect rect, FrameworkElement from, FrameworkElement to)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (from == null || to == null)
			{
				return rect;
			}
			Point val = default(Point);
			((Point)(ref val))..ctor(((Rect)(ref rect)).Left, ((Rect)(ref rect)).Top);
			val = ((Visual)from).TransformToVisual((Visual)(object)to).Transform(val);
			return new Rect(((Point)(ref val)).X, ((Point)(ref val)).Y, ((Rect)(ref rect)).Width, ((Rect)(ref rect)).Height);
		}
	}
	public sealed class FluidMoveSetTagBehavior : FluidMoveBehaviorBase
	{
		internal override void UpdateLayoutTransitionCore(FrameworkElement child, FrameworkElement root, object tag, TagData newTagData)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (!FluidMoveBehaviorBase.TagDictionary.TryGetValue(tag, out var value))
			{
				value = new TagData();
				FluidMoveBehaviorBase.TagDictionary.Add(tag, value);
			}
			value.ParentRect = newTagData.ParentRect;
			value.AppRect = newTagData.AppRect;
			value.Parent = newTagData.Parent;
			value.Child = newTagData.Child;
			value.Timestamp = newTagData.Timestamp;
		}
	}
	public sealed class FluidMoveBehavior : FluidMoveBehaviorBase
	{
		public static readonly DependencyProperty DurationProperty = DependencyProperty.Register("Duration", typeof(Duration), typeof(FluidMoveBehavior), new PropertyMetadata((object)new Duration(TimeSpan.FromSeconds(1.0))));

		public static readonly DependencyProperty InitialTagProperty = DependencyProperty.Register("InitialTag", typeof(TagType), typeof(FluidMoveBehavior), new PropertyMetadata((object)TagType.Element));

		public static readonly DependencyProperty InitialTagPathProperty = DependencyProperty.Register("InitialTagPath", typeof(string), typeof(FluidMoveBehavior), new PropertyMetadata((object)string.Empty));

		private static readonly DependencyProperty initialIdentityTagProperty = DependencyProperty.RegisterAttached("InitialIdentityTag", typeof(object), typeof(FluidMoveBehavior), new PropertyMetadata((PropertyCha

Newtonsoft.Json.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Dynamic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Numerics;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Versioning;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json.Bson;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq.JsonPath;
using Newtonsoft.Json.Schema;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Utilities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Schema, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f561df277c6c0b497d629032b410cdcf286e537c054724f7ffa0164345f62b3e642029d7a80cc351918955328c4adc8a048823ef90b0cf38ea7db0d729caf2b633c3babe08b0310198c1081995c19029bc675193744eab9d7345b8a67258ec17d112cebdbbb2a281487dceeafb9d83aa930f32103fbe1d2911425bc5744002c7")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f561df277c6c0b497d629032b410cdcf286e537c054724f7ffa0164345f62b3e642029d7a80cc351918955328c4adc8a048823ef90b0cf38ea7db0d729caf2b633c3babe08b0310198c1081995c19029bc675193744eab9d7345b8a67258ec17d112cebdbbb2a281487dceeafb9d83aa930f32103fbe1d2911425bc5744002c7")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Dynamic, PublicKey=0024000004800000940000000602000000240000525341310004000001000100cbd8d53b9d7de30f1f1278f636ec462cf9c254991291e66ebb157a885638a517887633b898ccbcf0d5c5ff7be85a6abe9e765d0ac7cd33c68dac67e7e64530e8222101109f154ab14a941c490ac155cd1d4fcba0fabb49016b4ef28593b015cab5937da31172f03f67d09edda404b88a60023f062ae71d0b2e4438b74cc11dc9")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9ca358aa-317b-4925-8ada-4a29e943a363")]
[assembly: CLSCompliant(true)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Newtonsoft")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © James Newton-King 2008")]
[assembly: AssemblyDescription("Json.NET is a popular high-performance JSON framework for .NET")]
[assembly: AssemblyFileVersion("13.0.3.27908")]
[assembly: AssemblyInformationalVersion("13.0.3+0a2e291c0d9c0c7675d445703e51750363a549ef")]
[assembly: AssemblyProduct("Json.NET")]
[assembly: AssemblyTitle("Json.NET .NET 6.0")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/JamesNK/Newtonsoft.Json")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyVersion("13.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Newtonsoft.Json
{
	public enum ConstructorHandling
	{
		Default,
		AllowNonPublicDefaultConstructor
	}
	public enum DateFormatHandling
	{
		IsoDateFormat,
		MicrosoftDateFormat
	}
	public enum DateParseHandling
	{
		None,
		DateTime,
		DateTimeOffset
	}
	public enum DateTimeZoneHandling
	{
		Local,
		Utc,
		Unspecified,
		RoundtripKind
	}
	public class DefaultJsonNameTable : JsonNameTable
	{
		private class Entry
		{
			internal readonly string Value;

			internal readonly int HashCode;

			internal Entry Next;

			internal Entry(string value, int hashCode, Entry next)
			{
				Value = value;
				HashCode = hashCode;
				Next = next;
			}
		}

		private static readonly int HashCodeRandomizer;

		private int _count;

		private Entry[] _entries;

		private int _mask = 31;

		static DefaultJsonNameTable()
		{
			HashCodeRandomizer = Environment.TickCount;
		}

		public DefaultJsonNameTable()
		{
			_entries = new Entry[_mask + 1];
		}

		public override string? Get(char[] key, int start, int length)
		{
			if (length == 0)
			{
				return string.Empty;
			}
			int num = length + HashCodeRandomizer;
			num += (num << 7) ^ key[start];
			int num2 = start + length;
			for (int i = start + 1; i < num2; i++)
			{
				num += (num << 7) ^ key[i];
			}
			num -= num >> 17;
			num -= num >> 11;
			num -= num >> 5;
			int num3 = Volatile.Read(ref _mask);
			int num4 = num & num3;
			for (Entry entry = _entries[num4]; entry != null; entry = entry.Next)
			{
				if (entry.HashCode == num && TextEquals(entry.Value, key, start, length))
				{
					return entry.Value;
				}
			}
			return null;
		}

		public string Add(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			int length = key.Length;
			if (length == 0)
			{
				return string.Empty;
			}
			int num = length + HashCodeRandomizer;
			for (int i = 0; i < key.Length; i++)
			{
				num += (num << 7) ^ key[i];
			}
			num -= num >> 17;
			num -= num >> 11;
			num -= num >> 5;
			for (Entry entry = _entries[num & _mask]; entry != null; entry = entry.Next)
			{
				if (entry.HashCode == num && entry.Value.Equals(key, StringComparison.Ordinal))
				{
					return entry.Value;
				}
			}
			return AddEntry(key, num);
		}

		private string AddEntry(string str, int hashCode)
		{
			int num = hashCode & _mask;
			Entry entry = new Entry(str, hashCode, _entries[num]);
			_entries[num] = entry;
			if (_count++ == _mask)
			{
				Grow();
			}
			return entry.Value;
		}

		private void Grow()
		{
			Entry[] entries = _entries;
			int num = _mask * 2 + 1;
			Entry[] array = new Entry[num + 1];
			for (int i = 0; i < entries.Length; i++)
			{
				Entry entry = entries[i];
				while (entry != null)
				{
					int num2 = entry.HashCode & num;
					Entry next = entry.Next;
					entry.Next = array[num2];
					array[num2] = entry;
					entry = next;
				}
			}
			_entries = array;
			Volatile.Write(ref _mask, num);
		}

		private static bool TextEquals(string str1, char[] str2, int str2Start, int str2Length)
		{
			if (str1.Length != str2Length)
			{
				return false;
			}
			for (int i = 0; i < str1.Length; i++)
			{
				if (str1[i] != str2[str2Start + i])
				{
					return false;
				}
			}
			return true;
		}
	}
	[Flags]
	public enum DefaultValueHandling
	{
		Include = 0,
		Ignore = 1,
		Populate = 2,
		IgnoreAndPopulate = 3
	}
	public enum FloatFormatHandling
	{
		String,
		Symbol,
		DefaultValue
	}
	public enum FloatParseHandling
	{
		Double,
		Decimal
	}
	public enum Formatting
	{
		None,
		Indented
	}
	public interface IArrayPool<T>
	{
		T[] Rent(int minimumLength);

		void Return(T[]? array);
	}
	public interface IJsonLineInfo
	{
		int LineNumber { get; }

		int LinePosition { get; }

		bool HasLineInfo();
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonArrayAttribute : JsonContainerAttribute
	{
		private bool _allowNullItems;

		public bool AllowNullItems
		{
			get
			{
				return _allowNullItems;
			}
			set
			{
				_allowNullItems = value;
			}
		}

		public JsonArrayAttribute()
		{
		}

		public JsonArrayAttribute(bool allowNullItems)
		{
			_allowNullItems = allowNullItems;
		}

		public JsonArrayAttribute(string id)
			: base(id)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false)]
	public sealed class JsonConstructorAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public abstract class JsonContainerAttribute : Attribute
	{
		internal bool? _isReference;

		internal bool? _itemIsReference;

		internal ReferenceLoopHandling? _itemReferenceLoopHandling;

		internal TypeNameHandling? _itemTypeNameHandling;

		private Type? _namingStrategyType;

		private object[]? _namingStrategyParameters;

		public string? Id { get; set; }

		public string? Title { get; set; }

		public string? Description { get; set; }

		public Type? ItemConverterType { get; set; }

		public object[]? ItemConverterParameters { get; set; }

		public Type? NamingStrategyType
		{
			get
			{
				return _namingStrategyType;
			}
			set
			{
				_namingStrategyType = value;
				NamingStrategyInstance = null;
			}
		}

		public object[]? NamingStrategyParameters
		{
			get
			{
				return _namingStrategyParameters;
			}
			set
			{
				_namingStrategyParameters = value;
				NamingStrategyInstance = null;
			}
		}

		internal NamingStrategy? NamingStrategyInstance { get; set; }

		public bool IsReference
		{
			get
			{
				return _isReference.GetValueOrDefault();
			}
			set
			{
				_isReference = value;
			}
		}

		public bool ItemIsReference
		{
			get
			{
				return _itemIsReference.GetValueOrDefault();
			}
			set
			{
				_itemIsReference = value;
			}
		}

		public ReferenceLoopHandling ItemReferenceLoopHandling
		{
			get
			{
				return _itemReferenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_itemReferenceLoopHandling = value;
			}
		}

		public TypeNameHandling ItemTypeNameHandling
		{
			get
			{
				return _itemTypeNameHandling.GetValueOrDefault();
			}
			set
			{
				_itemTypeNameHandling = value;
			}
		}

		protected JsonContainerAttribute()
		{
		}

		protected JsonContainerAttribute(string id)
		{
			Id = id;
		}
	}
	public static class JsonConvert
	{
		public static readonly string True = "true";

		public static readonly string False = "false";

		public static readonly string Null = "null";

		public static readonly string Undefined = "undefined";

		public static readonly string PositiveInfinity = "Infinity";

		public static readonly string NegativeInfinity = "-Infinity";

		public static readonly string NaN = "NaN";

		public static Func<JsonSerializerSettings>? DefaultSettings { get; set; }

		public static string ToString(DateTime value)
		{
			return ToString(value, DateFormatHandling.IsoDateFormat, DateTimeZoneHandling.RoundtripKind);
		}

		public static string ToString(DateTime value, DateFormatHandling format, DateTimeZoneHandling timeZoneHandling)
		{
			DateTime value2 = DateTimeUtils.EnsureDateTime(value, timeZoneHandling);
			using StringWriter stringWriter = StringUtils.CreateStringWriter(64);
			stringWriter.Write('"');
			DateTimeUtils.WriteDateTimeString(stringWriter, value2, format, null, CultureInfo.InvariantCulture);
			stringWriter.Write('"');
			return stringWriter.ToString();
		}

		public static string ToString(DateTimeOffset value)
		{
			return ToString(value, DateFormatHandling.IsoDateFormat);
		}

		public static string ToString(DateTimeOffset value, DateFormatHandling format)
		{
			using StringWriter stringWriter = StringUtils.CreateStringWriter(64);
			stringWriter.Write('"');
			DateTimeUtils.WriteDateTimeOffsetString(stringWriter, value, format, null, CultureInfo.InvariantCulture);
			stringWriter.Write('"');
			return stringWriter.ToString();
		}

		public static string ToString(bool value)
		{
			if (!value)
			{
				return False;
			}
			return True;
		}

		public static string ToString(char value)
		{
			return ToString(char.ToString(value));
		}

		public static string ToString(Enum value)
		{
			return value.ToString("D");
		}

		public static string ToString(int value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(short value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(ushort value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(uint value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(long value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		private static string ToStringInternal(BigInteger value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(ulong value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(float value)
		{
			return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture));
		}

		internal static string ToString(float value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable);
		}

		private static string EnsureFloatFormat(double value, string text, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			if (floatFormatHandling == FloatFormatHandling.Symbol || (!double.IsInfinity(value) && !double.IsNaN(value)))
			{
				return text;
			}
			if (floatFormatHandling == FloatFormatHandling.DefaultValue)
			{
				if (nullable)
				{
					return Null;
				}
				return "0.0";
			}
			return quoteChar + text + quoteChar;
		}

		public static string ToString(double value)
		{
			return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture));
		}

		internal static string ToString(double value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable);
		}

		private static string EnsureDecimalPlace(double value, string text)
		{
			if (double.IsNaN(value) || double.IsInfinity(value) || StringUtils.IndexOf(text, '.') != -1 || StringUtils.IndexOf(text, 'E') != -1 || StringUtils.IndexOf(text, 'e') != -1)
			{
				return text;
			}
			return text + ".0";
		}

		private static string EnsureDecimalPlace(string text)
		{
			if (StringUtils.IndexOf(text, '.') != -1)
			{
				return text;
			}
			return text + ".0";
		}

		public static string ToString(byte value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(sbyte value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(decimal value)
		{
			return EnsureDecimalPlace(value.ToString(null, CultureInfo.InvariantCulture));
		}

		public static string ToString(Guid value)
		{
			return ToString(value, '"');
		}

		internal static string ToString(Guid value, char quoteChar)
		{
			string text = value.ToString("D", CultureInfo.InvariantCulture);
			string text2 = quoteChar.ToString(CultureInfo.InvariantCulture);
			return text2 + text + text2;
		}

		public static string ToString(TimeSpan value)
		{
			return ToString(value, '"');
		}

		internal static string ToString(TimeSpan value, char quoteChar)
		{
			return ToString(value.ToString(), quoteChar);
		}

		public static string ToString(Uri? value)
		{
			if (value == null)
			{
				return Null;
			}
			return ToString(value, '"');
		}

		internal static string ToString(Uri value, char quoteChar)
		{
			return ToString(value.OriginalString, quoteChar);
		}

		public static string ToString(string? value)
		{
			return ToString(value, '"');
		}

		public static string ToString(string? value, char delimiter)
		{
			return ToString(value, delimiter, StringEscapeHandling.Default);
		}

		public static string ToString(string? value, char delimiter, StringEscapeHandling stringEscapeHandling)
		{
			if (delimiter != '"' && delimiter != '\'')
			{
				throw new ArgumentException("Delimiter must be a single or double quote.", "delimiter");
			}
			return JavaScriptUtils.ToEscapedJavaScriptString(value, delimiter, appendDelimiters: true, stringEscapeHandling);
		}

		public static string ToString(object? value)
		{
			if (value == null)
			{
				return Null;
			}
			return ConvertUtils.GetTypeCode(value.GetType()) switch
			{
				PrimitiveTypeCode.String => ToString((string)value), 
				PrimitiveTypeCode.Char => ToString((char)value), 
				PrimitiveTypeCode.Boolean => ToString((bool)value), 
				PrimitiveTypeCode.SByte => ToString((sbyte)value), 
				PrimitiveTypeCode.Int16 => ToString((short)value), 
				PrimitiveTypeCode.UInt16 => ToString((ushort)value), 
				PrimitiveTypeCode.Int32 => ToString((int)value), 
				PrimitiveTypeCode.Byte => ToString((byte)value), 
				PrimitiveTypeCode.UInt32 => ToString((uint)value), 
				PrimitiveTypeCode.Int64 => ToString((long)value), 
				PrimitiveTypeCode.UInt64 => ToString((ulong)value), 
				PrimitiveTypeCode.Single => ToString((float)value), 
				PrimitiveTypeCode.Double => ToString((double)value), 
				PrimitiveTypeCode.DateTime => ToString((DateTime)value), 
				PrimitiveTypeCode.Decimal => ToString((decimal)value), 
				PrimitiveTypeCode.DBNull => Null, 
				PrimitiveTypeCode.DateTimeOffset => ToString((DateTimeOffset)value), 
				PrimitiveTypeCode.Guid => ToString((Guid)value), 
				PrimitiveTypeCode.Uri => ToString((Uri)value), 
				PrimitiveTypeCode.TimeSpan => ToString((TimeSpan)value), 
				PrimitiveTypeCode.BigInteger => ToStringInternal((BigInteger)value), 
				_ => throw new ArgumentException("Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.".FormatWith(CultureInfo.InvariantCulture, value.GetType())), 
			};
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value)
		{
			return SerializeObject(value, (Type?)null, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting)
		{
			return SerializeObject(value, formatting, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return SerializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return SerializeObject(value, null, formatting, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, JsonSerializerSettings? settings)
		{
			return SerializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Type? type, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			return SerializeObjectInternal(value, type, jsonSerializer);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting, JsonSerializerSettings? settings)
		{
			return SerializeObject(value, null, formatting, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Type? type, Formatting formatting, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			jsonSerializer.Formatting = formatting;
			return SerializeObjectInternal(value, type, jsonSerializer);
		}

		private static string SerializeObjectInternal(object? value, Type? type, JsonSerializer jsonSerializer)
		{
			StringWriter stringWriter = new StringWriter(new StringBuilder(256), CultureInfo.InvariantCulture);
			using (JsonTextWriter jsonTextWriter = new JsonTextWriter(stringWriter))
			{
				jsonTextWriter.Formatting = jsonSerializer.Formatting;
				jsonSerializer.Serialize(jsonTextWriter, value, type);
			}
			return stringWriter.ToString();
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value)
		{
			return DeserializeObject(value, (Type?)null, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, JsonSerializerSettings settings)
		{
			return DeserializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, Type type)
		{
			return DeserializeObject(value, type, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value)
		{
			return JsonConvert.DeserializeObject<T>(value, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject)
		{
			return DeserializeObject<T>(value);
		}

		[DebuggerStepThrough]
		public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject, JsonSerializerSettings settings)
		{
			return DeserializeObject<T>(value, settings);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value, params JsonConverter[] converters)
		{
			return (T)DeserializeObject(value, typeof(T), converters);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value, JsonSerializerSettings? settings)
		{
			return (T)DeserializeObject(value, typeof(T), settings);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, Type type, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return DeserializeObject(value, type, settings);
		}

		public static object? DeserializeObject(string value, Type? type, JsonSerializerSettings? settings)
		{
			ValidationUtils.ArgumentNotNull(value, "value");
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			if (!jsonSerializer.IsCheckAdditionalContentSet())
			{
				jsonSerializer.CheckAdditionalContent = true;
			}
			using JsonTextReader reader = new JsonTextReader(new StringReader(value));
			return jsonSerializer.Deserialize(reader, type);
		}

		[DebuggerStepThrough]
		public static void PopulateObject(string value, object target)
		{
			PopulateObject(value, target, null);
		}

		public static void PopulateObject(string value, object target, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			using JsonReader jsonReader = new JsonTextReader(new StringReader(value));
			jsonSerializer.Populate(jsonReader, target);
			if (settings == null || !settings.CheckAdditionalContent)
			{
				return;
			}
			while (jsonReader.Read())
			{
				if (jsonReader.TokenType != JsonToken.Comment)
				{
					throw JsonSerializationException.Create(jsonReader, "Additional text found in JSON string after finishing deserializing object.");
				}
			}
		}

		public static string SerializeXmlNode(XmlNode? node)
		{
			return SerializeXmlNode(node, Formatting.None);
		}

		public static string SerializeXmlNode(XmlNode? node, Formatting formatting)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static string SerializeXmlNode(XmlNode? node, Formatting formatting, bool omitRootObject)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter
			{
				OmitRootObject = omitRootObject
			};
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static XmlDocument? DeserializeXmlNode(string value)
		{
			return DeserializeXmlNode(value, null);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName)
		{
			return DeserializeXmlNode(value, deserializeRootElementName, writeArrayAttribute: false);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName, bool writeArrayAttribute)
		{
			return DeserializeXmlNode(value, deserializeRootElementName, writeArrayAttribute, encodeSpecialCharacters: false);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName, bool writeArrayAttribute, bool encodeSpecialCharacters)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			xmlNodeConverter.DeserializeRootElementName = deserializeRootElementName;
			xmlNodeConverter.WriteArrayAttribute = writeArrayAttribute;
			xmlNodeConverter.EncodeSpecialCharacters = encodeSpecialCharacters;
			return (XmlDocument)DeserializeObject(value, typeof(XmlDocument), xmlNodeConverter);
		}

		public static string SerializeXNode(XObject? node)
		{
			return SerializeXNode(node, Formatting.None);
		}

		public static string SerializeXNode(XObject? node, Formatting formatting)
		{
			return SerializeXNode(node, formatting, omitRootObject: false);
		}

		public static string SerializeXNode(XObject? node, Formatting formatting, bool omitRootObject)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter
			{
				OmitRootObject = omitRootObject
			};
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static XDocument? DeserializeXNode(string value)
		{
			return DeserializeXNode(value, null);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName)
		{
			return DeserializeXNode(value, deserializeRootElementName, writeArrayAttribute: false);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName, bool writeArrayAttribute)
		{
			return DeserializeXNode(value, deserializeRootElementName, writeArrayAttribute, encodeSpecialCharacters: false);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName, bool writeArrayAttribute, bool encodeSpecialCharacters)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			xmlNodeConverter.DeserializeRootElementName = deserializeRootElementName;
			xmlNodeConverter.WriteArrayAttribute = writeArrayAttribute;
			xmlNodeConverter.EncodeSpecialCharacters = encodeSpecialCharacters;
			return (XDocument)DeserializeObject(value, typeof(XDocument), xmlNodeConverter);
		}
	}
	public abstract class JsonConverter
	{
		public virtual bool CanRead => true;

		public virtual bool CanWrite => true;

		public abstract void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer);

		public abstract object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer);

		public abstract bool CanConvert(Type objectType);
	}
	public abstract class JsonConverter<T> : JsonConverter
	{
		public sealed override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
		{
			if (!((value != null) ? (value is T) : ReflectionUtils.IsNullable(typeof(T))))
			{
				throw new JsonSerializationException("Converter cannot write specified value to JSON. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T)));
			}
			WriteJson(writer, (T)value, serializer);
		}

		public abstract void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer);

		public sealed override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
		{
			bool flag = existingValue == null;
			if (!flag && !(existingValue is T))
			{
				throw new JsonSerializationException("Converter cannot read JSON with the specified existing value. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T)));
			}
			return ReadJson(reader, objectType, flag ? default(T) : ((T)existingValue), !flag, serializer);
		}

		public abstract T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer);

		public sealed override bool CanConvert(Type objectType)
		{
			return typeof(T).IsAssignableFrom(objectType);
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter, AllowMultiple = false)]
	public sealed class JsonConverterAttribute : Attribute
	{
		private readonly Type _converterType;

		public Type ConverterType => _converterType;

		public object[]? ConverterParameters { get; }

		public JsonConverterAttribute(Type converterType)
		{
			if (converterType == null)
			{
				throw new ArgumentNullException("converterType");
			}
			_converterType = converterType;
		}

		public JsonConverterAttribute(Type converterType, params object[] converterParameters)
			: this(converterType)
		{
			ConverterParameters = converterParameters;
		}
	}
	public class JsonConverterCollection : Collection<JsonConverter>
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonDictionaryAttribute : JsonContainerAttribute
	{
		public JsonDictionaryAttribute()
		{
		}

		public JsonDictionaryAttribute(string id)
			: base(id)
		{
		}
	}
	[Serializable]
	public class JsonException : Exception
	{
		public JsonException()
		{
		}

		public JsonException(string message)
			: base(message)
		{
		}

		public JsonException(string message, Exception? innerException)
			: base(message, innerException)
		{
		}

		public JsonException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		internal static JsonException Create(IJsonLineInfo lineInfo, string path, string message)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			return new JsonException(message);
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public class JsonExtensionDataAttribute : Attribute
	{
		public bool WriteData { get; set; }

		public bool ReadData { get; set; }

		public JsonExtensionDataAttribute()
		{
			WriteData = true;
			ReadData = true;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public sealed class JsonIgnoreAttribute : Attribute
	{
	}
	public abstract class JsonNameTable
	{
		public abstract string? Get(char[] key, int start, int length);
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonObjectAttribute : JsonContainerAttribute
	{
		private MemberSerialization _memberSerialization;

		internal MissingMemberHandling? _missingMemberHandling;

		internal Required? _itemRequired;

		internal NullValueHandling? _itemNullValueHandling;

		public MemberSerialization MemberSerialization
		{
			get
			{
				return _memberSerialization;
			}
			set
			{
				_memberSerialization = value;
			}
		}

		public MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling.GetValueOrDefault();
			}
			set
			{
				_missingMemberHandling = value;
			}
		}

		public NullValueHandling ItemNullValueHandling
		{
			get
			{
				return _itemNullValueHandling.GetValueOrDefault();
			}
			set
			{
				_itemNullValueHandling = value;
			}
		}

		public Required ItemRequired
		{
			get
			{
				return _itemRequired.GetValueOrDefault();
			}
			set
			{
				_itemRequired = value;
			}
		}

		public JsonObjectAttribute()
		{
		}

		public JsonObjectAttribute(MemberSerialization memberSerialization)
		{
			MemberSerialization = memberSerialization;
		}

		public JsonObjectAttribute(string id)
			: base(id)
		{
		}
	}
	internal enum JsonContainerType
	{
		None,
		Object,
		Array,
		Constructor
	}
	internal struct JsonPosition
	{
		private static readonly char[] SpecialCharacters = new char[18]
		{
			'.', ' ', '\'', '/', '"', '[', ']', '(', ')', '\t',
			'\n', '\r', '\f', '\b', '\\', '\u0085', '\u2028', '\u2029'
		};

		internal JsonContainerType Type;

		internal int Position;

		internal string? PropertyName;

		internal bool HasIndex;

		public JsonPosition(JsonContainerType type)
		{
			Type = type;
			HasIndex = TypeHasIndex(type);
			Position = -1;
			PropertyName = null;
		}

		internal int CalculateLength()
		{
			switch (Type)
			{
			case JsonContainerType.Object:
				return PropertyName.Length + 5;
			case JsonContainerType.Array:
			case JsonContainerType.Constructor:
				return MathUtils.IntLength((ulong)Position) + 2;
			default:
				throw new ArgumentOutOfRangeException("Type");
			}
		}

		internal void WriteTo(StringBuilder sb, ref StringWriter? writer, ref char[]? buffer)
		{
			switch (Type)
			{
			case JsonContainerType.Object:
			{
				string propertyName = PropertyName;
				if (propertyName.IndexOfAny(SpecialCharacters) != -1)
				{
					sb.Append("['");
					if (writer == null)
					{
						writer = new StringWriter(sb);
					}
					JavaScriptUtils.WriteEscapedJavaScriptString(writer, propertyName, '\'', appendDelimiters: false, JavaScriptUtils.SingleQuoteCharEscapeFlags, StringEscapeHandling.Default, null, ref buffer);
					sb.Append("']");
				}
				else
				{
					if (sb.Length > 0)
					{
						sb.Append('.');
					}
					sb.Append(propertyName);
				}
				break;
			}
			case JsonContainerType.Array:
			case JsonContainerType.Constructor:
				sb.Append('[');
				sb.Append(Position);
				sb.Append(']');
				break;
			}
		}

		internal static bool TypeHasIndex(JsonContainerType type)
		{
			if (type != JsonContainerType.Array)
			{
				return type == JsonContainerType.Constructor;
			}
			return true;
		}

		internal static string BuildPath(List<JsonPosition> positions, JsonPosition? currentPosition)
		{
			int num = 0;
			if (positions != null)
			{
				for (int i = 0; i < positions.Count; i++)
				{
					num += positions[i].CalculateLength();
				}
			}
			if (currentPosition.HasValue)
			{
				num += currentPosition.GetValueOrDefault().CalculateLength();
			}
			StringBuilder stringBuilder = new StringBuilder(num);
			StringWriter writer = null;
			char[] buffer = null;
			if (positions != null)
			{
				foreach (JsonPosition position in positions)
				{
					position.WriteTo(stringBuilder, ref writer, ref buffer);
				}
			}
			currentPosition?.WriteTo(stringBuilder, ref writer, ref buffer);
			return stringBuilder.ToString();
		}

		internal static string FormatMessage(IJsonLineInfo? lineInfo, string path, string message)
		{
			if (!message.EndsWith(Environment.NewLine, StringComparison.Ordinal))
			{
				message = message.Trim();
				if (!message.EndsWith('.'))
				{
					message += ".";
				}
				message += " ";
			}
			message += "Path '{0}'".FormatWith(CultureInfo.InvariantCulture, path);
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				message += ", line {0}, position {1}".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition);
			}
			message += ".";
			return message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
	public sealed class JsonPropertyAttribute : Attribute
	{
		internal NullValueHandling? _nullValueHandling;

		internal DefaultValueHandling? _defaultValueHandling;

		internal ReferenceLoopHandling? _referenceLoopHandling;

		internal ObjectCreationHandling? _objectCreationHandling;

		internal TypeNameHandling? _typeNameHandling;

		internal bool? _isReference;

		internal int? _order;

		internal Required? _required;

		internal bool? _itemIsReference;

		internal ReferenceLoopHandling? _itemReferenceLoopHandling;

		internal TypeNameHandling? _itemTypeNameHandling;

		public Type? ItemConverterType { get; set; }

		public object[]? ItemConverterParameters { get; set; }

		public Type? NamingStrategyType { get; set; }

		public object[]? NamingStrategyParameters { get; set; }

		public NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling.GetValueOrDefault();
			}
			set
			{
				_nullValueHandling = value;
			}
		}

		public DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling.GetValueOrDefault();
			}
			set
			{
				_defaultValueHandling = value;
			}
		}

		public ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_referenceLoopHandling = value;
			}
		}

		public ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling.GetValueOrDefault();
			}
			set
			{
				_objectCreationHandling = value;
			}
		}

		public TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling.GetValueOrDefault();
			}
			set
			{
				_typeNameHandling = value;
			}
		}

		public bool IsReference
		{
			get
			{
				return _isReference.GetValueOrDefault();
			}
			set
			{
				_isReference = value;
			}
		}

		public int Order
		{
			get
			{
				return _order.GetValueOrDefault();
			}
			set
			{
				_order = value;
			}
		}

		public Required Required
		{
			get
			{
				return _required.GetValueOrDefault();
			}
			set
			{
				_required = value;
			}
		}

		public string? PropertyName { get; set; }

		public ReferenceLoopHandling ItemReferenceLoopHandling
		{
			get
			{
				return _itemReferenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_itemReferenceLoopHandling = value;
			}
		}

		public TypeNameHandling ItemTypeNameHandling
		{
			get
			{
				return _itemTypeNameHandling.GetValueOrDefault();
			}
			set
			{
				_itemTypeNameHandling = value;
			}
		}

		public bool ItemIsReference
		{
			get
			{
				return _itemIsReference.GetValueOrDefault();
			}
			set
			{
				_itemIsReference = value;
			}
		}

		public JsonPropertyAttribute()
		{
		}

		public JsonPropertyAttribute(string propertyName)
		{
			PropertyName = propertyName;
		}
	}
	public abstract class JsonReader : IAsyncDisposable, IDisposable
	{
		protected internal enum State
		{
			Start,
			Complete,
			Property,
			ObjectStart,
			Object,
			ArrayStart,
			Array,
			Closed,
			PostValue,
			ConstructorStart,
			Constructor,
			Error,
			Finished
		}

		private JsonToken _tokenType;

		private object? _value;

		internal char _quoteChar;

		internal State _currentState;

		private JsonPosition _currentPosition;

		private CultureInfo? _culture;

		private DateTimeZoneHandling _dateTimeZoneHandling;

		private int? _maxDepth;

		private bool _hasExceededMaxDepth;

		internal DateParseHandling _dateParseHandling;

		internal FloatParseHandling _floatParseHandling;

		private string? _dateFormatString;

		private List<JsonPosition>? _stack;

		protected State CurrentState => _currentState;

		public bool CloseInput { get; set; }

		public bool SupportMultipleContent { get; set; }

		public virtual char QuoteChar
		{
			get
			{
				return _quoteChar;
			}
			protected internal set
			{
				_quoteChar = value;
			}
		}

		public DateTimeZoneHandling DateTimeZoneHandling
		{
			get
			{
				return _dateTimeZoneHandling;
			}
			set
			{
				if (value < DateTimeZoneHandling.Local || value > DateTimeZoneHandling.RoundtripKind)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_dateTimeZoneHandling = value;
			}
		}

		public DateParseHandling DateParseHandling
		{
			get
			{
				return _dateParseHandling;
			}
			set
			{
				if (value < DateParseHandling.None || value > DateParseHandling.DateTimeOffset)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_dateParseHandling = value;
			}
		}

		public FloatParseHandling FloatParseHandling
		{
			get
			{
				return _floatParseHandling;
			}
			set
			{
				if (value < FloatParseHandling.Double || value > FloatParseHandling.Decimal)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_floatParseHandling = value;
			}
		}

		public string? DateFormatString
		{
			get
			{
				return _dateFormatString;
			}
			set
			{
				_dateFormatString = value;
			}
		}

		public int? MaxDepth
		{
			get
			{
				return _maxDepth;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				_maxDepth = value;
			}
		}

		public virtual JsonToken TokenType => _tokenType;

		public virtual object? Value => _value;

		public virtual Type? ValueType => _value?.GetType();

		public virtual int Depth
		{
			get
			{
				int num = _stack?.Count ?? 0;
				if (JsonTokenUtils.IsStartToken(TokenType) || _currentPosition.Type == JsonContainerType.None)
				{
					return num;
				}
				return num + 1;
			}
		}

		public virtual string Path
		{
			get
			{
				if (_currentPosition.Type == JsonContainerType.None)
				{
					return string.Empty;
				}
				JsonPosition? currentPosition = ((_currentState != State.ArrayStart && _currentState != State.ConstructorStart && _currentState != State.ObjectStart) ? new JsonPosition?(_currentPosition) : null);
				return JsonPosition.BuildPath(_stack, currentPosition);
			}
		}

		public CultureInfo Culture
		{
			get
			{
				return _culture ?? CultureInfo.InvariantCulture;
			}
			set
			{
				_culture = value;
			}
		}

		ValueTask IAsyncDisposable.DisposeAsync()
		{
			try
			{
				Dispose(disposing: true);
				return default(ValueTask);
			}
			catch (Exception exception)
			{
				return ValueTask.FromException(exception);
			}
		}

		public virtual Task<bool> ReadAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<bool>() ?? Read().ToAsync();
		}

		public async Task SkipAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			if (TokenType == JsonToken.PropertyName)
			{
				await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			}
			if (JsonTokenUtils.IsStartToken(TokenType))
			{
				int depth = Depth;
				while (await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false) && depth < Depth)
				{
				}
			}
		}

		internal async Task ReaderReadAndAssertAsync(CancellationToken cancellationToken)
		{
			if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
			{
				throw CreateUnexpectedEndException();
			}
		}

		public virtual Task<bool?> ReadAsBooleanAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<bool?>() ?? Task.FromResult(ReadAsBoolean());
		}

		public virtual Task<byte[]?> ReadAsBytesAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<byte[]>() ?? Task.FromResult(ReadAsBytes());
		}

		internal async Task<byte[]?> ReadArrayIntoByteArrayAsync(CancellationToken cancellationToken)
		{
			List<byte> buffer = new List<byte>();
			do
			{
				if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
				{
					SetToken(JsonToken.None);
				}
			}
			while (!ReadArrayElementIntoByteArrayReportDone(buffer));
			byte[] array = buffer.ToArray();
			SetToken(JsonToken.Bytes, array, updateIndex: false);
			return array;
		}

		public virtual Task<DateTime?> ReadAsDateTimeAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<DateTime?>() ?? Task.FromResult(ReadAsDateTime());
		}

		public virtual Task<DateTimeOffset?> ReadAsDateTimeOffsetAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<DateTimeOffset?>() ?? Task.FromResult(ReadAsDateTimeOffset());
		}

		public virtual Task<decimal?> ReadAsDecimalAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<decimal?>() ?? Task.FromResult(ReadAsDecimal());
		}

		public virtual Task<double?> ReadAsDoubleAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return Task.FromResult(ReadAsDouble());
		}

		public virtual Task<int?> ReadAsInt32Async(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<int?>() ?? Task.FromResult(ReadAsInt32());
		}

		public virtual Task<string?> ReadAsStringAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<string>() ?? Task.FromResult(ReadAsString());
		}

		internal async Task<bool> ReadAndMoveToContentAsync(CancellationToken cancellationToken)
		{
			bool flag = await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			if (flag)
			{
				flag = await MoveToContentAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			}
			return flag;
		}

		internal Task<bool> MoveToContentAsync(CancellationToken cancellationToken)
		{
			JsonToken tokenType = TokenType;
			if (tokenType == JsonToken.None || tokenType == JsonToken.Comment)
			{
				return MoveToContentFromNonContentAsync(cancellationToken);
			}
			return AsyncUtils.True;
		}

		private async Task<bool> MoveToContentFromNonContentAsync(CancellationToken cancellationToken)
		{
			JsonToken tokenType;
			do
			{
				if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
				{
					return false;
				}
				tokenType = TokenType;
			}
			while (tokenType == JsonToken.None || tokenType == JsonToken.Comment);
			return true;
		}

		internal JsonPosition GetPosition(int depth)
		{
			if (_stack != null && depth < _stack.Count)
			{
				return _stack[depth];
			}
			return _currentPosition;
		}

		protected JsonReader()
		{
			_currentState = State.Start;
			_dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;
			_dateParseHandling = DateParseHandling.DateTime;
			_floatParseHandling = FloatParseHandling.Double;
			_maxDepth = 64;
			CloseInput = true;
		}

		private void Push(JsonContainerType value)
		{
			UpdateScopeWithFinishedValue();
			if (_currentPosition.Type == JsonContainerType.None)
			{
				_currentPosition = new JsonPosition(value);
				return;
			}
			if (_stack == null)
			{
				_stack = new List<JsonPosition>();
			}
			_stack.Add(_currentPosition);
			_currentPosition = new JsonPosition(value);
			if (!_maxDepth.HasValue || !(Depth + 1 > _maxDepth) || _hasExceededMaxDepth)
			{
				return;
			}
			_hasExceededMaxDepth = true;
			throw JsonReaderException.Create(this, "The reader's MaxDepth of {0} has been exceeded.".FormatWith(CultureInfo.InvariantCulture, _maxDepth));
		}

		private JsonContainerType Pop()
		{
			JsonPosition currentPosition;
			if (_stack != null && _stack.Count > 0)
			{
				currentPosition = _currentPosition;
				_currentPosition = _stack[_stack.Count - 1];
				_stack.RemoveAt(_stack.Count - 1);
			}
			else
			{
				currentPosition = _currentPosition;
				_currentPosition = default(JsonPosition);
			}
			if (_maxDepth.HasValue && Depth <= _maxDepth)
			{
				_hasExceededMaxDepth = false;
			}
			return currentPosition.Type;
		}

		private JsonContainerType Peek()
		{
			return _currentPosition.Type;
		}

		public abstract bool Read();

		public virtual int? ReadAsInt32()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is int)
				{
					return (int)value;
				}
				int num;
				if (value is BigInteger bigInteger)
				{
					num = (int)bigInteger;
				}
				else
				{
					try
					{
						num = Convert.ToInt32(value, CultureInfo.InvariantCulture);
					}
					catch (Exception ex)
					{
						throw JsonReaderException.Create(this, "Could not convert to integer: {0}.".FormatWith(CultureInfo.InvariantCulture, value), ex);
					}
				}
				SetToken(JsonToken.Integer, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
			{
				string s = (string)Value;
				return ReadInt32String(s);
			}
			default:
				throw JsonReaderException.Create(this, "Error reading integer. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal int? ReadInt32String(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (int.TryParse(s, NumberStyles.Integer, Culture, out var result))
			{
				SetToken(JsonToken.Integer, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to integer: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual string? ReadAsString()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.String:
				return (string)Value;
			default:
				if (JsonTokenUtils.IsPrimitiveToken(contentToken))
				{
					object value = Value;
					if (value != null)
					{
						string text = ((!(value is IFormattable formattable)) ? ((value is Uri uri) ? uri.OriginalString : value.ToString()) : formattable.ToString(null, Culture));
						SetToken(JsonToken.String, text, updateIndex: false);
						return text;
					}
				}
				throw JsonReaderException.Create(this, "Error reading string. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		public virtual byte[]? ReadAsBytes()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.StartObject:
			{
				ReadIntoWrappedTypeObject();
				byte[] array2 = ReadAsBytes();
				ReaderReadAndAssert();
				if (TokenType != JsonToken.EndObject)
				{
					throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
				}
				SetToken(JsonToken.Bytes, array2, updateIndex: false);
				return array2;
			}
			case JsonToken.String:
			{
				string text = (string)Value;
				Guid g;
				byte[] array3 = ((text.Length == 0) ? CollectionUtils.ArrayEmpty<byte>() : ((!ConvertUtils.TryConvertGuid(text, out g)) ? Convert.FromBase64String(text) : g.ToByteArray()));
				SetToken(JsonToken.Bytes, array3, updateIndex: false);
				return array3;
			}
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Bytes:
				if (Value is Guid guid)
				{
					byte[] array = guid.ToByteArray();
					SetToken(JsonToken.Bytes, array, updateIndex: false);
					return array;
				}
				return (byte[])Value;
			case JsonToken.StartArray:
				return ReadArrayIntoByteArray();
			default:
				throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal byte[] ReadArrayIntoByteArray()
		{
			List<byte> list = new List<byte>();
			do
			{
				if (!Read())
				{
					SetToken(JsonToken.None);
				}
			}
			while (!ReadArrayElementIntoByteArrayReportDone(list));
			byte[] array = list.ToArray();
			SetToken(JsonToken.Bytes, array, updateIndex: false);
			return array;
		}

		private bool ReadArrayElementIntoByteArrayReportDone(List<byte> buffer)
		{
			switch (TokenType)
			{
			case JsonToken.None:
				throw JsonReaderException.Create(this, "Unexpected end when reading bytes.");
			case JsonToken.Integer:
				buffer.Add(Convert.ToByte(Value, CultureInfo.InvariantCulture));
				return false;
			case JsonToken.EndArray:
				return true;
			case JsonToken.Comment:
				return false;
			default:
				throw JsonReaderException.Create(this, "Unexpected token when reading bytes: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
			}
		}

		public virtual double? ReadAsDouble()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is double)
				{
					return (double)value;
				}
				double num = ((!(value is BigInteger bigInteger)) ? Convert.ToDouble(value, CultureInfo.InvariantCulture) : ((double)bigInteger));
				SetToken(JsonToken.Float, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
				return ReadDoubleString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading double. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal double? ReadDoubleString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, Culture, out var result))
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to double: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual bool? ReadAsBoolean()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				bool flag = ((!(Value is BigInteger bigInteger)) ? Convert.ToBoolean(Value, CultureInfo.InvariantCulture) : (bigInteger != 0L));
				SetToken(JsonToken.Boolean, flag, updateIndex: false);
				return flag;
			}
			case JsonToken.String:
				return ReadBooleanString((string)Value);
			case JsonToken.Boolean:
				return (bool)Value;
			default:
				throw JsonReaderException.Create(this, "Error reading boolean. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal bool? ReadBooleanString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (bool.TryParse(s, out var result))
			{
				SetToken(JsonToken.Boolean, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to boolean: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual decimal? ReadAsDecimal()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is decimal)
				{
					return (decimal)value;
				}
				decimal num;
				if (value is BigInteger bigInteger)
				{
					num = (decimal)bigInteger;
				}
				else
				{
					try
					{
						num = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
					}
					catch (Exception ex)
					{
						throw JsonReaderException.Create(this, "Could not convert to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, value), ex);
					}
				}
				SetToken(JsonToken.Float, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
				return ReadDecimalString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading decimal. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal decimal? ReadDecimalString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (decimal.TryParse(s, NumberStyles.Number, Culture, out var result))
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			if (ConvertUtils.DecimalTryParse(s.ToCharArray(), 0, s.Length, out result) == ParseResult.Success)
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual DateTime? ReadAsDateTime()
		{
			switch (GetContentToken())
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Date:
				if (Value is DateTimeOffset dateTimeOffset)
				{
					SetToken(JsonToken.Date, dateTimeOffset.DateTime, updateIndex: false);
				}
				return (DateTime)Value;
			case JsonToken.String:
				return ReadDateTimeString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
			}
		}

		internal DateTime? ReadDateTimeString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (DateTimeUtils.TryParseDateTime(s, DateTimeZoneHandling, _dateFormatString, Culture, out var dt))
			{
				dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			if (DateTime.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt))
			{
				dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			throw JsonReaderException.Create(this, "Could not convert string to DateTime: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual DateTimeOffset? ReadAsDateTimeOffset()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Date:
				if (Value is DateTime dateTime)
				{
					SetToken(JsonToken.Date, new DateTimeOffset(dateTime), updateIndex: false);
				}
				return (DateTimeOffset)Value;
			case JsonToken.String:
			{
				string s = (string)Value;
				return ReadDateTimeOffsetString(s);
			}
			default:
				throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal DateTimeOffset? ReadDateTimeOffsetString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (DateTimeUtils.TryParseDateTimeOffset(s, _dateFormatString, Culture, out var dt))
			{
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			if (DateTimeOffset.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt))
			{
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to DateTimeOffset: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		internal void ReaderReadAndAssert()
		{
			if (!Read())
			{
				throw CreateUnexpectedEndException();
			}
		}

		internal JsonReaderException CreateUnexpectedEndException()
		{
			return JsonReaderException.Create(this, "Unexpected end when reading JSON.");
		}

		internal void ReadIntoWrappedTypeObject()
		{
			ReaderReadAndAssert();
			if (Value != null && Value.ToString() == "$type")
			{
				ReaderReadAndAssert();
				if (Value != null && Value.ToString().StartsWith("System.Byte[]", StringComparison.Ordinal))
				{
					ReaderReadAndAssert();
					if (Value.ToString() == "$value")
					{
						return;
					}
				}
			}
			throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, JsonToken.StartObject));
		}

		public void Skip()
		{
			if (TokenType == JsonToken.PropertyName)
			{
				Read();
			}
			if (JsonTokenUtils.IsStartToken(TokenType))
			{
				int depth = Depth;
				while (Read() && depth < Depth)
				{
				}
			}
		}

		protected void SetToken(JsonToken newToken)
		{
			SetToken(newToken, null, updateIndex: true);
		}

		protected void SetToken(JsonToken newToken, object? value)
		{
			SetToken(newToken, value, updateIndex: true);
		}

		protected void SetToken(JsonToken newToken, object? value, bool updateIndex)
		{
			_tokenType = newToken;
			_value = value;
			switch (newToken)
			{
			case JsonToken.StartObject:
				_currentState = State.ObjectStart;
				Push(JsonContainerType.Object);
				break;
			case JsonToken.StartArray:
				_currentState = State.ArrayStart;
				Push(JsonContainerType.Array);
				break;
			case JsonToken.StartConstructor:
				_currentState = State.ConstructorStart;
				Push(JsonContainerType.Constructor);
				break;
			case JsonToken.EndObject:
				ValidateEnd(JsonToken.EndObject);
				break;
			case JsonToken.EndArray:
				ValidateEnd(JsonToken.EndArray);
				break;
			case JsonToken.EndConstructor:
				ValidateEnd(JsonToken.EndConstructor);
				break;
			case JsonToken.PropertyName:
				_currentState = State.Property;
				_currentPosition.PropertyName = (string)value;
				break;
			case JsonToken.Raw:
			case JsonToken.Integer:
			case JsonToken.Float:
			case JsonToken.String:
			case JsonToken.Boolean:
			case JsonToken.Null:
			case JsonToken.Undefined:
			case JsonToken.Date:
			case JsonToken.Bytes:
				SetPostValueState(updateIndex);
				break;
			case JsonToken.Comment:
				break;
			}
		}

		internal void SetPostValueState(bool updateIndex)
		{
			if (Peek() != 0 || SupportMultipleContent)
			{
				_currentState = State.PostValue;
			}
			else
			{
				SetFinished();
			}
			if (updateIndex)
			{
				UpdateScopeWithFinishedValue();
			}
		}

		private void UpdateScopeWithFinishedValue()
		{
			if (_currentPosition.HasIndex)
			{
				_currentPosition.Position++;
			}
		}

		private void ValidateEnd(JsonToken endToken)
		{
			JsonContainerType jsonContainerType = Pop();
			if (GetTypeForCloseToken(endToken) != jsonContainerType)
			{
				throw JsonReaderException.Create(this, "JsonToken {0} is not valid for closing JsonType {1}.".FormatWith(CultureInfo.InvariantCulture, endToken, jsonContainerType));
			}
			if (Peek() != 0 || SupportMultipleContent)
			{
				_currentState = State.PostValue;
			}
			else
			{
				SetFinished();
			}
		}

		protected void SetStateBasedOnCurrent()
		{
			JsonContainerType jsonContainerType = Peek();
			switch (jsonContainerType)
			{
			case JsonContainerType.Object:
				_currentState = State.Object;
				break;
			case JsonContainerType.Array:
				_currentState = State.Array;
				break;
			case JsonContainerType.Constructor:
				_currentState = State.Constructor;
				break;
			case JsonContainerType.None:
				SetFinished();
				break;
			default:
				throw JsonReaderException.Create(this, "While setting the reader state back to current object an unexpected JsonType was encountered: {0}".FormatWith(CultureInfo.InvariantCulture, jsonContainerType));
			}
		}

		private void SetFinished()
		{
			_currentState = ((!SupportMultipleContent) ? State.Finished : State.Start);
		}

		private JsonContainerType GetTypeForCloseToken(JsonToken token)
		{
			return token switch
			{
				JsonToken.EndObject => JsonContainerType.Object, 
				JsonToken.EndArray => JsonContainerType.Array, 
				JsonToken.EndConstructor => JsonContainerType.Constructor, 
				_ => throw JsonReaderException.Create(this, "Not a valid close JsonToken: {0}".FormatWith(CultureInfo.InvariantCulture, token)), 
			};
		}

		void IDisposable.Dispose()
		{
			Dispose(disposing: true);
			GC.SuppressFinalize(this);
		}

		protected virtual void Dispose(bool disposing)
		{
			if (_currentState != State.Closed && disposing)
			{
				Close();
			}
		}

		public virtual void Close()
		{
			_currentState = State.Closed;
			_tokenType = JsonToken.None;
			_value = null;
		}

		internal void ReadAndAssert()
		{
			if (!Read())
			{
				throw JsonSerializationException.Create(this, "Unexpected end when reading JSON.");
			}
		}

		internal void ReadForTypeAndAssert(JsonContract? contract, bool hasConverter)
		{
			if (!ReadForType(contract, hasConverter))
			{
				throw JsonSerializationException.Create(this, "Unexpected end when reading JSON.");
			}
		}

		internal bool ReadForType(JsonContract? contract, bool hasConverter)
		{
			if (hasConverter)
			{
				return Read();
			}
			switch (contract?.InternalReadType ?? ReadType.Read)
			{
			case ReadType.Read:
				return ReadAndMoveToContent();
			case ReadType.ReadAsInt32:
				ReadAsInt32();
				break;
			case ReadType.ReadAsInt64:
			{
				bool result = ReadAndMoveToContent();
				if (TokenType == JsonToken.Undefined)
				{
					throw JsonReaderException.Create(this, "An undefined token is not a valid {0}.".FormatWith(CultureInfo.InvariantCulture, contract?.UnderlyingType ?? typeof(long)));
				}
				return result;
			}
			case ReadType.ReadAsDecimal:
				ReadAsDecimal();
				break;
			case ReadType.ReadAsDouble:
				ReadAsDouble();
				break;
			case ReadType.ReadAsBytes:
				ReadAsBytes();
				break;
			case ReadType.ReadAsBoolean:
				ReadAsBoolean();
				break;
			case ReadType.ReadAsString:
				ReadAsString();
				break;
			case ReadType.ReadAsDateTime:
				ReadAsDateTime();
				break;
			case ReadType.ReadAsDateTimeOffset:
				ReadAsDateTimeOffset();
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
			return TokenType != JsonToken.None;
		}

		internal bool ReadAndMoveToContent()
		{
			if (Read())
			{
				return MoveToContent();
			}
			return false;
		}

		internal bool MoveToContent()
		{
			JsonToken tokenType = TokenType;
			while (tokenType == JsonToken.None || tokenType == JsonToken.Comment)
			{
				if (!Read())
				{
					return false;
				}
				tokenType = TokenType;
			}
			return true;
		}

		private JsonToken GetContentToken()
		{
			JsonToken tokenType;
			do
			{
				if (!Read())
				{
					SetToken(JsonToken.None);
					return JsonToken.None;
				}
				tokenType = TokenType;
			}
			while (tokenType == JsonToken.Comment);
			return tokenType;
		}
	}
	[Serializable]
	public class JsonReaderException : JsonException
	{
		public int LineNumber { get; }

		public int LinePosition { get; }

		public string? Path { get; }

		public JsonReaderException()
		{
		}

		public JsonReaderException(string message)
			: base(message)
		{
		}

		public JsonReaderException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public JsonReaderException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public JsonReaderException(string message, string path, int lineNumber, int linePosition, Exception? innerException)
			: base(message, innerException)
		{
			Path = path;
			LineNumber = lineNumber;
			LinePosition = linePosition;
		}

		internal static JsonReaderException Create(JsonReader reader, string message)
		{
			return Create(reader, message, null);
		}

		internal static JsonReaderException Create(JsonReader reader, string message, Exception? ex)
		{
			return Create(reader as IJsonLineInfo, reader.Path, message, ex);
		}

		internal static JsonReaderException Create(IJsonLineInfo? lineInfo, string path, string message, Exception? ex)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			int lineNumber;
			int linePosition;
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				lineNumber = lineInfo.LineNumber;
				linePosition = lineInfo.LinePosition;
			}
			else
			{
				lineNumber = 0;
				linePosition = 0;
			}
			return new JsonReaderException(message, path, lineNumber, linePosition, ex);
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public sealed class JsonRequiredAttribute : Attribute
	{
	}
	[Serializable]
	public class JsonSerializationException : JsonException
	{
		public int LineNumber { get; }

		public int LinePosition { get; }

		public string? Path { get; }

		public JsonSerializationException()
		{
		}

		public JsonSerializationException(string message)
			: base(message)
		{
		}

		public JsonSerializationException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public JsonSerializationException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public JsonSerializationException(string message, string path, int lineNumber, int linePosition, Exception? innerException)
			: base(message, innerException)
		{
			Path = path;
			LineNumber = lineNumber;
			LinePosition = linePosition;
		}

		internal static JsonSerializationException Create(JsonReader reader, string message)
		{
			return Create(reader, message, null);
		}

		internal static JsonSerializationException Create(JsonReader reader, string message, Exception? ex)
		{
			return Create(reader as IJsonLineInfo, reader.Path, message, ex);
		}

		internal static JsonSerializationException Create(IJsonLineInfo? lineInfo, string path, string message, Exception? ex)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			int lineNumber;
			int linePosition;
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				lineNumber = lineInfo.LineNumber;
				linePosition = lineInfo.LinePosition;
			}
			else
			{
				lineNumber = 0;
				linePosition = 0;
			}
			return new JsonSerializationException(message, path, lineNumber, linePosition, ex);
		}
	}
	public class JsonSerializer
	{
		internal TypeNameHandling _typeNameHandling;

		internal TypeNameAssemblyFormatHandling _typeNameAssemblyFormatHandling;

		internal PreserveReferencesHandling _preserveReferencesHandling;

		internal ReferenceLoopHandling _referenceLoopHandling;

		internal MissingMemberHandling _missingMemberHandling;

		internal ObjectCreationHandling _objectCreationHandling;

		internal NullValueHandling _nullValueHandling;

		internal DefaultValueHandling _defaultValueHandling;

		internal ConstructorHandling _constructorHandling;

		internal MetadataPropertyHandling _metadataPropertyHandling;

		internal JsonConverterCollection? _converters;

		internal IContractResolver _contractResolver;

		internal ITraceWriter? _traceWriter;

		internal IEqualityComparer? _equalityComparer;

		internal ISerializationBinder _serializationBinder;

		internal StreamingContext _context;

		private IReferenceResolver? _referenceResolver;

		private Formatting? _formatting;

		private DateFormatHandling? _dateFormatHandling;

		private DateTimeZoneHandling? _dateTimeZoneHandling;

		private DateParseHandling? _dateParseHandling;

		private FloatFormatHandling? _floatFormatHandling;

		private FloatParseHandling? _floatParseHandling;

		private StringEscapeHandling? _stringEscapeHandling;

		private CultureInfo _culture;

		private int? _maxDepth;

		private bool _maxDepthSet;

		private bool? _checkAdditionalContent;

		private string? _dateFormatString;

		private bool _dateFormatStringSet;

		public virtual IReferenceResolver? ReferenceResolver
		{
			get
			{
				return GetReferenceResolver();
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Reference resolver cannot be null.");
				}
				_referenceResolver = value;
			}
		}

		[Obsolete("Binder is obsolete. Use SerializationBinder instead.")]
		public virtual SerializationBinder Binder
		{
			get
			{
				if (_serializationBinder is SerializationBinder result)
				{
					return result;
				}
				if (_serializationBinder is SerializationBinderAdapter serializationBinderAdapter)
				{
					return serializationBinderAdapter.SerializationBinder;
				}
				throw new InvalidOperationException("Cannot get SerializationBinder because an ISerializationBinder was previously set.");
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Serialization binder cannot be null.");
				}
				_serializationBinder = (value as ISerializationBinder) ?? new SerializationBinderAdapter(value);
			}
		}

		public virtual ISerializationBinder SerializationBinder
		{
			get
			{
				return _serializationBinder;
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Serialization binder cannot be null.");
				}
				_serializationBinder = value;
			}
		}

		public virtual ITraceWriter? TraceWriter
		{
			get
			{
				return _traceWriter;
			}
			set
			{
				_traceWriter = value;
			}
		}

		public virtual IEqualityComparer? EqualityComparer
		{
			get
			{
				return _equalityComparer;
			}
			set
			{
				_equalityComparer = value;
			}
		}

		public virtual TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling;
			}
			set
			{
				if (value < TypeNameHandling.None || value > TypeNameHandling.Auto)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameHandling = value;
			}
		}

		[Obsolete("TypeNameAssemblyFormat is obsolete. Use TypeNameAssemblyFormatHandling instead.")]
		public virtual FormatterAssemblyStyle TypeNameAssemblyFormat
		{
			get
			{
				return (FormatterAssemblyStyle)_typeNameAssemblyFormatHandling;
			}
			set
			{
				if (value < FormatterAssemblyStyle.Simple || value > FormatterAssemblyStyle.Full)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameAssemblyFormatHandling = (TypeNameAssemblyFormatHandling)value;
			}
		}

		public virtual TypeNameAssemblyFormatHandling TypeNameAssemblyFormatHandling
		{
			get
			{
				return _typeNameAssemblyFormatHandling;
			}
			set
			{
				if (value < TypeNameAssemblyFormatHandling.Simple || value > TypeNameAssemblyFormatHandling.Full)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameAssemblyFormatHandling = value;
			}
		}

		public virtual PreserveReferencesHandling PreserveReferencesHandling
		{
			get
			{
				return _preserveReferencesHandling;
			}
			set
			{
				if (value < PreserveReferencesHandling.None || value > PreserveReferencesHandling.All)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_preserveReferencesHandling = value;
			}
		}

		public virtual ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling;
			}
			set
			{
				if (value < ReferenceLoopHandling.Error || value > ReferenceLoopHandling.Serialize)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_referenceLoopHandling = value;
			}
		}

		public virtual MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling;
			}
			set
			{
				if (value < MissingMemberHandling.Ignore || value > MissingMemberHandling.Error)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_missingMemberHandling = value;
			}
		}

		public virtual NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling;
			}
			set
			{
				if (value < NullValueHandling.Include || value > NullValueHandling.Ignore)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_nullValueHandling = value;
			}
		}

		public virtual DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling;
			}
			set
			{
				if (value < DefaultValueHandling.Include || value > DefaultValueHandling.IgnoreAndPopulate)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_defaultValueHandling = value;
			}
		}

		public virtual ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling;
			}
			set
			{
				if (value < ObjectCreationHandling.Auto || value > ObjectCreationHandling.Replace)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_objectCreationHandling = value;
			}
		}

		public virtual ConstructorHandling ConstructorHandling
		{
			get
			{
				return _constructorHandling;
			}
			set
			{
				if (value < ConstructorHandling.Default || value > ConstructorHandling.AllowNonPublicDefaultConstructor)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_constructorHandling = value;
			}
		}

		public virtual MetadataPropertyHandling MetadataPropertyHandling
		{
			get
			{
				return _metadataPropertyHandling;
			}
			set
			{
				if (value < MetadataPropertyHandling.Default || value > MetadataPropertyHandling.Ignore)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_metadataPropertyHandling = value;
			}
		}

		public virtual JsonConverterCollection Converters
		{
			get
			{
				if (_converters == null)
				{
					_converters = new JsonConverterCollection();
				}
				return _converters;
			}
		}

		public virtual IContractResolver ContractResolver
		{
			get
			{
				return _contractResolver;
			}
			set
			{
				_contractResolver = value ?? DefaultContractResolver.Instance;
			}
		}

		public virtual StreamingContext Context
		{
			get
			{
				return _context;
			}
			set
			{
				_context = value;
			}
		}

		public virtual Formatting Formatting
		{
			get
			{
				return _formatting.GetValueOrDefault();
			}
			set
			{
				_formatting = value;
			}
		}

		public virtual DateFormatHandling DateFormatHandling
		{
			get
			{
				return _dateFormatHandling.GetValueOrDefault();
			}
			set
			{
				_dateFormatHandling = value;
			}
		}

		public virtual DateTimeZoneHandling DateTimeZoneHandling
		{
			get
			{
				return _dateTimeZoneHandling ?? DateTimeZoneHandling.RoundtripKind;
			}
			set
			{
				_dateTimeZoneHandling = value;
			}
		}

		public virtual DateParseHandling DateParseHandling
		{
			get
			{
				return _dateParseHandling ?? DateParseHandling.DateTime;
			}
			set
			{
				_dateParseHandling = value;
			}
		}

		public virtual FloatParseHandling FloatParseHandling
		{
			get
			{
				return _floatParseHandling.GetValueOrDefault();
			}
			set
			{
				_floatParseHandling = value;
			}
		}

		public virtual FloatFormatHandling FloatFormatHandling
		{
			get
			{
				return _floatFormatHandling.GetValueOrDefault();
			}
			set
			{
				_floatFormatHandling = value;
			}
		}

		public virtual StringEscapeHandling StringEscapeHandling
		{
			get
			{
				return _stringEscapeHandling.GetValueOrDefault();
			}
			set
			{
				_stringEscapeHandling = value;
			}
		}

		public virtual string DateFormatString
		{
			get
			{
				return _dateFormatString ?? "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
			}
			set
			{
				_dateFormatString = value;
				_dateFormatStringSet = true;
			}
		}

		public virtual CultureInfo Culture
		{
			get
			{
				return _culture ?? JsonSerializerSettings.DefaultCulture;
			}
			set
			{
				_culture = value;
			}
		}

		public virtual int? MaxDepth
		{
			get
			{
				return _maxDepth;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				_maxDepth = value;
				_maxDepthSet = true;
			}
		}

		public virtual bool CheckAdditionalContent
		{
			get
			{
				return _checkAdditionalContent.GetValueOrDefault();
			}
			set
			{
				_checkAdditionalContent = value;
			}
		}

		public virtual event EventHandler<ErrorEventArgs>? Error;

		internal bool IsCheckAdditionalContentSet()
		{
			return _checkAdditionalContent.HasValue;
		}

		public JsonSerializer()
		{
			_referenceLoopHandling = ReferenceLoopHandling.Error;
			_missingMemberHandling = MissingMemberHandling.Ignore;
			_nullValueHandling = NullValueHandling.Include;
			_defaultValueHandling = DefaultValueHandling.Include;
			_objectCreationHandling = ObjectCreationHandling.Auto;
			_preserveReferencesHandling = PreserveReferencesHandling.None;
			_constructorHandling = ConstructorHandling.Default;
			_typeNameHandling = TypeNameHandling.None;
			_metadataPropertyHandling = MetadataPropertyHandling.Default;
			_context = JsonSerializerSettings.DefaultContext;
			_serializationBinder = DefaultSerializationBinder.Instance;
			_culture = JsonSerializerSettings.DefaultCulture;
			_contractResolver = DefaultContractResolver.Instance;
		}

		public static JsonSerializer Create()
		{
			return new JsonSerializer();
		}

		public static JsonSerializer Create(JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = Create();
			if (settings != null)
			{
				ApplySerializerSettings(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		public static JsonSerializer CreateDefault()
		{
			return Create(JsonConvert.DefaultSettings?.Invoke());
		}

		public static JsonSerializer CreateDefault(JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = CreateDefault();
			if (settings != null)
			{
				ApplySerializerSettings(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		private static void ApplySerializerSettings(JsonSerializer serializer, JsonSerializerSettings settings)
		{
			if (!CollectionUtils.IsNullOrEmpty(settings.Converters))
			{
				for (int i = 0; i < settings.Converters.Count; i++)
				{
					serializer.Converters.Insert(i, settings.Converters[i]);
				}
			}
			if (settings._typeNameHandling.HasValue)
			{
				serializer.TypeNameHandling = settings.TypeNameHandling;
			}
			if (settings._metadataPropertyHandling.HasValue)
			{
				serializer.MetadataPropertyHandling = settings.MetadataPropertyHandling;
			}
			if (settings._typeNameAssemblyFormatHandling.HasValue)
			{
				serializer.TypeNameAssemblyFormatHandling = settings.TypeNameAssemblyFormatHandling;
			}
			if (settings._preserveReferencesHandling.HasValue)
			{
				serializer.PreserveReferencesHandling = settings.PreserveReferencesHandling;
			}
			if (settings._referenceLoopHandling.HasValue)
			{
				serializer.ReferenceLoopHandling = settings.ReferenceLoopHandling;
			}
			if (settings._missingMemberHandling.HasValue)
			{
				serializer.MissingMemberHandling = settings.MissingMemberHandling;
			}
			if (settings._objectCreationHandling.HasValue)
			{
				serializer.ObjectCreationHandling = settings.ObjectCreationHandling;
			}
			if (settings._nullValueHandling.HasValue)
			{
				serializer.NullValueHandling = settings.NullValueHandling;
			}
			if (settings._defaultValueHandling.HasValue)
			{
				serializer.DefaultValueHandling = settings.DefaultValueHandling;
			}
			if (settings._constructorHandling.HasValue)
			{
				serializer.ConstructorHandling = settings.ConstructorHandling;
			}
			if (settings._context.HasValue)
			{
				serializer.Context = settings.Context;
			}
			if (settings._checkAdditionalContent.HasValue)
			{
				serializer._checkAdditionalContent = settings._checkAdditionalContent;
			}
			if (settings.Error != null)
			{
				serializer.Error += settings.Error;
			}
			if (settings.ContractResolver != null)
			{
				serializer.ContractResolver = settings.ContractResolver;
			}
			if (settings.ReferenceResolverProvider != null)
			{
				serializer.ReferenceResolver = settings.ReferenceResolverProvider();
			}
			if (settings.TraceWriter != null)
			{
				serializer.TraceWriter = settings.TraceWriter;
			}
			if (settings.EqualityComparer != null)
			{
				serializer.EqualityComparer = settings.EqualityComparer;
			}
			if (settings.SerializationBinder != null)
			{
				serializer.SerializationBinder = settings.SerializationBinder;
			}
			if (settings._formatting.HasValue)
			{
				serializer._formatting = settings._formatting;
			}
			if (settings._dateFormatHandling.HasValue)
			{
				serializer._dateFormatHandling = settings._dateFormatHandling;
			}
			if (settings._dateTimeZoneHandling.HasValue)
			{
				serializer._dateTimeZoneHandling = settings._dateTimeZoneHandling;
			}
			if (settings._dateParseHandling.HasValue)
			{
				serializer._dateParseHandling = settings._dateParseHandling;
			}
			if (settings._dateFormatStringSet)
			{
				serializer._dateFormatString = settings._dateFormatString;
				serializer._dateFormatStringSet = settings._dateFormatStringSet;
			}
			if (settings._floatFormatHandling.HasValue)
			{
				serializer._floatFormatHandling = settings._floatFormatHandling;
			}
			if (settings._floatParseHandling.HasValue)
			{
				serializer._floatParseHandling = settings._floatParseHandling;
			}
			if (settings._stringEscapeHandling.HasValue)
			{
				serializer._stringEscapeHandling = settings._stringEscapeHandling;
			}
			if (settings._culture != null)
			{
				serializer._culture = settings._culture;
			}
			if (settings._maxDepthSet)
			{
				serializer._maxDepth = settings._maxDepth;
				serializer._maxDepthSet = settings._maxDepthSet;
			}
		}

		[DebuggerStepThrough]
		public void Populate(TextReader reader, object target)
		{
			Populate(new JsonTextReader(reader), target);
		}

		[DebuggerStepThrough]
		public void Populate(JsonReader reader, object target)
		{
			PopulateInternal(reader, target);
		}

		internal virtual void PopulateInternal(JsonReader reader, object target)
		{
			ValidationUtils.ArgumentNotNull(reader, "reader");
			ValidationUtils.ArgumentNotNull(target, "target");
			SetupReader(reader, out CultureInfo previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string previousDateFormatString);
			TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? CreateTraceJsonReader(reader) : null);
			new JsonSerializerInternalReader(this).Populate(traceJsonReader ?? reader, target);
			if (traceJsonReader != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null);
			}
			ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString);
		}

		[DebuggerStepThrough]
		public object? Deserialize(JsonReader reader)
		{
			return Deserialize(reader, null);
		}

		[DebuggerStepThrough]
		public object? Deserialize(TextReader reader, Type objectType)
		{
			return Deserialize(new JsonTextReader(reader), objectType);
		}

		[DebuggerStepThrough]
		public T? Deserialize<T>(JsonReader reader)
		{
			return (T)Deserialize(reader, typeof(T));
		}

		[DebuggerStepThrough]
		public object? Deserialize(JsonReader reader, Type? objectType)
		{
			return DeserializeInternal(reader, objectType);
		}

		internal virtual object? DeserializeInternal(JsonReader reader, Type? objectType)
		{
			ValidationUtils.ArgumentNotNull(reader, "reader");
			SetupReader(reader, out CultureInfo previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string previousDateFormatString);
			TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? CreateTraceJsonReader(reader) : null);
			object? result = new JsonSerializerInternalReader(this).Deserialize(traceJsonReader ?? reader, objectType, CheckAdditionalContent);
			if (traceJsonReader != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null);
			}
			ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString);
			return result;
		}

		internal void SetupReader(JsonReader reader, out CultureInfo? previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string? previousDateFormatString)
		{
			if (_culture != null && !_culture.Equals(reader.Culture))
			{
				previousCulture = reader.Culture;
				reader.Culture = _culture;
			}
			else
			{
				previousCulture = null;
			}
			if (_dateTimeZoneHandling.HasValue && reader.DateTimeZoneHandling != _dateTimeZoneHandling)
			{
				previousDateTimeZoneHandling = reader.DateTimeZoneHandling;
				reader.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault();
			}
			else
			{
				previousDateTimeZoneHandling = null;
			}
			if (_dateParseHandling.HasValue && reader.DateParseHandling != _dateParseHandling)
			{
				previousDateParseHandling = reader.DateParseHandling;
				reader.DateParseHandling = _dateParseHandling.GetValueOrDefault();
			}
			else
			{
				previousDateParseHandling = null;
			}
			if (_floatParseHandling.HasValue && reader.FloatParseHandling != _floatParseHandling)
			{
				previousFloatParseHandling = reader.FloatParseHandling;
				reader.FloatParseHandling = _floatParseHandling.GetValueOrDefault();
			}
			else
			{
				previousFloatParseHandling = null;
			}
			if (_maxDepthSet && reader.MaxDepth != _maxDepth)
			{
				previousMaxDepth = reader.MaxDepth;
				reader.MaxDepth = _maxDepth;
			}
			else
			{
				previousMaxDepth = null;
			}
			if (_dateFormatStringSet && reader.DateFormatString != _dateFormatString)
			{
				previousDateFormatString = reader.DateFormatString;
				reader.DateFormatString = _dateFormatString;
			}
			else
			{
				previousDateFormatString = null;
			}
			if (reader is JsonTextReader jsonTextReader && jsonTextReader.PropertyNameTable == null && _contractResolver is DefaultContractResolver defaultContractResolver)
			{
				jsonTextReader.PropertyNameTable = defaultContractResolver.GetNameTable();
			}
		}

		private void ResetReader(JsonReader reader, CultureInfo? previousCulture, DateTimeZoneHandling? previousDateTimeZoneHandling, DateParseHandling? previousDateParseHandling, FloatParseHandling? previousFloatParseHandling, int? previousMaxDepth, string? previousDateFormatString)
		{
			if (previousCulture != null)
			{
				reader.Culture = previousCulture;
			}
			if (previousDateTimeZoneHandling.HasValue)
			{
				reader.DateTimeZoneHandling = previousDateTimeZoneHandling.GetValueOrDefault();
			}
			if (previousDateParseHandling.HasValue)
			{
				reader.DateParseHandling = previousDateParseHandling.GetValueOrDefault();
			}
			if (previousFloatParseHandling.HasValue)
			{
				reader.FloatParseHandling = previousFloatParseHandling.GetValueOrDefault();
			}
			if (_maxDepthSet)
			{
				reader.MaxDepth = previousMaxDepth;
			}
			if (_dateFormatStringSet)
			{
				reader.DateFormatString = previousDateFormatString;
			}
			if (reader is JsonTextReader jsonTextReader && jsonTextReader.PropertyNameTable != null && _contractResolver is DefaultContractResolver defaultContractResolver && jsonTextReader.PropertyNameTable == defaultContractResolver.GetNameTable())
			{
				jsonTextReader.PropertyNameTable = null;
			}
		}

		public void Serialize(TextWriter textWriter, object? value)
		{
			Serialize(new JsonTextWriter(textWriter), value);
		}

		public void Serialize(JsonWriter jsonWriter, object? value, Type? objectType)
		{
			SerializeInternal(jsonWriter, value, objectType);
		}

		public void Serialize(TextWriter textWriter, object? value, Type objectType)
		{
			Serialize(new JsonTextWriter(textWriter), value, objectType);
		}

		public void Serialize(JsonWriter jsonWriter, object? value)
		{
			SerializeInternal(jsonWriter, value, null);
		}

		private TraceJsonReader CreateTraceJsonReader(JsonReader reader)
		{
			TraceJsonReader traceJsonReader = new TraceJsonReader(reader);
			if (reader.TokenType != 0)
			{
				traceJsonReader.WriteCurrentToken();
			}
			return traceJsonReader;
		}

		internal virtual void SerializeInternal(JsonWriter jsonWriter, object? value, Type? objectType)
		{
			ValidationUtils.ArgumentNotNull(jsonWriter, "jsonWriter");
			Formatting? formatting = null;
			if (_formatting.HasValue && jsonWriter.Formatting != _formatting)
			{
				formatting = jsonWriter.Formatting;
				jsonWriter.Formatting = _formatting.GetValueOrDefault();
			}
			DateFormatHandling? dateFormatHandling = null;
			if (_dateFormatHandling.HasValue && jsonWriter.DateFormatHandling != _dateFormatHandling)
			{
				dateFormatHandling = jsonWriter.DateFormatHandling;
				jsonWriter.DateFormatHandling = _dateFormatHandling.GetValueOrDefault();
			}
			DateTimeZoneHandling? dateTimeZoneHandling = null;
			if (_dateTimeZoneHandling.HasValue && jsonWriter.DateTimeZoneHandling != _dateTimeZoneHandling)
			{
				dateTimeZoneHandling = jsonWriter.DateTimeZoneHandling;
				jsonWriter.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault();
			}
			FloatFormatHandling? floatFormatHandling = null;
			if (_floatFormatHandling.HasValue && jsonWriter.FloatFormatHandling != _floatFormatHandling)
			{
				floatFormatHandling = jsonWriter.FloatFormatHandling;
				jsonWriter.FloatFormatHandling = _floatFormatHandling.GetValueOrDefault();
			}
			StringEscapeHandling? stringEscapeHandling = null;
			if (_stringEscapeHandling.HasValue && jsonWriter.StringEscapeHandling != _stringEscapeHandling)
			{
				stringEscapeHandling = jsonWriter.StringEscapeHandling;
				jsonWriter.StringEscapeHandling = _stringEscapeHandling.GetValueOrDefault();
			}
			CultureInfo cultureInfo = null;
			if (_culture != null && !_culture.Equals(jsonWriter.Culture))
			{
				cultureInfo = jsonWriter.Culture;
				jsonWriter.Culture = _culture;
			}
			string dateFormatString = null;
			if (_dateFormatStringSet && jsonWriter.DateFormatString != _dateFormatString)
			{
				dateFormatString = jsonWriter.DateFormatString;
				jsonWriter.DateFormatString = _dateFormatString;
			}
			TraceJsonWriter traceJsonWriter = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? new TraceJsonWriter(jsonWriter) : null);
			new JsonSerializerInternalWriter(this).Serialize(traceJsonWriter ?? jsonWriter, value, objectType);
			if (traceJsonWriter != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonWriter.GetSerializedJsonMessage(), null);
			}
			if (formatting.HasValue)
			{
				jsonWriter.Formatting = formatting.GetValueOrDefault();
			}
			if (dateFormatHandling.HasValue)
			{
				jsonWriter.DateFormatHandling = dateFormatHandling.GetValueOrDefault();
			}
			if (dateTimeZoneHandling.HasValue)
			{
				jsonWriter.DateTimeZoneHandling = dateTimeZoneHandling.GetValueOrDefault();
			}
			if (floatFormatHandling.HasValue)
			{
				jsonWriter.FloatFormatHandling = floatFormatHandling.GetValueOrDefault();
			}
			if (stringEscapeHandling.HasValue)
			{
				jsonWriter.StringEscapeHandling = stringEscapeHandling.GetValueOrDefault();
			}
			if (_dateFormatStringSet)
			{
				jsonWriter.DateFormatString = dateFormatString;
			}
			if (cultureInfo != null)
			{
				jsonWriter.Culture = cultureInfo;
			}
		}

		internal IReferenceResolver GetReferenceResolver()
		{
			if (_referenceResolver == null)
			{
				_referenceResolver = new DefaultReferenceResolver();
			}
			return _referenceResolver;
		}

		internal JsonConverter? GetMatchingConverter(Type type)
		{
			return GetMatchingConverter(_converters, type);
		}

		internal static JsonConverter? GetMatchingConverter(IList<JsonConverter>? converters, Type objectType)
		{
			if (converters != null)
			{
				for (int i = 0; i < converters.Count; i++)
				{
					JsonConverter jsonConverter = converters[i];
					if (jsonConverter.CanConvert(objectType))
					{
						return jsonConverter;
					}
				}
			}
			return null;
		}

		internal void OnError(ErrorEventArgs e)
		{
			this.Error?.Invoke(this, e);
		}
	}
	public class JsonSerializerSettings
	{
		internal const ReferenceLoopHandling DefaultReferenceLoopHandling = ReferenceLoopHandling.Error;

		internal const MissingMemberHandling DefaultMissingMemberHandling = MissingMemberHandling.Ignore;

		internal const NullValueHandling DefaultNullValueHandling = NullValueHandling.Include;

		internal const DefaultValueHandling DefaultDefaultValueHandling = DefaultValueHandling.Include;

		internal const ObjectCreationHandling DefaultObjectCreationHandling = ObjectCreationHandling.Auto;

		internal const PreserveReferencesHandling DefaultPreserveReferencesHandling = PreserveReferencesHandling.None;

		internal const ConstructorHandling DefaultConstructorHandling = ConstructorHandling.Default;

		internal const TypeNameHandling DefaultTypeNameHandling = TypeNameHandling.None;

		internal const MetadataPropertyHandling DefaultMetadataPropertyHandling = MetadataPropertyHandling.Default;

		internal static readonly StreamingContext DefaultContext;

		internal const Formatting DefaultFormatting = Formatting.None;

		internal const DateFormatHandling DefaultDateFormatHandling = DateFormatHandling.IsoDateFormat;

		internal const DateTimeZoneHandling DefaultDateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;

		internal const DateParseHandling DefaultDateParseHandling = DateParseHandling.DateTime;

		internal const FloatParseHandling DefaultFloatParseHandling = FloatParseHandling.Double;

		internal const FloatFormatHandling DefaultFloatFormatHandling = FloatFormatHandling.String;

		internal const StringEscapeHandling DefaultStringEscapeHandling = StringEscapeHandling.Default;

		internal const TypeNameAssemblyFormatHandling DefaultTypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple;

		internal static readonly CultureInfo DefaultCulture;

		internal const bool DefaultCheckAdditionalContent = false;

		internal const string DefaultDateFormatString = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";

		internal const int DefaultMaxDepth = 64;

		internal Formatting? _formatting;

		internal DateFormatHandling? _dateFormatHandling;

		internal DateTimeZoneHandling? _dateTimeZoneHandling;

		internal DateParseHandling? _dateParseHandling;

		internal FloatFormatHandling? _floatFormatHandling;

		internal FloatParseHandling? _floatParseHandling;

		internal StringEscapeHandling? _stringEscapeHandling;

		internal CultureInfo? _culture;

		internal bool? _checkAdditionalContent;

		internal int? _maxDepth;

		internal bool _maxDepthSet;

		internal string? _dateFormatString;

		internal bool _dateFormatStringSet;

		internal TypeNameAssemblyFormatHandling? _typeNameAssemblyFormatHandling;

		internal DefaultValueHandling? _defaultValueHandling;

		internal PreserveReferencesHandling? _preserveReferencesHandling;

		internal NullValueHandling? _nullValueHandling;

		internal ObjectCreationHandling? _objectCreationHandling;

		internal MissingMemberHandling? _missingMemberHandling;

		internal ReferenceLoopHandling? _referenceLoopHandling;

		internal StreamingContext? _context;

		internal ConstructorHandling? _constructorHandling;

		internal TypeNameHandling? _typeNameHandling;

		internal MetadataPropertyHandling? _metadataPropertyHandling;

		public ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_referenceLoopHandling = value;
			}
		}

		public MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling.GetValueOrDefault();
			}
			set
			{
				_missingMemberHandling = value;
			}
		}

		public ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling.GetValueOrDefault();
			}
			set
			{
				_objectCreationHandling = value;
			}
		}

		public NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling.GetValueOrDefault();
			}
			set
			{
				_nullValueHandling = value;
			}
		}

		public DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling.GetValueOrDefault();
			}
			set
			{
				_defaultValueHandling = value;
			}
		}

		public IList<JsonConverter> Converters { get; set; }

		public PreserveReferencesHandling PreserveReferencesHandling
		{
			get
			{
				return _preserveReferencesHandling.GetValueOrDefault();
			}
			set
			{
				_preserveReferencesHandling = value;
			}
		}

		public TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling.GetValueOrDefault();
			}
			set
			{
				_typeNameHandling = value;
			}
		}

		public MetadataPropertyHandling MetadataPropertyHandling
		{
			get
			{
				return _metadataPropertyHandling.GetValueOrDefault();
			}
			set
			{
				_metadataPropertyHandling = value;
			}
		}

		[Obsolete("TypeNameAssemblyFormat is obsolete. Use TypeNameAssemblyFormatHandling instead.")]
		public FormatterAssemblyStyle TypeNameAssemblyFormat
		{
			get
			{
				return (FormatterAssemblyStyle)TypeNameAssemblyFormatHandling;
			}
			set
			{
				TypeNameAssemblyFormatHandling = (TypeNameAssemblyFormatHandling)value;
			}
		}

		public TypeNameAssemblyFormatHandling TypeNameAssemblyFormatHandling
		{
			get
			{
				return _typeNameAssemblyFormatHandling.GetValueOrDefault();
			}
			set
			{
				_typeNameAssemblyFormatHandling = value;
			}
		}

		public ConstructorHandling ConstructorHandling
		{
			get
			{
				return _constructorHandling.GetValueOrDefault();
			}
			set
			{
				_constructorHandling = value;
			}
		}

		public IContractResolver? ContractResolver { get; set; }

		public IEqualityComparer? EqualityComparer { get; set; }

		[Obsolete("Refer

NLog.dll

Decompiled 5 months ago
#define TRACE
#define DEBUG
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Dynamic;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Mail;
using System.Net.NetworkInformation;
using System.Net.Security;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Authentication;
using System.Security.Cryptography;
using System.Security.Principal;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using JetBrains.Annotations;
using NLog.Attributes;
using NLog.Common;
using NLog.Conditions;
using NLog.Config;
using NLog.Filters;
using NLog.Internal;
using NLog.Internal.Fakeables;
using NLog.Internal.FileAppenders;
using NLog.Internal.NetworkSenders;
using NLog.Internal.Xamarin;
using NLog.LayoutRenderers;
using NLog.LayoutRenderers.Wrappers;
using NLog.Layouts;
using NLog.MessageTemplates;
using NLog.Targets;
using NLog.Targets.FileArchiveModes;
using NLog.Targets.Wrappers;
using NLog.Time;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: Preserve]
[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: InternalsVisibleTo("NLog.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ef8eab4fbdeb511eeb475e1659fe53f00ec1c1340700f1aa347bf3438455d71993b28b1efbed44c8d97a989e0cb6f01bcb5e78f0b055d311546f63de0a969e04cf04450f43834db9f909e566545a67e42822036860075a1576e90e1c43d43e023a24c22a427f85592ae56cac26f13b7ec2625cbc01f9490d60f16cfbb1bc34d9")]
[assembly: AllowPartiallyTrustedCallers]
[assembly: SecurityRules(SecurityRuleSet.Level1)]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("NLog")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright (c) 2004-2023 NLog Project - https://nlog-project.org/ ")]
[assembly: AssemblyDescription("NLog is a logging platform for .NET with rich log routing and management capabilities.\nNLog supports traditional logging, structured logging and the combination of both.\n\nSupported platforms:\n\n- .NET 5, 6 and 7\n- .NET Core 1, 2 and 3\n- .NET Standard 1.3+ and 2.0+\n- .NET Framework 3.5 - 4.8\n- Xamarin Android + iOS (.NET Standard)\n- Mono 4\n\nFor ASP.NET Core, check: https://www.nuget.org/packages/NLog.Web.AspNetCore\n    \n    ")]
[assembly: AssemblyFileVersion("5.1.4.1703")]
[assembly: AssemblyInformationalVersion("5.1.4+589ee8b1398665c1810660c5434d0226b0ccf09f")]
[assembly: AssemblyProduct("NLog v5.1.4")]
[assembly: AssemblyTitle("NLog for NetStandard 2.0")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/NLog/NLog.git")]
[assembly: AssemblyVersion("5.0.0.0")]
namespace JetBrains.Annotations
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.GenericParameter)]
	internal sealed class CanBeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.GenericParameter)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Delegate)]
	internal sealed class ItemNotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Delegate)]
	internal sealed class ItemCanBeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Delegate)]
	internal sealed class StringFormatMethodAttribute : Attribute
	{
		[NotNull]
		public string FormatParameterName { get; }

		public StringFormatMethodAttribute([NotNull] string formatParameterName)
		{
			FormatParameterName = formatParameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	internal sealed class StructuredMessageTemplateAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = true)]
	internal sealed class ValueProviderAttribute : Attribute
	{
		[NotNull]
		public string Name { get; }

		public ValueProviderAttribute([NotNull] string name)
		{
			Name = name;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Delegate, AllowMultiple = true)]
	internal sealed class ValueRangeAttribute : Attribute
	{
		public object From { get; }

		public object To { get; }

		public ValueRangeAttribute(long from, long to)
		{
			From = from;
			To = to;
		}

		public ValueRangeAttribute(ulong from, ulong to)
		{
			From = from;
			To = to;
		}

		public ValueRangeAttribute(long value)
		{
			From = (To = value);
		}

		public ValueRangeAttribute(ulong value)
		{
			From = (To = value);
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Delegate)]
	internal sealed class NonNegativeValueAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	internal sealed class InvokerParameterNameAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method)]
	internal sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
	{
		[CanBeNull]
		public string ParameterName { get; }

		public NotifyPropertyChangedInvocatorAttribute()
		{
		}

		public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
	internal sealed class ContractAnnotationAttribute : Attribute
	{
		[NotNull]
		public string Contract { get; }

		public bool ForceFullStates { get; }

		public ContractAnnotationAttribute([NotNull] string contract)
			: this(contract, forceFullStates: false)
		{
		}

		public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates)
		{
			Contract = contract;
			ForceFullStates = forceFullStates;
		}
	}
	[AttributeUsage(AttributeTargets.All)]
	internal sealed class LocalizationRequiredAttribute : Attribute
	{
		public bool Required { get; }

		public LocalizationRequiredAttribute()
			: this(required: true)
		{
		}

		public LocalizationRequiredAttribute(bool required)
		{
			Required = required;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface)]
	internal sealed class CannotApplyEqualityOperatorAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
	[BaseTypeRequired(typeof(Attribute))]
	internal sealed class BaseTypeRequiredAttribute : Attribute
	{
		[NotNull]
		public Type BaseType { get; }

		public BaseTypeRequiredAttribute([NotNull] Type baseType)
		{
			BaseType = baseType;
		}
	}
	[AttributeUsage(AttributeTargets.All)]
	internal sealed class UsedImplicitlyAttribute : Attribute
	{
		public ImplicitUseKindFlags UseKindFlags { get; }

		public ImplicitUseTargetFlags TargetFlags { get; }

		public UsedImplicitlyAttribute()
			: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default)
		{
		}

		public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)
			: this(useKindFlags, ImplicitUseTargetFlags.Default)
		{
		}

		public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)
			: this(ImplicitUseKindFlags.Default, targetFlags)
		{
		}

		public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
		{
			UseKindFlags = useKindFlags;
			TargetFlags = targetFlags;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Parameter | AttributeTargets.GenericParameter)]
	internal sealed class MeansImplicitUseAttribute : Attribute
	{
		[UsedImplicitly]
		public ImplicitUseKindFlags UseKindFlags { get; }

		[UsedImplicitly]
		public ImplicitUseTargetFlags TargetFlags { get; }

		public MeansImplicitUseAttribute()
			: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default)
		{
		}

		public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)
			: this(useKindFlags, ImplicitUseTargetFlags.Default)
		{
		}

		public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)
			: this(ImplicitUseKindFlags.Default, targetFlags)
		{
		}

		public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
		{
			UseKindFlags = useKindFlags;
			TargetFlags = targetFlags;
		}
	}
	[Flags]
	internal enum ImplicitUseKindFlags
	{
		Default = 7,
		Access = 1,
		Assign = 2,
		InstantiatedWithFixedConstructorSignature = 4,
		InstantiatedNoFixedConstructorSignature = 8
	}
	[Flags]
	internal enum ImplicitUseTargetFlags
	{
		Default = 1,
		Itself = 1,
		Members = 2,
		WithInheritors = 4,
		WithMembers = 3
	}
	[MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)]
	[AttributeUsage(AttributeTargets.All, Inherited = false)]
	internal sealed class PublicAPIAttribute : Attribute
	{
		[CanBeNull]
		public string Comment { get; }

		public PublicAPIAttribute()
		{
		}

		public PublicAPIAttribute([NotNull] string comment)
		{
			Comment = comment;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	internal sealed class InstantHandleAttribute : Attribute
	{
		public bool RequireAwait { get; set; }
	}
	[AttributeUsage(AttributeTargets.Method)]
	internal sealed class PureAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method)]
	internal sealed class MustUseReturnValueAttribute : Attribute
	{
		[CanBeNull]
		public string Justification { get; }

		public MustUseReturnValueAttribute()
		{
		}

		public MustUseReturnValueAttribute([NotNull] string justification)
		{
			Justification = justification;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	internal sealed class RequireStaticDelegateAttribute : Attribute
	{
		public bool IsError { get; set; }
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.GenericParameter)]
	internal sealed class ProvidesContextAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	internal sealed class PathReferenceAttribute : Attribute
	{
		[CanBeNull]
		public string BasePath { get; }

		public PathReferenceAttribute()
		{
		}

		public PathReferenceAttribute([NotNull][PathReference] string basePath)
		{
			BasePath = basePath;
		}
	}
	[AttributeUsage(AttributeTargets.Method)]
	internal sealed class SourceTemplateAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true)]
	internal sealed class MacroAttribute : Attribute
	{
		[CanBeNull]
		public string Expression { get; set; }

		public int Editable { get; set; }

		[CanBeNull]
		public string Target { get; set; }
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.ReturnValue)]
	internal sealed class CollectionAccessAttribute : Attribute
	{
		public CollectionAccessType CollectionAccessType { get; }

		public CollectionAccessAttribute(CollectionAccessType collectionAccessType)
		{
			CollectionAccessType = collectionAccessType;
		}
	}
	[Flags]
	internal enum CollectionAccessType
	{
		None = 0,
		Read = 1,
		ModifyExistingContent = 2,
		UpdatedContent = 6
	}
	[AttributeUsage(AttributeTargets.Method)]
	internal sealed class AssertionMethodAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	internal sealed class AssertionConditionAttribute : Attribute
	{
		public AssertionConditionType ConditionType { get; }

		public AssertionConditionAttribute(AssertionConditionType conditionType)
		{
			ConditionType = conditionType;
		}
	}
	internal enum AssertionConditionType
	{
		IS_TRUE,
		IS_FALSE,
		IS_NULL,
		IS_NOT_NULL
	}
	[Obsolete("Use [ContractAnnotation('=> halt')] instead")]
	[AttributeUsage(AttributeTargets.Method)]
	internal sealed class TerminatesProgramAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method)]
	internal sealed class LinqTunnelAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	internal sealed class NoEnumerationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	internal sealed class RegexPatternAttribute : Attribute
	{
	}
	internal enum InjectedLanguage
	{
		CSS,
		HTML,
		JAVASCRIPT,
		JSON,
		XML
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
	internal sealed class LanguageInjectionAttribute : Attribute
	{
		public InjectedLanguage InjectedLanguage { get; }

		[CanBeNull]
		public string Prefix { get; set; }

		[CanBeNull]
		public string Suffix { get; set; }

		public LanguageInjectionAttribute(InjectedLanguage injectedLanguage)
		{
			InjectedLanguage = injectedLanguage;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface)]
	internal sealed class NoReorderAttribute : Attribute
	{
	}
}
namespace NLog
{
	public interface IJsonConverter
	{
		bool SerializeObject(object value, StringBuilder builder);
	}
	[CLSCompliant(false)]
	public interface ILogger : ILoggerBase, ISuppress
	{
		bool IsTraceEnabled { get; }

		bool IsDebugEnabled { get; }

		bool IsInfoEnabled { get; }

		bool IsWarnEnabled { get; }

		bool IsErrorEnabled { get; }

		bool IsFatalEnabled { get; }

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Trace(object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Trace(IFormatProvider formatProvider, object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2, object arg3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Debug(object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Debug(IFormatProvider formatProvider, object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2, object arg3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Info(object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Info(IFormatProvider formatProvider, object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2, object arg3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Warn(object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Warn(IFormatProvider formatProvider, object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2, object arg3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Error(object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Error(IFormatProvider formatProvider, object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2, object arg3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Fatal(object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Fatal(IFormatProvider formatProvider, object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2, object arg3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		void Trace<T>(T value);

		void Trace<T>(IFormatProvider formatProvider, T value);

		void Trace(LogMessageGenerator messageFunc);

		[Obsolete("Use Trace(Exception exception, string message, params object[] args) method instead. Marked obsolete with v4.3.11 (Only here because of LibLog)")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void TraceException([Localizable(false)] string message, Exception exception);

		void Trace(Exception exception, [Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Trace(Exception exception, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Trace(Exception exception, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Trace(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		void Trace([Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Trace([Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[Obsolete("Use Trace(Exception exception, string message, params object[] args) method instead. Marked obsolete before v4.3.11")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void Trace([Localizable(false)] string message, Exception exception);

		[MessageTemplateFormatMethod("message")]
		void Trace<TArgument>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Trace<TArgument>([Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Trace<TArgument1, TArgument2>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Trace<TArgument1, TArgument2>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Trace<TArgument1, TArgument2, TArgument3>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		[MessageTemplateFormatMethod("message")]
		void Trace<TArgument1, TArgument2, TArgument3>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		void Debug<T>(T value);

		void Debug<T>(IFormatProvider formatProvider, T value);

		void Debug(LogMessageGenerator messageFunc);

		[Obsolete("Use Debug(Exception exception, string message, params object[] args) method instead. Marked obsolete with v4.3.11 (Only here because of LibLog)")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void DebugException([Localizable(false)][StructuredMessageTemplate] string message, Exception exception);

		void Debug(Exception exception, [Localizable(false)][StructuredMessageTemplate] string message);

		[MessageTemplateFormatMethod("message")]
		void Debug(Exception exception, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Debug(Exception exception, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Debug(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		void Debug([Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Debug([Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[Obsolete("Use Debug(Exception exception, string message, params object[] args) method instead. Marked obsolete before v4.3.11")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void Debug([Localizable(false)] string message, Exception exception);

		[MessageTemplateFormatMethod("message")]
		void Debug<TArgument>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Debug<TArgument>([Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Debug<TArgument1, TArgument2>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Debug<TArgument1, TArgument2>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Debug<TArgument1, TArgument2, TArgument3>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		[MessageTemplateFormatMethod("message")]
		void Debug<TArgument1, TArgument2, TArgument3>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		void Info<T>(T value);

		void Info<T>(IFormatProvider formatProvider, T value);

		void Info(LogMessageGenerator messageFunc);

		[Obsolete("Use Info(Exception exception, string message, params object[] args) method instead. Marked obsolete with v4.3.11 (Only here because of LibLog)")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void InfoException([Localizable(false)] string message, Exception exception);

		void Info(Exception exception, [Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Info(Exception exception, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Info(Exception exception, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Info(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		void Info([Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Info([Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[Obsolete("Use Info(Exception exception, string message, params object[] args) method instead. Marked obsolete before v4.3.11")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void Info([Localizable(false)] string message, Exception exception);

		[MessageTemplateFormatMethod("message")]
		void Info<TArgument>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Info<TArgument>([Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Info<TArgument1, TArgument2>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Info<TArgument1, TArgument2>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Info<TArgument1, TArgument2, TArgument3>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		[MessageTemplateFormatMethod("message")]
		void Info<TArgument1, TArgument2, TArgument3>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		void Warn<T>(T value);

		void Warn<T>(IFormatProvider formatProvider, T value);

		void Warn(LogMessageGenerator messageFunc);

		[Obsolete("Use Warn(Exception exception, string message, params object[] args) method instead. Marked obsolete with v4.3.11 (Only here because of LibLog)")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void WarnException([Localizable(false)] string message, Exception exception);

		void Warn(Exception exception, [Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Warn(Exception exception, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Warn(Exception exception, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Warn(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		void Warn([Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Warn([Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[Obsolete("Use Warn(Exception exception, string message, params object[] args) method instead. Marked obsolete before v4.3.11")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void Warn([Localizable(false)] string message, Exception exception);

		[MessageTemplateFormatMethod("message")]
		void Warn<TArgument>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Warn<TArgument>([Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Warn<TArgument1, TArgument2>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Warn<TArgument1, TArgument2>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Warn<TArgument1, TArgument2, TArgument3>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		[MessageTemplateFormatMethod("message")]
		void Warn<TArgument1, TArgument2, TArgument3>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		void Error<T>(T value);

		void Error<T>(IFormatProvider formatProvider, T value);

		void Error(LogMessageGenerator messageFunc);

		[Obsolete("Use Error(Exception exception, string message, params object[] args) method instead. Marked obsolete with v4.3.11 (Only here because of LibLog)")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void ErrorException([Localizable(false)] string message, Exception exception);

		void Error(Exception exception, [Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Error(Exception exception, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Error(Exception exception, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Error(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		void Error([Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Error([Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[Obsolete("Use Error(Exception exception, string message, params object[] args) method instead. Marked obsolete before v4.3.11")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void Error([Localizable(false)] string message, Exception exception);

		[MessageTemplateFormatMethod("message")]
		void Error<TArgument>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Error<TArgument>([Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Error<TArgument1, TArgument2>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Error<TArgument1, TArgument2>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Error<TArgument1, TArgument2, TArgument3>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		[MessageTemplateFormatMethod("message")]
		void Error<TArgument1, TArgument2, TArgument3>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		void Fatal<T>(T value);

		void Fatal<T>(IFormatProvider formatProvider, T value);

		void Fatal(LogMessageGenerator messageFunc);

		[Obsolete("Use Fatal(Exception exception, string message, params object[] args) method instead. Marked obsolete with v4.3.11 (Only here because of LibLog)")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void FatalException([Localizable(false)][StructuredMessageTemplate] string message, Exception exception);

		void Fatal(Exception exception, [Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Fatal(Exception exception, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Fatal(Exception exception, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Fatal(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		void Fatal([Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Fatal([Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[Obsolete("Use Fatal(Exception exception, string message, params object[] args) method instead. Marked obsolete before v4.3.11")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void Fatal([Localizable(false)] string message, Exception exception);

		[MessageTemplateFormatMethod("message")]
		void Fatal<TArgument>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Fatal<TArgument>([Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Fatal<TArgument1, TArgument2>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Fatal<TArgument1, TArgument2>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Fatal<TArgument1, TArgument2, TArgument3>(IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		[MessageTemplateFormatMethod("message")]
		void Fatal<TArgument1, TArgument2, TArgument3>([Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);
	}
	[CLSCompliant(false)]
	public interface ILoggerBase
	{
		string Name { get; }

		LogFactory Factory { get; }

		event EventHandler<EventArgs> LoggerReconfigured;

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Log(LogLevel level, object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		void Log(LogLevel level, IFormatProvider formatProvider, object value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, object arg1, object arg2, object arg3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, bool argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, char argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, byte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, string argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, int argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, long argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, float argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, double argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, decimal argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, object argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, sbyte argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, uint argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		[EditorBrowsable(EditorBrowsableState.Never)]
		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, ulong argument);

		bool IsEnabled(LogLevel level);

		void Log(LogEventInfo logEvent);

		void Log(Type wrapperType, LogEventInfo logEvent);

		void Log<T>(LogLevel level, T value);

		void Log<T>(LogLevel level, IFormatProvider formatProvider, T value);

		void Log(LogLevel level, LogMessageGenerator messageFunc);

		[Obsolete("Use Log(LogLevel level, Exception exception, [Localizable(false)] string message, params object[] args) instead. Marked obsolete before v4.3.11")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void LogException(LogLevel level, [Localizable(false)] string message, Exception exception);

		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, Exception exception, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, Exception exception, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		void Log(LogLevel level, [Localizable(false)] string message);

		[MessageTemplateFormatMethod("message")]
		void Log(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

		[Obsolete("Use Log(LogLevel level, Exception exception, [Localizable(false)] string message, params object[] args) instead. Marked obsolete before v4.3.11")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void Log(LogLevel level, [Localizable(false)] string message, Exception exception);

		[MessageTemplateFormatMethod("message")]
		void Log<TArgument>(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Log<TArgument>(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, TArgument argument);

		[MessageTemplateFormatMethod("message")]
		void Log<TArgument1, TArgument2>(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Log<TArgument1, TArgument2>(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2);

		[MessageTemplateFormatMethod("message")]
		void Log<TArgument1, TArgument2, TArgument3>(LogLevel level, IFormatProvider formatProvider, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);

		[MessageTemplateFormatMethod("message")]
		void Log<TArgument1, TArgument2, TArgument3>(LogLevel level, [Localizable(false)][StructuredMessageTemplate] string message, TArgument1 argument1, TArgument2 argument2, TArgument3 argument3);
	}
	public interface ISuppress
	{
		void Swallow(Action action);

		T Swallow<T>(Func<T> func);

		T Swallow<T>(Func<T> func, T fallback);

		void Swallow(Task task);

		Task SwallowAsync(Task task);

		Task SwallowAsync(Func<Task> asyncAction);

		Task<TResult> SwallowAsync<TResult>(Func<Task<TResult>> asyncFunc);

		Task<TResult> SwallowAsync<TResult>(Func<Task<TResult>> asyncFunc, TResult fallback);
	}
	public interface IValueFormatter
	{
		bool FormatValue(object value, string format, CaptureType captureType, IFormatProvider formatProvider, StringBuilder builder);
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
	public sealed class MessageTemplateFormatMethodAttribute : Attribute
	{
		public string ParameterName { get; }

		public MessageTemplateFormatMethodAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	public static class GlobalDiagnosticsContext
	{
		private static readonly object _lockObject = new object();

		private static Dictionary<string, object> _dict = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);

		private static Dictionary<string, object> _dictReadOnly;

		public static void Set(string item, string value)
		{
			Set(item, (object)value);
		}

		public static void Set(string item, object value)
		{
			lock (_lockObject)
			{
				GetWritableDict()[item] = value;
			}
		}

		public static string Get(string item)
		{
			return Get(item, null);
		}

		public static string Get(string item, IFormatProvider formatProvider)
		{
			return FormatHelper.ConvertToString(GetObject(item), formatProvider);
		}

		public static object GetObject(string item)
		{
			GetReadOnlyDict().TryGetValue(item, out var value);
			return value;
		}

		public static ICollection<string> GetNames()
		{
			return GetReadOnlyDict().Keys;
		}

		public static bool Contains(string item)
		{
			return GetReadOnlyDict().ContainsKey(item);
		}

		public static void Remove(string item)
		{
			lock (_lockObject)
			{
				if (_dict.ContainsKey(item))
				{
					GetWritableDict().Remove(item);
				}
			}
		}

		public static void Clear()
		{
			lock (_lockObject)
			{
				if (_dict.Count != 0)
				{
					GetWritableDict(clearDictionary: true).Clear();
				}
			}
		}

		internal static Dictionary<string, object> GetReadOnlyDict()
		{
			Dictionary<string, object> dictionary = _dictReadOnly;
			if (dictionary == null)
			{
				lock (_lockObject)
				{
					dictionary = (_dictReadOnly = _dict);
				}
			}
			return dictionary;
		}

		private static Dictionary<string, object> GetWritableDict(bool clearDictionary = false)
		{
			if (_dictReadOnly != null)
			{
				_dict = CopyDictionaryOnWrite(clearDictionary);
				_dictReadOnly = null;
			}
			return _dict;
		}

		private static Dictionary<string, object> CopyDictionaryOnWrite(bool clearDictionary)
		{
			Dictionary<string, object> dictionary = new Dictionary<string, object>((!clearDictionary) ? (_dict.Count + 1) : 0, _dict.Comparer);
			if (!clearDictionary)
			{
				foreach (KeyValuePair<string, object> item in _dict)
				{
					dictionary[item.Key] = item.Value;
				}
			}
			return dictionary;
		}
	}
	[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
	public static class MappedDiagnosticsContext
	{
		[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
		public static IDisposable SetScoped(string item, string value)
		{
			return ScopeContext.PushProperty(item, value);
		}

		[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
		public static IDisposable SetScoped(string item, object value)
		{
			return ScopeContext.PushProperty(item, value);
		}

		[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
		public static void Set(string item, string value)
		{
			ScopeContext.SetMappedContextLegacy(item, value);
		}

		[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
		public static void Set(string item, object value)
		{
			ScopeContext.SetMappedContextLegacy(item, value);
		}

		[Obsolete("Replaced by ScopeContext.TryGetProperty. Marked obsolete on NLog 5.0")]
		public static string Get(string item)
		{
			return Get(item, null);
		}

		[Obsolete("Replaced by ScopeContext.TryGetProperty. Marked obsolete on NLog 5.0")]
		public static string Get(string item, IFormatProvider formatProvider)
		{
			return FormatHelper.ConvertToString(GetObject(item), formatProvider);
		}

		[Obsolete("Replaced by ScopeContext.TryGetProperty. Marked obsolete on NLog 5.0")]
		public static object GetObject(string item)
		{
			if (ScopeContext.TryGetProperty(item, out var value))
			{
				return value;
			}
			return null;
		}

		[Obsolete("Replaced by ScopeContext.GetAllProperties. Marked obsolete on NLog 5.0")]
		public static ICollection<string> GetNames()
		{
			return ScopeContext.GetKeysMappedContextLegacy();
		}

		[Obsolete("Replaced by ScopeContext.TryGetProperty. Marked obsolete on NLog 5.0")]
		public static bool Contains(string item)
		{
			object value;
			return ScopeContext.TryGetProperty(item, out value);
		}

		[Obsolete("Replaced by dispose of return value from ScopeContext.PushProperty. Marked obsolete on NLog 5.0")]
		public static void Remove(string item)
		{
			ScopeContext.RemoveMappedContextLegacy(item);
		}

		[Obsolete("Replaced by ScopeContext.Clear(). Marked obsolete on NLog 5.0")]
		public static void Clear()
		{
			ScopeContext.ClearMappedContextLegacy();
		}
	}
	[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
	public static class MappedDiagnosticsLogicalContext
	{
		[Obsolete("Replaced by ScopeContext.TryGetProperty. Marked obsolete on NLog 5.0")]
		public static string Get(string item)
		{
			return Get(item, null);
		}

		[Obsolete("Replaced by ScopeContext.TryGetProperty. Marked obsolete on NLog 5.0")]
		public static string Get(string item, IFormatProvider formatProvider)
		{
			return FormatHelper.ConvertToString(GetObject(item), formatProvider);
		}

		[Obsolete("Replaced by ScopeContext.TryGetProperty. Marked obsolete on NLog 5.0")]
		public static object GetObject(string item)
		{
			if (ScopeContext.TryGetProperty(item, out var value))
			{
				return value;
			}
			return null;
		}

		[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
		public static IDisposable SetScoped(string item, string value)
		{
			return MappedDiagnosticsLogicalContext.SetScoped<string>(item, value);
		}

		[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
		public static IDisposable SetScoped(string item, object value)
		{
			return MappedDiagnosticsLogicalContext.SetScoped<object>(item, value);
		}

		[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
		public static IDisposable SetScoped<T>(string item, T value)
		{
			return ScopeContext.PushProperty(item, value);
		}

		[Obsolete("Replaced by ScopeContext.PushProperties or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
		public static IDisposable SetScoped(IReadOnlyList<KeyValuePair<string, object>> items)
		{
			return ScopeContext.PushProperties(items);
		}

		[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
		public static void Set(string item, string value)
		{
			MappedDiagnosticsLogicalContext.Set<string>(item, value);
		}

		[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
		public static void Set(string item, object value)
		{
			MappedDiagnosticsLogicalContext.Set<object>(item, value);
		}

		[Obsolete("Replaced by ScopeContext.PushProperty or Logger.PushScopeProperty using ${scopeproperty}. Marked obsolete on NLog 5.0")]
		public static void Set<T>(string item, T value)
		{
			ScopeContext.SetMappedContextLegacy(item, value);
		}

		[Obsolete("Replaced by ScopeContext.GetAllProperties. Marked obsolete on NLog 5.0")]
		public static ICollection<string> GetNames()
		{
			return ScopeContext.GetKeysMappedContextLegacy();
		}

		[Obsolete("Replaced by ScopeContext.TryGetProperty. Marked obsolete on NLog 5.0")]
		public static bool Contains(string item)
		{
			object value;
			return ScopeContext.TryGetProperty(item, out value);
		}

		[Obsolete("Replaced by dispose of return value from ScopeContext.PushProperty. Marked obsolete on NLog 5.0")]
		public static void Remove(string item)
		{
			ScopeContext.RemoveMappedContextLegacy(item);
		}

		[Obsolete("Replaced by ScopeContext.Clear(). Marked obsolete on NLog 5.0")]
		public static void Clear()
		{
			Clear(free: true);
		}

		[Obsolete("Replaced by ScopeContext.Clear(). Marked obsolete on NLog 5.0")]
		public static void Clear(bool free)
		{
			ScopeContext.ClearMappedContextLegacy();
		}
	}
	[Obsolete("Replaced by ScopeContext.PushNestedState or Logger.PushScopeNested using ${scopenested}. Marked obsolete on NLog 5.0")]
	public static class NestedDiagnosticsContext
	{
		[Obsolete("Replaced by ScopeContext.PeekNestedState. Marked obsolete on NLog 5.0")]
		public static string TopMessage => FormatHelper.ConvertToString(TopObject, null);

		[Obsolete("Replaced by ScopeContext.PeekNestedState. Marked obsolete on NLog 5.0")]
		public static object TopObject => PeekObject();

		[Obsolete("Replaced by ScopeContext.PushNestedState or Logger.PushScopeNested using ${scopenested}. Marked obsolete on NLog 5.0")]
		public static IDisposable Push(string text)
		{
			return ScopeContext.PushNestedState(text);
		}

		[Obsolete("Replaced by ScopeContext.PushNestedState or Logger.PushScopeNested using ${scopenested}. Marked obsolete on NLog 5.0")]
		public static IDisposable Push(object value)
		{
			return ScopeContext.PushNestedState(value);
		}

		[Obsolete("Replaced by dispose of return value from ScopeContext.PushNestedState or Logger.PushScopeNested. Marked obsolete on NLog 5.0")]
		public static string Pop()
		{
			return Pop(null);
		}

		[Obsolete("Replaced by dispose of return value from ScopeContext.PushNestedState or Logger.PushScopeNested. Marked obsolete on NLog 5.0")]
		public static string Pop(IFormatProvider formatProvider)
		{
			return FormatHelper.ConvertToString(PopObject() ?? string.Empty, formatProvider);
		}

		[Obsolete("Replaced by dispose of return value from ScopeContext.PushNestedState or Logger.PushScopeNested. Marked obsolete on NLog 5.0")]
		public static object PopObject()
		{
			return ScopeContext.PopNestedContextLegacy();
		}

		[Obsolete("Replaced by ScopeContext.PeekNestedState. Marked obsolete on NLog 5.0")]
		public static object PeekObject()
		{
			return ScopeContext.PeekNestedState();
		}

		[Obsolete("Replaced by ScopeContext.Clear. Marked obsolete on NLog 5.0")]
		public static void Clear()
		{
			ScopeContext.ClearNestedContextLegacy();
		}

		[Obsolete("Replaced by ScopeContext.GetAllNestedStates. Marked obsolete on NLog 5.0")]
		public static string[] GetAllMessages()
		{
			return GetAllMessages(null);
		}

		[Obsolete("Replaced by ScopeContext.GetAllNestedStates. Marked obsolete on NLog 5.0")]
		public static string[] GetAllMessages(IFormatProvider formatProvider)
		{
			object[] allObjects = GetAllObjects();
			if (allObjects.Length == 0)
			{
				return ArrayHelper.Empty<string>();
			}
			return allObjects.Select((object o) => FormatHelper.ConvertToString(o, formatProvider)).ToArray();
		}

		[Obsolete("Replaced by ScopeContext.GetAllNestedStates. Marked obsolete on NLog 5.0")]
		public static object[] GetAllObjects()
		{
			return ScopeContext.GetAllNestedStates();
		}
	}
	[Obsolete("Replaced by ScopeContext.PushNestedState or Logger.PushScopeNested using ${scopenested}. Marked obsolete on NLog 5.0")]
	public static class NestedDiagnosticsLogicalContext
	{
		[Obsolete("Required to be compatible with legacy NLog versions, when using remoting. Marked obsolete on NLog 5.0")]
		private interface INestedContext : IDisposable
		{
			INestedContext Parent { get; }

			int FrameLevel { get; }

			object Value { get; }

			long CreatedTimeUtcTicks { get; }
		}

		[Serializable]
		[Obsolete("Required to be compatible with legacy NLog versions, when using remoting. Marked obsolete on NLog 5.0")]
		private sealed class NestedContext<T> : INestedContext, IDisposable
		{
			private int _disposed;

			public INestedContext Parent { get; }

			public T Value { get; }

			public long CreatedTimeUtcTicks { get; }

			public int FrameLevel { get; }

			object INestedContext.Value => Value;

			public NestedContext(INestedContext parent, T value)
			{
				Parent = parent;
				Value = value;
				CreatedTimeUtcTicks = DateTime.UtcNow.Ticks;
				FrameLevel = ((parent == null) ? 1 : (parent.FrameLevel + 1));
			}

			void IDisposable.Dispose()
			{
				if (Interlocked.Exchange(ref _disposed, 1) != 1)
				{
					PopObject();
				}
			}

			public override string ToString()
			{
				return ((object)Value)?.ToString() ?? "null";
			}
		}

		[Obsolete("Replaced by ScopeContext.PushNestedState or Logger.PushScopeNested using ${scopenested}. Marked obsolete on NLog 5.0")]
		public static IDisposable Push<T>(T value)
		{
			return ScopeContext.PushNestedState(value);
		}

		[Obsolete("Replaced by ScopeContext.PushNestedState or Logger.PushScopeNested using ${scopenested}. Marked obsolete on NLog 5.0")]
		public static IDisposable PushObject(object value)
		{
			return Push(value);
		}

		[Obsolete("Replaced by dispose of return value from ScopeContext.PushNestedState or Logger.PushScopeNested. Marked obsolete on NLog 5.0")]
		public static object Pop()
		{
			return PopObject();
		}

		[Obsolete("Replaced by dispose of return value from ScopeContext.PushNestedState or Logger.PushScopeNested. Marked obsolete on NLog 5.0")]
		public static string Pop(IFormatProvider formatProvider)
		{
			return FormatHelper.ConvertToString(PopObject() ?? string.Empty, formatProvider);
		}

		[Obsolete("Replaced by dispose of return value from ScopeContext.PushNestedState or Logger.PushScopeNested. Marked obsolete on NLog 5.0")]
		public static object PopObject()
		{
			return ScopeContext.PopNestedContextLegacy();
		}

		[Obsolete("Replaced by ScopeContext.PeekNestedState. Marked obsolete on NLog 5.0")]
		public static object PeekObject()
		{
			return ScopeContext.PeekNestedState();
		}

		[Obsolete("Replaced by ScopeContext.Clear. Marked obsolete on NLog 5.0")]
		public static void Clear()
		{
			ScopeContext.ClearNestedContextLegacy();
		}

		[Obsolete("Replaced by ScopeContext.GetAllNestedStates. Marked obsolete on NLog 5.0")]
		public static string[] GetAllMessages()
		{
			return GetAllMessages(null);
		}

		[Obsolete("Replaced by ScopeContext.GetAllNestedStates. Marked obsolete on NLog 5.0")]
		public static string[] GetAllMessages(IFormatProvider formatProvider)
		{
			return (from o in GetAllObjects()
				select FormatHelper.ConvertToString(o, formatProvider)).ToArray();
		}

		[Obsolete("Replaced by ScopeContext.GetAllNestedStates. Marked obsolete on NLog 5.0")]
		public static object[] GetAllObjects()
		{
			return ScopeContext.GetAllNestedStates();
		}
	}
	public static class ScopeContext
	{
		private sealed class ScopeContextPropertiesCollapsed : IDisposable
		{
			private readonly IScopeContextAsyncState _parent;

			private readonly IScopeContextPropertiesAsyncState _collapsed;

			private bool _disposed;

			public ScopeContextPropertiesCollapsed(IScopeContextAsyncState parent, IScopeContextPropertiesAsyncState collapsed)
			{
				_parent = parent;
				_collapsed = collapsed;
			}

			public static Dictionary<string, object> BuildCollapsedDictionary(IScopeContextAsyncState parent, int initialCapacity)
			{
				if (parent is IScopeContextPropertiesAsyncState scopeContextPropertiesAsyncState && scopeContextPropertiesAsyncState.Parent is IScopeContextPropertiesAsyncState scopeContextPropertiesAsyncState2 && scopeContextPropertiesAsyncState.NestedState == null && scopeContextPropertiesAsyncState2.NestedState == null)
				{
					List<KeyValuePair<string, object>> list = new List<KeyValuePair<string, object>>();
					IReadOnlyCollection<KeyValuePair<string, object>> readOnlyCollection = new ScopeContextPropertyCollector(list).StartCaptureProperties(parent);
					if (list.Count > 0 && readOnlyCollection is Dictionary<string, object> result)
					{
						return result;
					}
					Dictionary<string, object> dictionary = new Dictionary<string, object>(readOnlyCollection.Count + initialCapacity, DefaultComparer);
					ScopeContextPropertyEnumerator<object>.CopyScopePropertiesToDictionary(readOnlyCollection, dictionary);
					return dictionary;
				}
				return null;
			}

			public void Dispose()
			{
				if (!_disposed)
				{
					_disposed = true;
					SetAsyncLocalContext(_parent);
				}
			}

			public override string ToString()
			{
				return _collapsed.ToString();
			}
		}

		internal static readonly IEqualityComparer<string> DefaultComparer = StringComparer.OrdinalIgnoreCase;

		private static readonly AsyncLocal<IScopeContextAsyncState> AsyncNestedDiagnosticsContext = new AsyncLocal<IScopeContextAsyncState>();

		public static IDisposable PushNestedStateProperties(object nestedState, IReadOnlyCollection<KeyValuePair<string, object>> properties)
		{
			properties = (IReadOnlyCollection<KeyValuePair<string, object>>)(((object)properties) ?? ((object)ArrayHelper.Empty<KeyValuePair<string, object>>()));
			if (properties.Count > 0 || nestedState == null)
			{
				IScopeContextAsyncState asyncLocalContext = GetAsyncLocalContext();
				if (nestedState == null)
				{
					Dictionary<string, object> dictionary = ScopeContextPropertiesCollapsed.BuildCollapsedDictionary(asyncLocalContext, properties.Count);
					if (dictionary != null)
					{
						ScopeContextPropertyEnumerator<object>.CopyScopePropertiesToDictionary(properties, dictionary);
						ScopeContextPropertiesAsyncState<object> scopeContextPropertiesAsyncState = new ScopeContextPropertiesAsyncState<object>(asyncLocalContext.Parent.Parent, dictionary, nestedState);
						SetAsyncLocalContext(scopeContextPropertiesAsyncState);
						return new ScopeContextPropertiesCollapsed(asyncLocalContext, scopeContextPropertiesAsyncState);
					}
				}
				ScopeContextPropertiesAsyncState<object> scopeContextPropertiesAsyncState2 = new ScopeContextPropertiesAsyncState<object>(asyncLocalContext, properties, nestedState);
				SetAsyncLocalContext(scopeContextPropertiesAsyncState2);
				return scopeContextPropertiesAsyncState2;
			}
			return PushNestedState(nestedState);
		}

		public static IDisposable PushProperties(IReadOnlyCollection<KeyValuePair<string, object>> properties)
		{
			return ScopeContext.PushProperties<object>(properties);
		}

		public static IDisposable PushProperties<TValue>(IReadOnlyCollection<KeyValuePair<string, TValue>> properties)
		{
			IScopeContextAsyncState asyncLocalContext = GetAsyncLocalContext();
			Dictionary<string, object> dictionary = ScopeContextPropertiesCollapsed.BuildCollapsedDictionary(asyncLocalContext, properties.Count);
			if (dictionary != null)
			{
				ScopeContextPropertyEnumerator<TValue>.CopyScopePropertiesToDictionary(properties, dictionary);
				ScopeContextPropertiesAsyncState<object> scopeContextPropertiesAsyncState = new ScopeContextPropertiesAsyncState<object>(asyncLocalContext.Parent.Parent, dictionary);
				SetAsyncLocalContext(scopeContextPropertiesAsyncState);
				return new ScopeContextPropertiesCollapsed(asyncLocalContext, scopeContextPropertiesAsyncState);
			}
			ScopeContextPropertiesAsyncState<TValue> scopeContextPropertiesAsyncState2 = new ScopeContextPropertiesAsyncState<TValue>(asyncLocalContext, properties);
			SetAsyncLocalContext(scopeContextPropertiesAsyncState2);
			return scopeContextPropertiesAsyncState2;
		}

		public static IDisposable PushProperty<TValue>(string key, TValue value)
		{
			IScopeContextAsyncState asyncLocalContext = GetAsyncLocalContext();
			Dictionary<string, object> dictionary = ScopeContextPropertiesCollapsed.BuildCollapsedDictionary(asyncLocalContext, 1);
			if (dictionary != null)
			{
				dictionary[key] = value;
				ScopeContextPropertiesAsyncState<object> scopeContextPropertiesAsyncState = new ScopeContextPropertiesAsyncState<object>(asyncLocalContext.Parent.Parent, dictionary);
				SetAsyncLocalContext(scopeContextPropertiesAsyncState);
				return new ScopeContextPropertiesCollapsed(asyncLocalContext, scopeContextPropertiesAsyncState);
			}
			ScopeContextPropertyAsyncState<TValue> scopeContextPropertyAsyncState = new ScopeContextPropertyAsyncState<TValue>(asyncLocalContext, key, value);
			SetAsyncLocalContext(scopeContextPropertyAsyncState);
			return scopeContextPropertyAsyncState;
		}

		public static IDisposable PushProperty(string key, object value)
		{
			return ScopeContext.PushProperty<object>(key, value);
		}

		public static IDisposable PushNestedState<T>(T nestedState)
		{
			ScopedContextNestedAsyncState<T> scopedContextNestedAsyncState = new ScopedContextNestedAsyncState<T>(GetAsyncLocalContext(), nestedState);
			SetAsyncLocalContext(scopedContextNestedAsyncState);
			return scopedContextNestedAsyncState;
		}

		public static IDisposable PushNestedState(object nestedState)
		{
			return ScopeContext.PushNestedState<object>(nestedState);
		}

		public static void Clear()
		{
			SetAsyncLocalContext(null);
		}

		public static IEnumerable<KeyValuePair<string, object>> GetAllProperties()
		{
			IScopeContextAsyncState asyncLocalContext = GetAsyncLocalContext();
			ScopeContextPropertyCollector contextCollector = default(ScopeContextPropertyCollector);
			return (IEnumerable<KeyValuePair<string, object>>)(((object)asyncLocalContext?.CaptureContextProperties(ref contextCollector)) ?? ((object)ArrayHelper.Empty<KeyValuePair<string, object>>()));
		}

		internal static ScopeContextPropertyEnumerator<object> GetAllPropertiesEnumerator()
		{
			return new ScopeContextPropertyEnumerator<object>(GetAllProperties());
		}

		public static bool TryGetProperty(string key, out object value)
		{
			IScopeContextAsyncState asyncLocalContext = GetAsyncLocalContext();
			if (asyncLocalContext != null)
			{
				ScopeContextPropertyCollector contextCollector = default(ScopeContextPropertyCollector);
				IReadOnlyCollection<KeyValuePair<string, object>> readOnlyCollection = asyncLocalContext?.CaptureContextProperties(ref contextCollector);
				if (readOnlyCollection != null && readOnlyCollection.Count > 0)
				{
					return TryLookupProperty(readOnlyCollection, key, out value);
				}
			}
			value = null;
			return false;
		}

		public static object[] GetAllNestedStates()
		{
			IList<object> allNestedStateList = GetAllNestedStateList();
			if (allNestedStateList != null && allNestedStateList.Count > 0)
			{
				if (allNestedStateList is object[] result)
				{
					return result;
				}
				return allNestedStateList.ToArray();
			}
			return ArrayHelper.Empty<object>();
		}

		internal static IList<object> GetAllNestedStateList()
		{
			IScopeContextAsyncState asyncLocalContext = GetAsyncLocalContext();
			ScopeContextNestedStateCollector contextCollector = default(ScopeContextNestedStateCollector);
			return asyncLocalContext?.CaptureNestedContext(ref contextCollector) ?? ArrayHelper.Empty<object>();
		}

		public static object PeekNestedState()
		{
			for (IScopeContextAsyncState scopeContextAsyncState = GetAsyncLocalContext(); scopeContextAsyncState != null; scopeContextAsyncState = scopeContextAsyncState.Parent)
			{
				object nestedState = scopeContextAsyncState.NestedState;
				if (nestedState != null)
				{
					return nestedState;
				}
			}
			return null;
		}

		internal static TimeSpan? PeekInnerNestedDuration()
		{
			long nestedContextTimestampNow = GetNestedContextTimestampNow();
			for (IScopeContextAsyncState scopeContextAsyncState = GetAsyncLocalContext(); scopeContextAsyncState != null; scopeContextAsyncState = scopeContextAsyncState.Parent)
			{
				long nestedStateTimestamp = scopeContextAsyncState.NestedStateTimestamp;
				if (nestedStateTimestamp != 0L)
				{
					return GetNestedStateDuration(nestedStateTimestamp, nestedContextTimestampNow);
				}
			}
			return null;
		}

		internal static TimeSpan? PeekOuterNestedDuration()
		{
			long nestedContextTimestampNow = GetNestedContextTimestampNow();
			IScopeContextAsyncState scopeContextAsyncState = GetAsyncLocalContext();
			long num = 0L;
			while (scopeContextAsyncState != null)
			{
				if (scopeContextAsyncState.NestedStateTimestamp != 0L)
				{
					num = scopeContextAsyncState.NestedStateTimestamp;
				}
				scopeContextAsyncState = scopeContextAsyncState.Parent;
			}
			if (num != 0L)
			{
				return GetNestedStateDuration(num, nestedContextTimestampNow);
			}
			return null;
		}

		private static bool TryLookupProperty(IReadOnlyCollection<KeyValuePair<string, object>> scopeProperties, string key, out object value)
		{
			if (scopeProperties is Dictionary<string, object> dictionary && dictionary.Comparer == DefaultComparer)
			{
				return dictionary.TryGetValue(key, out value);
			}
			using (ScopeContextPropertyEnumerator<object> scopeContextPropertyEnumerator = new ScopeContextPropertyEnumerator<object>(scopeProperties))
			{
				while (scopeContextPropertyEnumerator.MoveNext())
				{
					KeyValuePair<string, object> current = scopeContextPropertyEnumerator.Current;
					if (DefaultComparer.Equals(current.Key, key))
					{
						value = current.Value;
						return true;
					}
				}
			}
			value = null;
			return false;
		}

		internal static long GetNestedContextTimestampNow()
		{
			if (Stopwatch.IsHighResolution)
			{
				return Stopwatch.GetTimestamp();
			}
			return Environment.TickCount;
		}

		private static TimeSpan GetNestedStateDuration(long scopeTimestamp, long currentTimestamp)
		{
			if (Stopwatch.IsHighResolution)
			{
				return TimeSpan.FromTicks((currentTimestamp - scopeTimestamp) * 10000000 / Stopwatch.Frequency);
			}
			return TimeSpan.FromMilliseconds((int)currentTimestamp - (int)scopeTimestamp);
		}

		internal static void SetAsyncLocalContext(IScopeContextAsyncState newValue)
		{
			AsyncNestedDiagnosticsContext.Value = newValue;
		}

		private static IScopeContextAsyncState GetAsyncLocalContext()
		{
			return AsyncNestedDiagnosticsContext.Value;
		}

		[Obsolete("Replaced

Semver.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.CodeAnalysis;
using Semver.Comparers;
using Semver.Parsing;
using Semver.Ranges;
using Semver.Utility;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: ComVisible(false)]
[assembly: Guid("e208ca67-5b59-45d9-a29a-7f30137d3beb")]
[assembly: InternalsVisibleTo("Semver.Test")]
[assembly: InternalsVisibleTo("Semver.Benchmarks")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Max Hauser, Jeff Walker")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2013 Max Hauser, Jeff Walker")]
[assembly: AssemblyDescription("A SemVer implementation in .Net based on v2.0.0 of the spec found at http://semver.org")]
[assembly: AssemblyFileVersion("2.3.0.0")]
[assembly: AssemblyInformationalVersion("2.3.0+4585eb638d.4585eb638dc44c643649a8ded397307c0169b4ce")]
[assembly: AssemblyProduct("Semver")]
[assembly: AssemblyTitle("Semantic versioning")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/maxhauser/semver.git")]
[assembly: AssemblyVersion("2.1.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
}
namespace Semver
{
	public readonly struct MetadataIdentifier : IEquatable<MetadataIdentifier>, IComparable<MetadataIdentifier>, IComparable
	{
		public string Value { get; }

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete]
		internal static MetadataIdentifier CreateLoose(string value)
		{
			return new MetadataIdentifier(value, UnsafeOverload.Marker);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static MetadataIdentifier CreateUnsafe(string value)
		{
			return new MetadataIdentifier(value, UnsafeOverload.Marker);
		}

		private MetadataIdentifier(string value, UnsafeOverload _)
		{
			Value = value;
		}

		public MetadataIdentifier(string value)
			: this(value, "value")
		{
		}

		internal MetadataIdentifier(string value, string paramName)
		{
			if (value == null)
			{
				throw new ArgumentNullException(paramName);
			}
			if (value.Length == 0)
			{
				throw new ArgumentException("Metadata identifier cannot be empty.", paramName);
			}
			if (!value.IsAlphanumericOrHyphens())
			{
				throw new ArgumentException("A metadata identifier can contain only ASCII alphanumeric characters and hyphens '" + value + "'.", paramName);
			}
			Value = value;
		}

		public bool Equals(MetadataIdentifier value)
		{
			return Value == value.Value;
		}

		public override bool Equals(object value)
		{
			if (value is MetadataIdentifier value2)
			{
				return Equals(value2);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return CombinedHashCode.Create(Value);
		}

		public static bool operator ==(MetadataIdentifier left, MetadataIdentifier right)
		{
			return left.Value == right.Value;
		}

		public static bool operator !=(MetadataIdentifier left, MetadataIdentifier right)
		{
			return left.Value != right.Value;
		}

		public int CompareTo(MetadataIdentifier value)
		{
			return IdentifierString.Compare(Value, value.Value);
		}

		public int CompareTo(object value)
		{
			if (value == null)
			{
				return 1;
			}
			if (!(value is MetadataIdentifier metadataIdentifier))
			{
				throw new ArgumentException("Object must be of type MetadataIdentifier.", "value");
			}
			return IdentifierString.Compare(Value, metadataIdentifier.Value);
		}

		public static implicit operator string(MetadataIdentifier metadataIdentifier)
		{
			return metadataIdentifier.Value;
		}

		public override string ToString()
		{
			return Value;
		}
	}
	public readonly struct PrereleaseIdentifier : IEquatable<PrereleaseIdentifier>, IComparable<PrereleaseIdentifier>, IComparable
	{
		internal static readonly PrereleaseIdentifier Zero = CreateUnsafe("0", 0);

		internal static readonly PrereleaseIdentifier Hyphen = CreateUnsafe("-", null);

		public string Value { get; }

		public int? NumericValue { get; }

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete]
		internal static PrereleaseIdentifier CreateLoose(string value)
		{
			if (value.IsDigits() && int.TryParse(value, NumberStyles.None, CultureInfo.InvariantCulture, out var result))
			{
				return new PrereleaseIdentifier(value, result);
			}
			return new PrereleaseIdentifier(value, null);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static PrereleaseIdentifier CreateUnsafe(string value, int? numericValue)
		{
			return new PrereleaseIdentifier(value, numericValue);
		}

		private PrereleaseIdentifier(string value, int? numericValue)
		{
			Value = value;
			NumericValue = numericValue;
		}

		public PrereleaseIdentifier(string value, bool allowLeadingZeros = false)
			: this(value, allowLeadingZeros, "value")
		{
		}

		internal PrereleaseIdentifier(string value, bool allowLeadingZeros, string paramName)
		{
			if (value == null)
			{
				throw new ArgumentNullException(paramName);
			}
			if (value.Length == 0)
			{
				throw new ArgumentException("Prerelease identifier cannot be empty.", paramName);
			}
			if (value.IsDigits())
			{
				if (value.Length > 1 && value[0] == '0')
				{
					if (!allowLeadingZeros)
					{
						throw new ArgumentException("Leading zeros are not allowed on numeric prerelease identifiers '" + value + "'.", paramName);
					}
					value = value.TrimLeadingZeros();
				}
				try
				{
					NumericValue = int.Parse(value, NumberStyles.None, CultureInfo.InvariantCulture);
				}
				catch (OverflowException)
				{
					throw new OverflowException("Prerelease identifier '" + value + "' was too large for Int32.");
				}
			}
			else
			{
				if (!value.IsAlphanumericOrHyphens())
				{
					throw new ArgumentException("A prerelease identifier can contain only ASCII alphanumeric characters and hyphens '" + value + "'.", paramName);
				}
				NumericValue = null;
			}
			Value = value;
		}

		public PrereleaseIdentifier(int value)
		{
			if (value < 0)
			{
				throw new ArgumentOutOfRangeException("value", $"Numeric prerelease identifiers can't be negative: {value}.");
			}
			Value = value.ToString(CultureInfo.InvariantCulture);
			NumericValue = value;
		}

		public bool Equals(PrereleaseIdentifier value)
		{
			int? numericValue = NumericValue;
			if (numericValue.HasValue)
			{
				return numericValue.GetValueOrDefault() == value.NumericValue;
			}
			return Value == value.Value;
		}

		public override bool Equals(object value)
		{
			if (value is PrereleaseIdentifier value2)
			{
				return Equals(value2);
			}
			return false;
		}

		public override int GetHashCode()
		{
			int? numericValue = NumericValue;
			if (numericValue.HasValue)
			{
				int valueOrDefault = numericValue.GetValueOrDefault();
				return CombinedHashCode.Create(valueOrDefault);
			}
			return CombinedHashCode.Create(Value);
		}

		public static bool operator ==(PrereleaseIdentifier left, PrereleaseIdentifier right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(PrereleaseIdentifier left, PrereleaseIdentifier right)
		{
			return !left.Equals(right);
		}

		public int CompareTo(PrereleaseIdentifier value)
		{
			int? numericValue = NumericValue;
			if (numericValue.HasValue)
			{
				int valueOrDefault = numericValue.GetValueOrDefault();
				numericValue = value.NumericValue;
				if (numericValue.HasValue)
				{
					int valueOrDefault2 = numericValue.GetValueOrDefault();
					return valueOrDefault.CompareTo(valueOrDefault2);
				}
				return -1;
			}
			if (value.NumericValue.HasValue)
			{
				return 1;
			}
			return IdentifierString.Compare(Value, value.Value);
		}

		public int CompareTo(object value)
		{
			if (value == null)
			{
				return 1;
			}
			if (!(value is PrereleaseIdentifier value2))
			{
				throw new ArgumentException("Object must be of type PrereleaseIdentifier.", "value");
			}
			return CompareTo(value2);
		}

		public static implicit operator string(PrereleaseIdentifier prereleaseIdentifier)
		{
			return prereleaseIdentifier.Value;
		}

		public override string ToString()
		{
			return Value;
		}

		internal PrereleaseIdentifier NextIdentifier()
		{
			int? numericValue = NumericValue;
			if (numericValue.HasValue)
			{
				int valueOrDefault = numericValue.GetValueOrDefault();
				if (valueOrDefault != int.MaxValue)
				{
					return new PrereleaseIdentifier(valueOrDefault + 1);
				}
				return Hyphen;
			}
			return new PrereleaseIdentifier(Value + "-");
		}
	}
	[Serializable]
	public sealed class SemVersion : IComparable<SemVersion>, IComparable, IEquatable<SemVersion>, ISerializable
	{
		internal static readonly SemVersion Min = new SemVersion(0, 0, 0, new PrereleaseIdentifier[1]
		{
			new PrereleaseIdentifier(0)
		});

		internal static readonly SemVersion MinRelease = new SemVersion(0, 0, 0);

		internal static readonly SemVersion Max = new SemVersion(int.MaxValue, int.MaxValue, int.MaxValue);

		internal const string InvalidSemVersionStylesMessage = "An invalid SemVersionStyles value was used.";

		private const string InvalidMajorVersionMessage = "Major version must be greater than or equal to zero.";

		private const string InvalidMinorVersionMessage = "Minor version must be greater than or equal to zero.";

		private const string InvalidPatchVersionMessage = "Patch version must be greater than or equal to zero.";

		private const string PrereleaseIdentifierIsDefaultMessage = "Prerelease identifier cannot be default/null.";

		private const string MetadataIdentifierIsDefaultMessage = "Metadata identifier cannot be default/null.";

		internal const int MaxVersionLength = 1024;

		private static readonly Regex ParseRegex = new Regex("^(?<major>\\d+)(?>\\.(?<minor>\\d+))?(?>\\.(?<patch>\\d+))?(?>\\-(?<pre>[0-9A-Za-z\\-\\.]+))?(?>\\+(?<metadata>[0-9A-Za-z\\-\\.]+))?$", RegexOptions.ExplicitCapture | RegexOptions.Compiled | RegexOptions.CultureInvariant, TimeSpan.FromSeconds(0.5));

		public int Major { get; }

		public int Minor { get; }

		public int Patch { get; }

		public string Prerelease { get; }

		public IReadOnlyList<PrereleaseIdentifier> PrereleaseIdentifiers { get; }

		internal bool PrereleaseIsZero
		{
			get
			{
				if (PrereleaseIdentifiers.Count == 1)
				{
					return PrereleaseIdentifiers[0] == PrereleaseIdentifier.Zero;
				}
				return false;
			}
		}

		public bool IsPrerelease => Prerelease.Length != 0;

		public bool IsRelease => Prerelease.Length == 0;

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This property is obsolete. Use Metadata instead.")]
		public string Build => Metadata;

		public string Metadata { get; }

		public IReadOnlyList<MetadataIdentifier> MetadataIdentifiers { get; }

		public static ISemVersionComparer PrecedenceComparer { get; } = Semver.Comparers.PrecedenceComparer.Instance;


		public static ISemVersionComparer SortOrderComparer { get; } = Semver.Comparers.SortOrderComparer.Instance;


		private SemVersion(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			SemVersion semVersion = Parse(info.GetString("SemVersion"), strict: true);
			Major = semVersion.Major;
			Minor = semVersion.Minor;
			Patch = semVersion.Patch;
			Prerelease = semVersion.Prerelease;
			PrereleaseIdentifiers = semVersion.PrereleaseIdentifiers;
			Metadata = semVersion.Metadata;
			MetadataIdentifiers = semVersion.MetadataIdentifiers;
		}

		[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
		public void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			info.AddValue("SemVersion", ToString());
		}

		public SemVersion(int major)
		{
			Major = major;
			Minor = 0;
			Patch = 0;
			Prerelease = "";
			PrereleaseIdentifiers = ReadOnlyList<PrereleaseIdentifier>.Empty;
			Metadata = "";
			MetadataIdentifiers = ReadOnlyList<MetadataIdentifier>.Empty;
		}

		public SemVersion(int major, int minor)
		{
			Major = major;
			Minor = minor;
			Patch = 0;
			Prerelease = "";
			PrereleaseIdentifiers = ReadOnlyList<PrereleaseIdentifier>.Empty;
			Metadata = "";
			MetadataIdentifiers = ReadOnlyList<MetadataIdentifier>.Empty;
		}

		public SemVersion(int major, int minor, int patch)
		{
			Major = major;
			Minor = minor;
			Patch = patch;
			Prerelease = "";
			PrereleaseIdentifiers = ReadOnlyList<PrereleaseIdentifier>.Empty;
			Metadata = "";
			MetadataIdentifiers = ReadOnlyList<MetadataIdentifier>.Empty;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This constructor is obsolete. Use another constructor or SemVersion.ParsedFrom() instead.")]
		public SemVersion(int major, int minor = 0, int patch = 0, string prerelease = "", string build = "")
		{
			Major = major;
			Minor = minor;
			Patch = patch;
			prerelease = prerelease ?? "";
			Prerelease = prerelease;
			PrereleaseIdentifiers = prerelease.SplitAndMapToReadOnlyList('.', PrereleaseIdentifier.CreateLoose);
			build = build ?? "";
			Metadata = build;
			MetadataIdentifiers = build.SplitAndMapToReadOnlyList('.', MetadataIdentifier.CreateLoose);
		}

		public SemVersion(int major, int minor = 0, int patch = 0, IEnumerable<PrereleaseIdentifier> prerelease = null, IEnumerable<MetadataIdentifier> metadata = null)
		{
			if (major < 0)
			{
				throw new ArgumentOutOfRangeException("major", "Major version must be greater than or equal to zero.");
			}
			if (minor < 0)
			{
				throw new ArgumentOutOfRangeException("minor", "Minor version must be greater than or equal to zero.");
			}
			if (patch < 0)
			{
				throw new ArgumentOutOfRangeException("patch", "Patch version must be greater than or equal to zero.");
			}
			IReadOnlyList<PrereleaseIdentifier> readOnlyList;
			if (prerelease == null)
			{
				readOnlyList = null;
			}
			else
			{
				readOnlyList = prerelease.ToReadOnlyList();
				if (readOnlyList.Any((PrereleaseIdentifier i) => i == default(PrereleaseIdentifier)))
				{
					throw new ArgumentException("Prerelease identifier cannot be default/null.", "prerelease");
				}
			}
			IReadOnlyList<MetadataIdentifier> readOnlyList2;
			if (metadata == null)
			{
				readOnlyList2 = null;
			}
			else
			{
				readOnlyList2 = metadata.ToReadOnlyList();
				if (readOnlyList2.Any((MetadataIdentifier i) => i == default(MetadataIdentifier)))
				{
					throw new ArgumentException("Metadata identifier cannot be default/null.", "metadata");
				}
			}
			Major = major;
			Minor = minor;
			Patch = patch;
			if (readOnlyList == null || readOnlyList.Count == 0)
			{
				Prerelease = "";
				PrereleaseIdentifiers = ReadOnlyList<PrereleaseIdentifier>.Empty;
			}
			else
			{
				Prerelease = string.Join(".", readOnlyList);
				PrereleaseIdentifiers = readOnlyList;
			}
			if (readOnlyList2 == null || readOnlyList2.Count == 0)
			{
				Metadata = "";
				MetadataIdentifiers = ReadOnlyList<MetadataIdentifier>.Empty;
			}
			else
			{
				Metadata = string.Join(".", readOnlyList2);
				MetadataIdentifiers = readOnlyList2;
			}
		}

		public SemVersion(int major, int minor = 0, int patch = 0, IEnumerable<string> prerelease = null, IEnumerable<string> metadata = null)
		{
			if (major < 0)
			{
				throw new ArgumentOutOfRangeException("major", "Major version must be greater than or equal to zero.");
			}
			if (minor < 0)
			{
				throw new ArgumentOutOfRangeException("minor", "Minor version must be greater than or equal to zero.");
			}
			if (patch < 0)
			{
				throw new ArgumentOutOfRangeException("patch", "Patch version must be greater than or equal to zero.");
			}
			IReadOnlyList<PrereleaseIdentifier> readOnlyList = prerelease?.Select((string i) => new PrereleaseIdentifier(i, allowLeadingZeros: false, "prerelease")).ToReadOnlyList();
			IReadOnlyList<MetadataIdentifier> readOnlyList2 = metadata?.Select((string i) => new MetadataIdentifier(i, "metadata")).ToReadOnlyList();
			Major = major;
			Minor = minor;
			Patch = patch;
			if (readOnlyList == null || readOnlyList.Count == 0)
			{
				Prerelease = "";
				PrereleaseIdentifiers = ReadOnlyList<PrereleaseIdentifier>.Empty;
			}
			else
			{
				Prerelease = string.Join(".", readOnlyList);
				PrereleaseIdentifiers = readOnlyList;
			}
			if (readOnlyList2 == null || readOnlyList2.Count == 0)
			{
				Metadata = "";
				MetadataIdentifiers = ReadOnlyList<MetadataIdentifier>.Empty;
			}
			else
			{
				Metadata = string.Join(".", readOnlyList2);
				MetadataIdentifiers = readOnlyList2;
			}
		}

		public static SemVersion ParsedFrom(int major, int minor = 0, int patch = 0, string prerelease = "", string metadata = "", bool allowLeadingZeros = false)
		{
			if (major < 0)
			{
				throw new ArgumentOutOfRangeException("major", "Major version must be greater than or equal to zero.");
			}
			if (minor < 0)
			{
				throw new ArgumentOutOfRangeException("minor", "Minor version must be greater than or equal to zero.");
			}
			if (patch < 0)
			{
				throw new ArgumentOutOfRangeException("patch", "Patch version must be greater than or equal to zero.");
			}
			if (prerelease == null)
			{
				throw new ArgumentNullException("prerelease");
			}
			IReadOnlyList<PrereleaseIdentifier> readOnlyList = ((prerelease.Length == 0) ? ReadOnlyList<PrereleaseIdentifier>.Empty : prerelease.SplitAndMapToReadOnlyList('.', (string i) => new PrereleaseIdentifier(i, allowLeadingZeros, "prerelease")));
			if (allowLeadingZeros)
			{
				prerelease = string.Join(".", readOnlyList);
			}
			if (metadata == null)
			{
				throw new ArgumentNullException("metadata");
			}
			IReadOnlyList<MetadataIdentifier> metadataIdentifiers = ((metadata.Length == 0) ? ReadOnlyList<MetadataIdentifier>.Empty : metadata.SplitAndMapToReadOnlyList('.', (string i) => new MetadataIdentifier(i, "metadata")));
			return new SemVersion(major, minor, patch, prerelease, readOnlyList, metadata, metadataIdentifiers);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This constructor is obsolete. Use SemVersion.FromVersion() instead.")]
		public SemVersion(Version version)
		{
			if (version == null)
			{
				throw new ArgumentNullException("version");
			}
			Major = version.Major;
			Minor = version.Minor;
			if (version.Revision >= 0)
			{
				Patch = version.Revision;
			}
			Prerelease = "";
			PrereleaseIdentifiers = ReadOnlyList<PrereleaseIdentifier>.Empty;
			if (version.Build > 0)
			{
				Metadata = version.Build.ToString(CultureInfo.InvariantCulture);
				MetadataIdentifiers = new List<MetadataIdentifier>(1) { MetadataIdentifier.CreateUnsafe(Metadata) }.AsReadOnly();
			}
			else
			{
				Metadata = "";
				MetadataIdentifiers = ReadOnlyList<MetadataIdentifier>.Empty;
			}
		}

		internal SemVersion(int major, int minor, int patch, string prerelease, IReadOnlyList<PrereleaseIdentifier> prereleaseIdentifiers, string metadata, IReadOnlyList<MetadataIdentifier> metadataIdentifiers)
		{
			Major = major;
			Minor = minor;
			Patch = patch;
			Prerelease = prerelease;
			PrereleaseIdentifiers = prereleaseIdentifiers;
			Metadata = metadata;
			MetadataIdentifiers = metadataIdentifiers;
		}

		public static SemVersion FromVersion(Version version)
		{
			if ((object)version == null)
			{
				throw new ArgumentNullException("version");
			}
			if (version.Revision > 0)
			{
				throw new ArgumentException("Version with Revision number can't be converted to SemVer.", "version");
			}
			int patch = ((version.Build > 0) ? version.Build : 0);
			return new SemVersion(version.Major, version.Minor, patch);
		}

		public Version ToVersion()
		{
			if (Major < 0 || Minor < 0 || Patch < 0)
			{
				throw new InvalidOperationException("Negative version numbers can't be converted to System.Version.");
			}
			if (IsPrerelease)
			{
				throw new InvalidOperationException("Prerelease version can't be converted to System.Version.");
			}
			if (Metadata.Length != 0)
			{
				throw new InvalidOperationException("Version with build metadata can't be converted to System.Version.");
			}
			return new Version(Major, Minor, Patch);
		}

		public static SemVersion Parse(string version, SemVersionStyles style, int maxLength = 1024)
		{
			if (!style.IsValid())
			{
				throw new ArgumentException("An invalid SemVersionStyles value was used.", "style");
			}
			SemVersion semver;
			Exception ex = SemVersionParser.Parse(version, style, null, maxLength, out semver);
			if (ex != null)
			{
				throw ex;
			}
			return semver;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method is obsolete. Use Parse() overload with SemVersionStyles instead.")]
		public static SemVersion Parse(string version, bool strict = false)
		{
			Match match = ParseRegex.Match(version);
			if (!match.Success)
			{
				throw new ArgumentException("Invalid version '" + version + "'.", "version");
			}
			int major = int.Parse(match.Groups["major"].Value, CultureInfo.InvariantCulture);
			Group group = match.Groups["minor"];
			int minor = 0;
			if (group.Success)
			{
				minor = int.Parse(group.Value, CultureInfo.InvariantCulture);
			}
			else if (strict)
			{
				throw new InvalidOperationException("Invalid version (no minor version given in strict mode)");
			}
			Group group2 = match.Groups["patch"];
			int patch = 0;
			if (group2.Success)
			{
				patch = int.Parse(group2.Value, CultureInfo.InvariantCulture);
			}
			else if (strict)
			{
				throw new InvalidOperationException("Invalid version (no patch version given in strict mode)");
			}
			string value = match.Groups["pre"].Value;
			string value2 = match.Groups["metadata"].Value;
			return new SemVersion(major, minor, patch, value, value2);
		}

		public static bool TryParse(string version, SemVersionStyles style, out SemVersion semver, int maxLength = 1024)
		{
			if (!style.IsValid())
			{
				throw new ArgumentException("An invalid SemVersionStyles value was used.", "style");
			}
			return SemVersionParser.Parse(version, style, VersionParsing.FailedException, maxLength, out semver) == null;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method is obsolete. Use TryParse() overload with SemVersionStyles instead.")]
		public static bool TryParse(string version, out SemVersion semver, bool strict = false)
		{
			semver = null;
			if (version == null)
			{
				return false;
			}
			Match match = ParseRegex.Match(version);
			if (!match.Success)
			{
				return false;
			}
			if (!int.TryParse(match.Groups["major"].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
			{
				return false;
			}
			Group group = match.Groups["minor"];
			int result2 = 0;
			if (group.Success)
			{
				if (!int.TryParse(group.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result2))
				{
					return false;
				}
			}
			else if (strict)
			{
				return false;
			}
			Group group2 = match.Groups["patch"];
			int result3 = 0;
			if (group2.Success)
			{
				if (!int.TryParse(group2.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result3))
				{
					return false;
				}
			}
			else if (strict)
			{
				return false;
			}
			string value = match.Groups["pre"].Value;
			string value2 = match.Groups["metadata"].Value;
			semver = new SemVersion(result, result2, result3, value, value2);
			return true;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method is obsolete. Use CompareSortOrder() or ComparePrecedence() instead.")]
		public static int Compare(SemVersion versionA, SemVersion versionB)
		{
			if ((object)versionA == versionB)
			{
				return 0;
			}
			if ((object)versionA == null)
			{
				return -1;
			}
			if ((object)versionB == null)
			{
				return 1;
			}
			return versionA.CompareTo(versionB);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method is obsolete. Use With() or With...() method instead.")]
		public SemVersion Change(int? major = null, int? minor = null, int? patch = null, string prerelease = null, string build = null)
		{
			return new SemVersion(major ?? Major, minor ?? Minor, patch ?? Patch, prerelease ?? Prerelease, build ?? Metadata);
		}

		public SemVersion With(int? major = null, int? minor = null, int? patch = null, IEnumerable<PrereleaseIdentifier> prerelease = null, IEnumerable<MetadataIdentifier> metadata = null)
		{
			if (major.HasValue)
			{
				int valueOrDefault = major.GetValueOrDefault();
				if (valueOrDefault < 0)
				{
					throw new ArgumentOutOfRangeException("major", "Major version must be greater than or equal to zero.");
				}
			}
			if (minor.HasValue)
			{
				int valueOrDefault2 = minor.GetValueOrDefault();
				if (valueOrDefault2 < 0)
				{
					throw new ArgumentOutOfRangeException("minor", "Minor version must be greater than or equal to zero.");
				}
			}
			if (patch.HasValue)
			{
				int valueOrDefault3 = patch.GetValueOrDefault();
				if (valueOrDefault3 < 0)
				{
					throw new ArgumentOutOfRangeException("patch", "Patch version must be greater than or equal to zero.");
				}
			}
			IReadOnlyList<PrereleaseIdentifier> readOnlyList = null;
			string text = null;
			if (prerelease != null)
			{
				readOnlyList = prerelease.ToReadOnlyList();
				if (readOnlyList.Count == 0)
				{
					readOnlyList = ReadOnlyList<PrereleaseIdentifier>.Empty;
					text = "";
				}
				else
				{
					if (readOnlyList.Any((PrereleaseIdentifier i) => i == default(PrereleaseIdentifier)))
					{
						throw new ArgumentException("Prerelease identifier cannot be default/null.", "prerelease");
					}
					text = string.Join(".", readOnlyList);
				}
			}
			IReadOnlyList<MetadataIdentifier> readOnlyList2 = null;
			string text2 = null;
			if (metadata != null)
			{
				readOnlyList2 = metadata.ToReadOnlyList();
				if (readOnlyList2.Count == 0)
				{
					readOnlyList2 = ReadOnlyList<MetadataIdentifier>.Empty;
					text2 = "";
				}
				else
				{
					if (readOnlyList2.Any((MetadataIdentifier i) => i == default(MetadataIdentifier)))
					{
						throw new ArgumentException("Metadata identifier cannot be default/null.", "metadata");
					}
					text2 = string.Join(".", readOnlyList2);
				}
			}
			return new SemVersion(major ?? Major, minor ?? Minor, patch ?? Patch, text ?? Prerelease, readOnlyList ?? PrereleaseIdentifiers, text2 ?? Metadata, readOnlyList2 ?? MetadataIdentifiers);
		}

		public SemVersion WithParsedFrom(int? major = null, int? minor = null, int? patch = null, string prerelease = null, string metadata = null, bool allowLeadingZeros = false)
		{
			if (major.HasValue)
			{
				int valueOrDefault = major.GetValueOrDefault();
				if (valueOrDefault < 0)
				{
					throw new ArgumentOutOfRangeException("major", "Major version must be greater than or equal to zero.");
				}
			}
			if (minor.HasValue)
			{
				int valueOrDefault2 = minor.GetValueOrDefault();
				if (valueOrDefault2 < 0)
				{
					throw new ArgumentOutOfRangeException("minor", "Minor version must be greater than or equal to zero.");
				}
			}
			if (patch.HasValue)
			{
				int valueOrDefault3 = patch.GetValueOrDefault();
				if (valueOrDefault3 < 0)
				{
					throw new ArgumentOutOfRangeException("patch", "Patch version must be greater than or equal to zero.");
				}
			}
			IReadOnlyList<PrereleaseIdentifier> readOnlyList = prerelease?.SplitAndMapToReadOnlyList('.', (string i) => new PrereleaseIdentifier(i, allowLeadingZeros, "prerelease"));
			IReadOnlyList<MetadataIdentifier> readOnlyList2 = metadata?.SplitAndMapToReadOnlyList('.', (string i) => new MetadataIdentifier(i, "metadata"));
			if (allowLeadingZeros && prerelease != null)
			{
				prerelease = string.Join(".", readOnlyList);
			}
			return new SemVersion(major ?? Major, minor ?? Minor, patch ?? Patch, prerelease ?? Prerelease, readOnlyList ?? PrereleaseIdentifiers, metadata ?? Metadata, readOnlyList2 ?? MetadataIdentifiers);
		}

		public SemVersion WithMajor(int major)
		{
			if (major < 0)
			{
				throw new ArgumentOutOfRangeException("major", "Major version must be greater than or equal to zero.");
			}
			if (Major == major)
			{
				return this;
			}
			return new SemVersion(major, Minor, Patch, Prerelease, PrereleaseIdentifiers, Metadata, MetadataIdentifiers);
		}

		public SemVersion WithMinor(int minor)
		{
			if (minor < 0)
			{
				throw new ArgumentOutOfRangeException("minor", "Minor version must be greater than or equal to zero.");
			}
			if (Minor == minor)
			{
				return this;
			}
			return new SemVersion(Major, minor, Patch, Prerelease, PrereleaseIdentifiers, Metadata, MetadataIdentifiers);
		}

		public SemVersion WithPatch(int patch)
		{
			if (patch < 0)
			{
				throw new ArgumentOutOfRangeException("patch", "Patch version must be greater than or equal to zero.");
			}
			if (Patch == patch)
			{
				return this;
			}
			return new SemVersion(Major, Minor, patch, Prerelease, PrereleaseIdentifiers, Metadata, MetadataIdentifiers);
		}

		public SemVersion WithPrereleaseParsedFrom(string prerelease, bool allowLeadingZeros = false)
		{
			if (prerelease == null)
			{
				throw new ArgumentNullException("prerelease");
			}
			if (prerelease.Length == 0)
			{
				return WithoutPrerelease();
			}
			IReadOnlyList<PrereleaseIdentifier> readOnlyList = prerelease.SplitAndMapToReadOnlyList('.', (string i) => new PrereleaseIdentifier(i, allowLeadingZeros, "prerelease"));
			if (allowLeadingZeros)
			{
				prerelease = string.Join(".", readOnlyList);
			}
			return new SemVersion(Major, Minor, Patch, prerelease, readOnlyList, Metadata, MetadataIdentifiers);
		}

		public SemVersion WithPrerelease(string prereleaseIdentifier, params string[] prereleaseIdentifiers)
		{
			if (prereleaseIdentifier == null)
			{
				throw new ArgumentNullException("prereleaseIdentifier");
			}
			if (prereleaseIdentifiers == null)
			{
				throw new ArgumentNullException("prereleaseIdentifiers");
			}
			IReadOnlyList<PrereleaseIdentifier> readOnlyList = (from i in prereleaseIdentifiers.Prepend(prereleaseIdentifier)
				select new PrereleaseIdentifier(i, allowLeadingZeros: false, "prereleaseIdentifiers")).ToReadOnlyList();
			return new SemVersion(Major, Minor, Patch, string.Join(".", readOnlyList), readOnlyList, Metadata, MetadataIdentifiers);
		}

		public SemVersion WithPrerelease(IEnumerable<string> prereleaseIdentifiers)
		{
			if (prereleaseIdentifiers == null)
			{
				throw new ArgumentNullException("prereleaseIdentifiers");
			}
			IReadOnlyList<PrereleaseIdentifier> readOnlyList = prereleaseIdentifiers.Select((string i) => new PrereleaseIdentifier(i, allowLeadingZeros: false, "prereleaseIdentifiers")).ToReadOnlyList();
			if (readOnlyList.Count == 0)
			{
				return WithoutPrerelease();
			}
			return new SemVersion(Major, Minor, Patch, string.Join(".", readOnlyList), readOnlyList, Metadata, MetadataIdentifiers);
		}

		public SemVersion WithPrerelease(PrereleaseIdentifier prereleaseIdentifier, params PrereleaseIdentifier[] prereleaseIdentifiers)
		{
			if (prereleaseIdentifiers == null)
			{
				throw new ArgumentNullException("prereleaseIdentifiers");
			}
			IReadOnlyList<PrereleaseIdentifier> readOnlyList = prereleaseIdentifiers.Prepend(prereleaseIdentifier).ToReadOnlyList();
			if (readOnlyList.Any((PrereleaseIdentifier i) => i == default(PrereleaseIdentifier)))
			{
				throw new ArgumentException("Prerelease identifier cannot be default/null.", "prereleaseIdentifiers");
			}
			return new SemVersion(Major, Minor, Patch, string.Join(".", readOnlyList), readOnlyList, Metadata, MetadataIdentifiers);
		}

		public SemVersion WithPrerelease(IEnumerable<PrereleaseIdentifier> prereleaseIdentifiers)
		{
			if (prereleaseIdentifiers == null)
			{
				throw new ArgumentNullException("prereleaseIdentifiers");
			}
			IReadOnlyList<PrereleaseIdentifier> readOnlyList = prereleaseIdentifiers.ToReadOnlyList();
			if (readOnlyList.Count == 0)
			{
				return WithoutPrerelease();
			}
			if (readOnlyList.Any((PrereleaseIdentifier i) => i == default(PrereleaseIdentifier)))
			{
				throw new ArgumentException("Prerelease identifier cannot be default/null.", "prereleaseIdentifiers");
			}
			return new SemVersion(Major, Minor, Patch, string.Join(".", readOnlyList), readOnlyList, Metadata, MetadataIdentifiers);
		}

		public SemVersion WithoutPrerelease()
		{
			if (!IsPrerelease)
			{
				return this;
			}
			return new SemVersion(Major, Minor, Patch, "", ReadOnlyList<PrereleaseIdentifier>.Empty, Metadata, MetadataIdentifiers);
		}

		public SemVersion WithMetadataParsedFrom(string metadata)
		{
			if (metadata == null)
			{
				throw new ArgumentNullException("metadata");
			}
			if (metadata.Length == 0)
			{
				return WithoutMetadata();
			}
			IReadOnlyList<MetadataIdentifier> metadataIdentifiers = metadata.SplitAndMapToReadOnlyList('.', (string i) => new MetadataIdentifier(i, "metadata"));
			return new SemVersion(Major, Minor, Patch, Prerelease, PrereleaseIdentifiers, metadata, metadataIdentifiers);
		}

		public SemVersion WithMetadata(string metadataIdentifier, params string[] metadataIdentifiers)
		{
			if (metadataIdentifier == null)
			{
				throw new ArgumentNullException("metadataIdentifiers");
			}
			if (metadataIdentifiers == null)
			{
				throw new ArgumentNullException("metadataIdentifiers");
			}
			IReadOnlyList<MetadataIdentifier> readOnlyList = (from i in metadataIdentifiers.Prepend(metadataIdentifier)
				select new MetadataIdentifier(i, "metadataIdentifiers")).ToReadOnlyList();
			return new SemVersion(Major, Minor, Patch, Prerelease, PrereleaseIdentifiers, string.Join(".", readOnlyList), readOnlyList);
		}

		public SemVersion WithMetadata(IEnumerable<string> metadataIdentifiers)
		{
			if (metadataIdentifiers == null)
			{
				throw new ArgumentNullException("metadataIdentifiers");
			}
			IReadOnlyList<MetadataIdentifier> readOnlyList = metadataIdentifiers.Select((string i) => new MetadataIdentifier(i, "metadataIdentifiers")).ToReadOnlyList();
			if (readOnlyList.Count == 0)
			{
				return WithoutMetadata();
			}
			return new SemVersion(Major, Minor, Patch, Prerelease, PrereleaseIdentifiers, string.Join(".", readOnlyList), readOnlyList);
		}

		public SemVersion WithMetadata(MetadataIdentifier metadataIdentifier, params MetadataIdentifier[] metadataIdentifiers)
		{
			if (metadataIdentifiers == null)
			{
				throw new ArgumentNullException("metadataIdentifiers");
			}
			IReadOnlyList<MetadataIdentifier> readOnlyList = metadataIdentifiers.Prepend(metadataIdentifier).ToReadOnlyList();
			if (readOnlyList.Any((MetadataIdentifier i) => i == default(MetadataIdentifier)))
			{
				throw new ArgumentException("Metadata identifier cannot be default/null.", "metadataIdentifiers");
			}
			return new SemVersion(Major, Minor, Patch, Prerelease, PrereleaseIdentifiers, string.Join(".", readOnlyList), readOnlyList);
		}

		public SemVersion WithMetadata(IEnumerable<MetadataIdentifier> metadataIdentifiers)
		{
			if (metadataIdentifiers == null)
			{
				throw new ArgumentNullException("metadataIdentifiers");
			}
			IReadOnlyList<MetadataIdentifier> readOnlyList = metadataIdentifiers.ToReadOnlyList();
			if (readOnlyList.Count == 0)
			{
				return WithoutMetadata();
			}
			if (readOnlyList.Any((MetadataIdentifier i) => i == default(MetadataIdentifier)))
			{
				throw new ArgumentException("Metadata identifier cannot be default/null.", "metadataIdentifiers");
			}
			return new SemVersion(Major, Minor, Patch, Prerelease, PrereleaseIdentifiers, string.Join(".", readOnlyList), readOnlyList);
		}

		public SemVersion WithoutMetadata()
		{
			if (MetadataIdentifiers.Count == 0)
			{
				return this;
			}
			return new SemVersion(Major, Minor, Patch, Prerelease, PrereleaseIdentifiers, "", ReadOnlyList<MetadataIdentifier>.Empty);
		}

		public SemVersion WithoutPrereleaseOrMetadata()
		{
			if (!IsPrerelease && MetadataIdentifiers.Count == 0)
			{
				return this;
			}
			return new SemVersion(Major, Minor, Patch, "", ReadOnlyList<PrereleaseIdentifier>.Empty, "", ReadOnlyList<MetadataIdentifier>.Empty);
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder(4 + Major.DecimalDigits() + Minor.DecimalDigits() + Patch.DecimalDigits() + Prerelease.Length + Metadata.Length);
			stringBuilder.Append(Major);
			stringBuilder.Append('.');
			stringBuilder.Append(Minor);
			stringBuilder.Append('.');
			stringBuilder.Append(Patch);
			if (Prerelease.Length > 0)
			{
				stringBuilder.Append('-');
				stringBuilder.Append(Prerelease);
			}
			if (Metadata.Length > 0)
			{
				stringBuilder.Append('+');
				stringBuilder.Append(Metadata);
			}
			return stringBuilder.ToString();
		}

		public static bool Equals(SemVersion versionA, SemVersion versionB)
		{
			if ((object)versionA == versionB)
			{
				return true;
			}
			if ((object)versionA == null || (object)versionB == null)
			{
				return false;
			}
			return versionA.Equals(versionB);
		}

		public override bool Equals(object obj)
		{
			if (obj is SemVersion other)
			{
				return Equals(other);
			}
			return false;
		}

		public bool Equals(SemVersion other)
		{
			if ((object)other == null)
			{
				return false;
			}
			if ((object)this == other)
			{
				return true;
			}
			if (Major == other.Major && Minor == other.Minor && Patch == other.Patch && string.Equals(Prerelease, other.Prerelease, StringComparison.Ordinal))
			{
				return string.Equals(Metadata, other.Metadata, StringComparison.Ordinal);
			}
			return false;
		}

		public bool PrecedenceEquals(SemVersion other)
		{
			return PrecedenceComparer.Compare(this, other) == 0;
		}

		public static bool PrecedenceEquals(SemVersion left, SemVersion right)
		{
			return PrecedenceComparer.Compare(left, right) == 0;
		}

		internal bool MajorMinorPatchEquals(SemVersion other)
		{
			if ((object)other == null)
			{
				return false;
			}
			if ((object)this == other)
			{
				return true;
			}
			if (Major == other.Major && Minor == other.Minor)
			{
				return Patch == other.Patch;
			}
			return false;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method is obsolete. Use PrecedenceEquals() instead.")]
		public bool PrecedenceMatches(SemVersion other)
		{
			return CompareByPrecedence(other) == 0;
		}

		public override int GetHashCode()
		{
			return CombinedHashCode.Create(Major, Minor, Patch, Prerelease, Metadata);
		}

		public static bool operator ==(SemVersion left, SemVersion right)
		{
			return Equals(left, right);
		}

		public static bool operator !=(SemVersion left, SemVersion right)
		{
			return !Equals(left, right);
		}

		public int ComparePrecedenceTo(SemVersion other)
		{
			return PrecedenceComparer.Compare(this, other);
		}

		public int CompareSortOrderTo(SemVersion other)
		{
			return SortOrderComparer.Compare(this, other);
		}

		public static int ComparePrecedence(SemVersion left, SemVersion right)
		{
			return PrecedenceComparer.Compare(left, right);
		}

		public static int CompareSortOrder(SemVersion left, SemVersion right)
		{
			return SortOrderComparer.Compare(left, right);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method is obsolete. Use CompareSortOrderTo() or ComparePrecedenceTo() instead.")]
		public int CompareTo(object obj)
		{
			return CompareTo((SemVersion)obj);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method is obsolete. Use CompareSortOrderTo() or ComparePrecedenceTo() instead.")]
		public int CompareTo(SemVersion other)
		{
			int num = CompareByPrecedence(other);
			if (num != 0)
			{
				return num;
			}
			return CompareComponents(Metadata, other.Metadata);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method is obsolete. Use ComparePrecedenceTo() or CompareSortOrderTo() instead.")]
		public int CompareByPrecedence(SemVersion other)
		{
			if ((object)other == null)
			{
				return 1;
			}
			int num = Major.CompareTo(other.Major);
			if (num != 0)
			{
				return num;
			}
			num = Minor.CompareTo(other.Minor);
			if (num != 0)
			{
				return num;
			}
			num = Patch.CompareTo(other.Patch);
			if (num != 0)
			{
				return num;
			}
			return CompareComponents(Prerelease, other.Prerelease, nonEmptyIsLower: true);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete]
		private static int CompareComponents(string a, string b, bool nonEmptyIsLower = false)
		{
			bool flag = string.IsNullOrEmpty(a);
			bool flag2 = string.IsNullOrEmpty(b);
			if (flag && flag2)
			{
				return 0;
			}
			if (flag)
			{
				if (!nonEmptyIsLower)
				{
					return -1;
				}
				return 1;
			}
			if (flag2)
			{
				if (!nonEmptyIsLower)
				{
					return 1;
				}
				return -1;
			}
			string[] array = a.Split(new char[1] { '.' });
			string[] array2 = b.Split(new char[1] { '.' });
			int num = Math.Min(array.Length, array2.Length);
			for (int i = 0; i < num; i++)
			{
				string text = array[i];
				string text2 = array2[i];
				int result;
				bool flag3 = int.TryParse(text, out result);
				int result2;
				bool flag4 = int.TryParse(text2, out result2);
				int num2;
				if (flag3 && flag4)
				{
					num2 = result.CompareTo(result2);
					if (num2 != 0)
					{
						return num2;
					}
					continue;
				}
				if (flag3)
				{
					return -1;
				}
				if (flag4)
				{
					return 1;
				}
				num2 = string.CompareOrdinal(text, text2);
				if (num2 != 0)
				{
					return num2;
				}
			}
			return array.Length.CompareTo(array2.Length);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Operator is obsolete. Use CompareSortOrder() or ComparePrecedence() instead.")]
		public static bool operator >(SemVersion left, SemVersion right)
		{
			return Compare(left, right) > 0;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Operator is obsolete. Use CompareSortOrder() or ComparePrecedence() instead.")]
		public static bool operator >=(SemVersion left, SemVersion right)
		{
			if (!Equals(left, right))
			{
				return Compare(left, right) > 0;
			}
			return true;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Operator is obsolete. Use CompareSortOrder() or ComparePrecedence() instead.")]
		public static bool operator <(SemVersion left, SemVersion right)
		{
			return Compare(left, right) < 0;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Operator is obsolete. Use CompareSortOrder() or ComparePrecedence() instead.")]
		public static bool operator <=(SemVersion left, SemVersion right)
		{
			if (!Equals(left, right))
			{
				return Compare(left, right) < 0;
			}
			return true;
		}

		public bool Satisfies(Predicate<SemVersion> predicate)
		{
			if (predicate == null)
			{
				throw new ArgumentNullException("predicate");
			}
			return predicate(this);
		}

		public bool Satisfies(SemVersionRange range)
		{
			if ((object)range == null)
			{
				throw new ArgumentNullException("range");
			}
			return range.Contains(this);
		}

		public bool Satisfies(UnbrokenSemVersionRange range)
		{
			if ((object)range == null)
			{
				throw new ArgumentNullException("range");
			}
			return range.Contains(this);
		}

		public bool Satisfies(string range, SemVersionRangeOptions options, int maxLength = 2048)
		{
			if (range == null)
			{
				throw new ArgumentNullException("range");
			}
			return SemVersionRange.Parse(range, options, maxLength).Contains(this);
		}

		public bool Satisfies(string range, int maxLength = 2048)
		{
			return Satisfies(range, SemVersionRangeOptions.Strict, maxLength);
		}

		public bool SatisfiesNpm(string range, bool includeAllPrerelease, int maxLength = 2048)
		{
			if (range == null)
			{
				throw new ArgumentNullException("range");
			}
			return SemVersionRange.ParseNpm(range, includeAllPrerelease, maxLength).Contains(this);
		}

		public bool SatisfiesNpm(string range, int maxLength = 2048)
		{
			return SatisfiesNpm(range, includeAllPrerelease: false, maxLength);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Implicit conversion from string is obsolete. Use Parse() or TryParse() method instead.")]
		public static implicit operator SemVersion(string version)
		{
			return Parse(version);
		}
	}
	public sealed class SemVersionRange : IReadOnlyList<UnbrokenSemVersionRange>, IEnumerable<UnbrokenSemVersionRange>, IEnumerable, IReadOnlyCollection<UnbrokenSemVersionRange>, IEquatable<SemVersionRange>
	{
		internal const int MaxRangeLength = 2048;

		internal const string InvalidOptionsMessage = "An invalid SemVersionRangeOptions value was used.";

		internal const string InvalidMaxLengthMessage = "Must not be negative.";

		private readonly IReadOnlyList<UnbrokenSemVersionRange> ranges;

		public static SemVersionRange Empty { get; } = new SemVersionRange(ReadOnlyList<UnbrokenSemVersionRange>.Empty);


		public static SemVersionRange AllRelease { get; } = new SemVersionRange(UnbrokenSemVersionRange.AllRelease);


		public static SemVersionRange All { get; } = new SemVersionRange(UnbrokenSemVersionRange.All);


		public int Count => ranges.Count;

		public UnbrokenSemVersionRange this[int index] => ranges[index];

		public static SemVersionRange Equals(SemVersion version)
		{
			return Create(UnbrokenSemVersionRange.Equals(version));
		}

		public static SemVersionRange GreaterThan(SemVersion version, bool includeAllPrerelease = false)
		{
			return Create(UnbrokenSemVersionRange.GreaterThan(version, includeAllPrerelease));
		}

		public static SemVersionRange AtLeast(SemVersion version, bool includeAllPrerelease = false)
		{
			return Create(UnbrokenSemVersionRange.AtLeast(version, includeAllPrerelease));
		}

		public static SemVersionRange LessThan(SemVersion version, bool includeAllPrerelease = false)
		{
			return Create(UnbrokenSemVersionRange.LessThan(version, includeAllPrerelease));
		}

		public static SemVersionRange AtMost(SemVersion version, bool includeAllPrerelease = false)
		{
			return Create(UnbrokenSemVersionRange.AtMost(version, includeAllPrerelease));
		}

		public static SemVersionRange Inclusive(SemVersion start, SemVersion end, bool includeAllPrerelease = false)
		{
			return Create(UnbrokenSemVersionRange.Inclusive(start, end, includeAllPrerelease));
		}

		public static SemVersionRange InclusiveOfStart(SemVersion start, SemVersion end, bool includeAllPrerelease = false)
		{
			return Create(UnbrokenSemVersionRange.InclusiveOfStart(start, end, includeAllPrerelease));
		}

		public static SemVersionRange InclusiveOfEnd(SemVersion start, SemVersion end, bool includeAllPrerelease = false)
		{
			return Create(UnbrokenSemVersionRange.InclusiveOfEnd(start, end, includeAllPrerelease));
		}

		public static SemVersionRange Exclusive(SemVersion start, SemVersion end, bool includeAllPrerelease = false)
		{
			return Create(UnbrokenSemVersionRange.Exclusive(start, end, includeAllPrerelease));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static SemVersionRange Create(UnbrokenSemVersionRange range)
		{
			if (!UnbrokenSemVersionRange.Empty.Equals(range))
			{
				return new SemVersionRange(range);
			}
			return Empty;
		}

		internal static SemVersionRange Create(List<UnbrokenSemVersionRange> ranges)
		{
			ranges.RemoveAll((UnbrokenSemVersionRange range) => UnbrokenSemVersionRange.Empty.Equals(range));
			if (ranges.Count == 0)
			{
				return Empty;
			}
			ranges.Sort(UnbrokenSemVersionRangeComparer.Instance);
			for (int i = 0; i < ranges.Count - 1; i++)
			{
				for (int num = ranges.Count - 1; num > i; num--)
				{
					if (ranges[i].TryUnion(ranges[num], out var union))
					{
						ranges.RemoveAt(num);
						ranges[i] = union;
					}
				}
			}
			return new SemVersionRange(ranges.AsReadOnly());
		}

		public static SemVersionRange Create(IEnumerable<UnbrokenSemVersionRange> ranges)
		{
			return Create((ranges ?? throw new ArgumentNullException("ranges")).ToList());
		}

		public static SemVersionRange Create(params UnbrokenSemVersionRange[] ranges)
		{
			return Create((ranges ?? throw new ArgumentNullException("ranges")).ToList());
		}

		private SemVersionRange(UnbrokenSemVersionRange range)
			: this(new List<UnbrokenSemVersionRange>(1) { range }.AsReadOnly())
		{
		}

		private SemVersionRange(IReadOnlyList<UnbrokenSemVersionRange> ranges)
		{
			this.ranges = ranges;
		}

		public bool Contains(SemVersion version)
		{
			for (int i = 0; i < ranges.Count; i++)
			{
				if (ranges[i].Contains(version))
				{
					return true;
				}
			}
			return false;
		}

		public static implicit operator Predicate<SemVersion>(SemVersionRange range)
		{
			return range.Contains;
		}

		public static SemVersionRange Parse(string range, SemVersionRangeOptions options, int maxLength = 2048)
		{
			if (!options.IsValid())
			{
				throw new ArgumentException("An invalid SemVersionRangeOptions value was used.", "options");
			}
			if (maxLength < 0)
			{
				throw new ArgumentOutOfRangeException("maxLength", maxLength, "Must not be negative.");
			}
			SemVersionRange semverRange;
			Exception ex = StandardRangeParser.Parse(range, options, null, maxLength, out semverRange);
			if (ex != null)
			{
				throw ex;
			}
			return semverRange;
		}

		public static SemVersionRange Parse(string range, int maxLength = 2048)
		{
			return Parse(range, SemVersionRangeOptions.Strict, maxLength);
		}

		public static bool TryParse(string range, SemVersionRangeOptions options, out SemVersionRange semverRange, int maxLength = 2048)
		{
			if (!options.IsValid())
			{
				throw new ArgumentException("An invalid SemVersionRangeOptions value was used.", "options");
			}
			if (maxLength < 0)
			{
				throw new ArgumentOutOfRangeException("maxLength", maxLength, "Must not be negative.");
			}
			return StandardRangeParser.Parse(range, options, VersionParsing.FailedException, maxLength, out semverRange) == null;
		}

		public static bool TryParse(string range, out SemVersionRange semverRange, int maxLength = 2048)
		{
			return TryParse(range, SemVersionRangeOptions.Strict, out semverRange, maxLength);
		}

		public static SemVersionRange ParseNpm(string range, bool includeAllPrerelease, int maxLength = 2048)
		{
			if (maxLength < 0)
			{
				throw new ArgumentOutOfRangeException("maxLength", maxLength, "Must not be negative.");
			}
			SemVersionRange semverRange;
			Exception ex = NpmRangeParser.Parse(range, includeAllPrerelease, null, maxLength, out semverRange);
			if (ex != null)
			{
				throw ex;
			}
			return semverRange;
		}

		public static SemVersionRange ParseNpm(string range, int maxLength = 2048)
		{
			return ParseNpm(range, includeAllPrerelease: false, maxLength);
		}

		public static bool TryParseNpm(string range, bool includeAllPrerelease, out SemVersionRange semverRange, int maxLength = 2048)
		{
			if (maxLength < 0)
			{
				throw new ArgumentOutOfRangeException("maxLength", maxLength, "Must not be negative.");
			}
			return NpmRangeParser.Parse(range, includeAllPrerelease, VersionParsing.FailedException, maxLength, out semverRange) == null;
		}

		public static bool TryParseNpm(string range, out SemVersionRange semverRange, int maxLength = 2048)
		{
			return TryParseNpm(range, includeAllPrerelease: false, out semverRange, maxLength);
		}

		public IEnumerator<UnbrokenSemVersionRange> GetEnumerator()
		{
			return ranges.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

		public bool Equals(SemVersionRange other)
		{
			if ((object)other == null)
			{
				return false;
			}
			if ((object)this == other)
			{
				return true;
			}
			return ranges.SequenceEqual(other.ranges);
		}

		public override bool Equals(object obj)
		{
			if (obj is SemVersionRange other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return CombinedHashCode.CreateForItems(ranges);
		}

		public static bool operator ==(SemVersionRange left, SemVersionRange right)
		{
			return object.Equals(left, right);
		}

		public static bool operator !=(SemVersionRange left, SemVersionRange right)
		{
			return !object.Equals(left, right);
		}

		public override string ToString()
		{
			return string.Join(" || ", this);
		}
	}
	[Flags]
	public enum SemVersionRangeOptions
	{
		Strict = 0,
		AllowLeadingZeros = 1,
		AllowLowerV = 8,
		AllowUpperV = 0x10,
		AllowV = 0x18,
		OptionalPatch = 0x20,
		OptionalMinorPatch = 0x60,
		IncludeAllPrerelease = 2,
		AllowMetadata = 4,
		Loose = 0x7D
	}
	internal static class SemVersionRangeOptionsExtensions
	{
		private const SemVersionRangeOptions OptionsThatAreStyles = SemVersionRangeOptions.AllowV | SemVersionRangeOptions.OptionalMinorPatch | SemVersionRangeOptions.AllowLeadingZeros;

		private const SemVersionRangeOptions OptionalMinorWithoutPatch = (SemVersionRangeOptions)64;

		internal const SemVersionRangeOptions AllFlags = SemVersionRangeOptions.Loose | SemVersionRangeOptions.IncludeAllPrerelease;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsValid(this SemVersionRangeOptions options)
		{
			if ((options & (SemVersionRangeOptions.Loose | SemVersionRangeOptions.IncludeAllPrerelease)) == options)
			{
				return (options & SemVersionRangeOptions.OptionalMinorPatch) != (SemVersionRangeOptions)64;
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool HasOption(this SemVersionRangeOptions options, SemVersionRangeOptions flag)
		{
			return (options & flag) == flag;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static SemVersionStyles ToStyles(this SemVersionRangeOptions options)
		{
			return (SemVersionStyles)(options & (SemVersionRangeOptions.AllowV | SemVersionRangeOptions.OptionalMinorPatch | SemVersionRangeOptions.AllowLeadingZeros));
		}
	}
	[Flags]
	public enum SemVersionStyles
	{
		Strict = 0,
		AllowLeadingZeros = 1,
		AllowLeadingWhitespace = 2,
		AllowTrailingWhitespace = 4,
		AllowWhitespace = 6,
		AllowLowerV = 8,
		AllowUpperV = 0x10,
		AllowV = 0x18,
		OptionalPatch = 0x20,
		OptionalMinorPatch = 0x60,
		Any = -1
	}
	internal static class SemVersionStylesExtensions
	{
		internal const SemVersionStyles AllowAll = SemVersionStyles.AllowWhitespace | SemVersionStyles.AllowV | SemVersionStyles.OptionalMinorPatch | SemVersionStyles.AllowLeadingZeros;

		private const SemVersionStyles OptionalMinorWithoutPatch = (SemVersionStyles)64;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsValid(this SemVersionStyles styles)
		{
			if (styles == SemVersionStyles.Any)
			{
				return true;
			}
			if ((styles & (SemVersionStyles.AllowWhitespace | SemVersionStyles.AllowV | SemVersionStyles.OptionalMinorPatch | SemVersionStyles.AllowLeadingZeros)) == styles)
			{
				return (styles & SemVersionStyles.OptionalMinorPatch) != (SemVersionStyles)64;
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool HasStyle(this SemVersionStyles styles, SemVersionStyles flag)
		{
			return (styles & flag) == flag;
		}
	}
	public sealed class UnbrokenSemVersionRange : IEquatable<UnbrokenSemVersionRange>
	{
		internal readonly LeftBoundedRange LeftBound;

		internal readonly RightBoundedRange RightBound;

		private readonly bool allPrereleaseCoveredByEnds;

		private string toStringCache;

		private const string InvalidMetadataMessage = "Cannot have metadata.";

		public static UnbrokenSemVersionRange Empty { get; } = new UnbrokenSemVersionRange(new LeftBoundedRange(SemVersion.Max, inclusive: false), new RightBoundedRange(SemVersion.Min, inclusive: false), includeAllPrerelease: false, allPrereleaseCoveredByEnds: false);


		public static UnbrokenSemVersionRange AllRelease { get; } = AtMost(SemVersion.Max);


		public static UnbrokenSemVersionRange All { get; } = AtMost(SemVersion.Max, includeAllPrerelease: true);


		public SemVersion Start => LeftBound.Version;

		public bool StartInclusive => LeftBound.Inclusive;

		public SemVersion End => RightBound.Version;

		public bool EndInclusive => RightBound.Inclusive;

		public bool IncludeAllPrerelease { get; }

		public static UnbrokenSemVersionRange Equals(SemVersion version)
		{
			return Create(Validate(version, "version"), startInclusive: true, version, endInclusive: true, includeAllPrerelease: false);
		}

		public static UnbrokenSemVersionRange GreaterThan(SemVersion version, bool includeAllPrerelease = false)
		{
			return Create(Validate(version, "version"), startInclusive: false, SemVersion.Max, endInclusive: true, includeAllPrerelease);
		}

		public static UnbrokenSemVersionRange AtLeast(SemVersion version, bool includeAllPrerelease = false)
		{
			return Create(Validate(version, "version"), startInclusive: true, SemVersion.Max, endInclusive: true, includeAllPrerelease);
		}

		public static UnbrokenSemVersionRange LessThan(SemVersion version, bool includeAllPrerelease = false)
		{
			return Create(null, startInclusive: false, Validate(version, "version"), endInclusive: false, includeAllPrerelease);
		}

		public static UnbrokenSemVersionRange AtMost(SemVersion version, bool includeAllPrerelease = false)
		{
			return Create(null, startInclusive: false, Validate(version, "version"), endInclusive: true, includeAllPrerelease);
		}

		public static UnbrokenSemVersionRange Inclusive(SemVersion start, SemVersion end, bool includeAllPrerelease = false)
		{
			return Create(Validate(start, "start"), startInclusive: true, Validate(end, "end"), endInclusive: true, includeAllPrerelease);
		}

		public static UnbrokenSemVersionRange InclusiveOfStart(SemVersion start, SemVersion end, bool includeAllPrerelease = false)
		{
			return Create(Validate(start, "start"), startInclusive: true, Validate(end, "end"), endInclusive: false, includeAllPrerelease);
		}

		public static UnbrokenSemVersionRange InclusiveOfEnd(SemVersion start, SemVersion end, bool includeAllPrerelease = false)
		{
			return Create(Validate(start, "start"), startInclusive: false, Validate(end, "end"), endInclusive: true, includeAllPrerelease);
		}

		public static UnbrokenSemVersionRange Exclusive(SemVersion start, SemVersion end, bool includeAllPrerelease = false)
		{
			return Create(Validate(start, "start"), startInclusive: false, Validate(end, "end"), endInclusive: false, includeAllPrerelease);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static UnbrokenSemVersionRange Create(SemVersion startVersion, bool startInclusive, SemVersion endVersion, bool endInclusive, bool includeAllPrerelease)
		{
			LeftBoundedRange start = new LeftBoundedRange(startVersion, startInclusive);
			RightBoundedRange end = new RightBoundedRange(endVersion, endInclusive);
			return Create(start, end, includeAllPrerelease);
		}

		internal static UnbrokenSemVersionRange Create(LeftBoundedRange start, RightBoundedRange end, bool includeAllPrerelease)
		{
			if (IsEmpty(start, end, includeAllPrerelease))
			{
				return Empty;
			}
			bool flag = false;
			if (start.Version == end.Version)
			{
				flag = (includeAllPrerelease = start.Version.IsPrerelease);
			}
			else if ((object)start.Version != null && (start.IncludesPrerelease || end.IncludesPrerelease))
			{
				if (start.Version.MajorMinorPatchEquals(end.Version))
				{
					flag = true;
				}
				else if ((end.IncludesPrerelease || end.Version.PrereleaseIsZero) && start.Version.Major == end.Version.Major && start.Version.Minor == end.Version.Minor && start.Version.Patch == end.Version.Patch - 1)
				{
					flag = true;
				}
			}
			return new UnbrokenSemVersionRange(start, end, includeAllPrerelease, flag);
		}

		private UnbrokenSemVersionRange(LeftBoundedRange leftBound, RightBoundedRange rightBound, bool includeAllPrerelease, bool allPrereleaseCoveredByEnds)
		{
			LeftBound = leftBound;
			RightBound = rightBound;
			IncludeAllPrerelease = includeAllPrerelease || allPrereleaseCoveredByEnds;
			this.allPrereleaseCoveredByEnds = allPrereleaseCoveredByEnds;
		}

		public bool Contains(SemVersion version)
		{
			if ((object)version == null)
			{
				throw new ArgumentNullException("version");
			}
			if (!LeftBound.Contains(version) || !RightBound.Contains(version))
			{
				return false;
			}
			if (IncludeAllPrerelease || !version.IsPrerelease)
			{
				return true;
			}
			SemVersion start = Start;
			if ((object)start == null || !start.IsPrerelease || !version.MajorMinorPatchEquals(Start))
			{
				if (End.IsPrerelease)
				{
					return version.MajorMinorPatchEquals(End);
				}
				return false;
			}
			return true;
		}

		public static implicit operator Predicate<SemVersion>(UnbrokenSemVersionRange range)
		{
			return range.Contains;
		}

		public bool Equals(UnbrokenSemVersionRange other)
		{
			if ((object)other == null)
			{
				return false;
			}
			if ((object)this == other)
			{
				return true;
			}
			if (LeftBound.Equals(other.LeftBound) && RightBound.Equals(other.RightBound))
			{
				return IncludeAllPrerelease == other.IncludeAllPrerelease;
			}
			return false;
		}

		public override bool Equals(object obj)
		{
			if (obj is UnbrokenSemVersionRange other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return CombinedHashCode.Create(LeftBound, RightBound, IncludeAllPrerelease);
		}

		public static bool operator ==(UnbrokenSemVersionRange left, UnbrokenSemVersionRange right)
		{
			return object.Equals(left, right);
		}

		public static bool operator !=(UnbrokenSemVersionRange left, UnbrokenSemVersionRange right)
		{
			return !object.Equals(left, right);
		}

		public override string ToString()
		{
			return toStringCache ?? (toStringCache = ToStringInternal());
		}

		private string ToStringInternal()
		{
			if (this == Empty)
			{
				return "<0.0.0-0";
			}
			if (LeftBound.Inclusive && RightBound.Inclusive && SemVersion.Equals(Start, End))
			{
				return Start.ToString();
			}
			bool flag = IncludeAllPrerelease && !allPrereleaseCoveredByEnds;
			bool flag2 = LeftBound == LeftBoundedRange.Unbounded;
			bool flag3 = RightBound == RightBoundedRange.Unbounded;
			if (flag2 && flag3)
			{
				if (!flag)
				{
					return "*";
				}
				return "*-*";
			}
			if (TryToSpecialString(flag, out var result))
			{
				return result;
			}
			string text = (flag2 ? RightBound.ToString() : ((!flag3) ? $"{LeftBound} {RightBound}" : LeftBound.ToString()));
			if (!flag)
			{
				return text;
			}
			return "*-* " + text;
		}

		private bool TryToSpecialString(bool includesPrereleaseNotCoveredByEnds, out string result)
		{
			if (LeftBound.Inclusive && !RightBound.Inclusive && End.PrereleaseIsZero)
			{
				if (Start.Patch == 0 && End.Patch == 0 && (!Start.IsPrerelease || Start.PrereleaseIsZero))
				{
					if (Start.Major == End.Major && Start.Minor == End.Minor - 1)
					{
						result = $"{Start.Major}.{Start.Minor}.*";
					}
					else
					{
						if (Start.Major != End.Major - 1 || Start.Minor != 0 || End.Minor != 0)
						{
							goto IL_01ee;
						}
						result = $"{Start.Major}.*";
					}
					if (!includesPrereleaseNotCoveredByEnds)
					{
						return true;
					}
					result = (Start.PrereleaseIsZero ? (result + "-*") : ("*-* " + result));
					return true;
				}
				if (Start.PrereleaseIsZero && Start.Major == End.Major && Start.Minor == End.Minor && Start.Patch == End.Patch - 1)
				{
					result = $"{Start.Major}.{Start.Minor}.{Start.Patch}-*";
					return true;
				}
				goto IL_01ee;
			}
			goto IL_0336;
			IL_01ee:
			if (Start.Major == End.Major && Start.Minor == End.Minor - 1 && End.Patch == 0)
			{
				result = (includesPrereleaseNotCoveredByEnds ? "*-* ~" : "~") + Start;
				return true;
			}
			if (Start.Major != 0)
			{
				if (Start.Major == End.Major - 1 && End.Minor == 0 && End.Patch == 0)
				{
					result = (includesPrereleaseNotCoveredByEnds ? "*-* ^" : "^") + Start;
					return true;
				}
			}
			else if (End.Major == 0 && Start.Minor == 0 && End.Minor == 0 && Start.Patch == End.Patch - 1)
			{
				result = (includesPrereleaseNotCoveredByEnds ? "*-* ^" : "^") + Start;
				return true;
			}
			goto IL_0336;
			IL_0336:
			result = null;
			if (LeftBound.Inclusive && !RightBound.Inclusive)
			{
				SemVersion version = LeftBound.Version;
				if ((object)version != null && version.MajorMinorPatchEquals(RightBound.Version) && LeftBound.Version.IsPrerelease && RightBound.Version.IsPrerelease)
				{
					IReadOnlyList<PrereleaseIdentifier> prereleaseIdentifiers = LeftBound.Version.PrereleaseIdentifiers;
					IReadOnlyList<PrereleaseIdentifier> prereleaseIdentifiers2 = RightBound.Version.PrereleaseIdentifiers;
					if (prereleaseIdentifiers.Count < 2 || prereleaseIdentifiers[prereleaseIdentifiers.Count - 1] != PrereleaseIdentifier.Zero || prereleaseIdentifiers.Count - 1 != prereleaseIdentifiers2.Count)
					{
						return false;
					}
					for (int i = 0; i < prereleaseIdentifiers.Count - 2; i++)
					{
						if (prereleaseIdentifiers[i] != prereleaseIdentifiers2[i])
						{
							return false;
						}
					}
					if (prereleaseIdentifiers[prereleaseIdentifiers.Count - 2].NextIdentifier() != prereleaseIdentifiers2[prereleaseIdentifiers2.Count - 1])
					{
						return false;
					}
					string text = string.Join(".", prereleaseIdentifiers.Take(prereleaseIdentifiers.Count - 1));
					result = $"{Start.Major}.{Start.Minor}.{Start.Patch}-{text}.*";
					return true;
				}
			}
			return false;
		}

		internal bool Overlaps(UnbrokenSemVersionRange other)
		{
			if (LeftBound.CompareTo(other.RightBound) <= 0)
			{
				return other.LeftBound.CompareTo(RightBound) <= 0;
			}
			return false;
		}

		internal bool OverlapsOrAbuts(UnbrokenSemVersionRange other)
		{
			if (Overlaps(other))
			{
				return true;
			}
			if (Empty.Equals(this) || Empty.Equals(other))
			{
				return false;
			}
			bool num = UnbrokenSemVersionRangeComparer.Instance.Compare(this, other) <= 0;
			RightBoundedRange rightBound = (num ? this : other).RightBound;
			LeftBoundedRange leftBound = (num ? other : this).LeftBound;
			if ((rightBound.Inclusive || leftBound.Inclusive) && rightBound.Version.Equals(leftBound.Version))
			{
				return true;
			}
			if (IncludeAllPrerelease || other.IncludeAllPrerelease || rightBound.IncludesPrerelease || leftBound.IncludesPrerelease)
			{
				return false;
			}
			if (leftBound.Inclusive)
			{
				return rightBound.Version.MajorMinorPatchEquals(leftBound.Version);
			}
			return false;
		}

		internal bool Contains(UnbrokenSemVersionRange other)
		{
			if (other == Empty)
			{
				return true;
			}
			if (other.IncludeAllPrerelease && !IncludeAllPrerelease)
			{
				return false;
			}
			if (LeftBound.CompareTo(other.LeftBound) > 0 || other.RightBound.CompareTo(RightBound) > 0)
			{
				return false;
			}
			if (IncludeAllPrerelease)
			{
				return true;
			}
			if (other.LeftBound.IncludesPrerelease)
			{
				SemVersion start = Start;
				if ((object)start == null || !start.IsPrerelease || !Start.MajorMinorPatchEquals(other.Start))
				{
					return false;
				}
			}
			if (other.RightBound.IncludesPrerelease)
			{
				SemVersion end = End;
				if ((object)end == null || !end.IsPrerelease || !End.MajorMinorPatchEquals(other.End))
				{
					return false;
				}
			}
			return true;
		}

		internal bool TryUnion(UnbrokenSemVersionRange other, out UnbrokenSemVersionRange union)
		{
			if (Contains(other))
			{
				union = this;
				return true;
			}
			if (other.Contains(this))
			{
				union = other;
				return true;
			}
			union = null;
			if (IncludeAllPrerelease != other.IncludeAllPrerelease)
			{
				return false;
			}
			if (!OverlapsOrAbuts(other))
			{
				return false;
			}
			LeftBoundedRange start = LeftBound.Min(other.LeftBound);
			RightBoundedRange end = RightBound.Max(other.RightBound);
			bool includeAllPrerelease = IncludeAllPrerelease;
			UnbrokenSemVersionRange unbrokenSemVersionRange = Create(start, end, includeAllPrerelease);
			if (!includeAllPrerelease)
			{
				LeftBoundedRange leftBoundedRange = LeftBound.Max(other.LeftBound);
				if (leftBoundedRange.IncludesPrerelease && !unbrokenSemVersionRange.Contains(leftBoundedRange.Version))
				{
					return false;
				}
				RightBoundedRange rightBoundedRange = RightBound.Min(other.RightBound);
				if (rightBoundedRange.IncludesPrerelease && !unbrokenSemVersionRange.Contains(rightBoundedRange.Version))
				{
					return false;
				}
			}
			union = unbrokenSemVersionRange;
			return true;
		}

		private static bool IsEmpty(LeftBoundedRange start, RightBoundedRange end, bool includeAllPrerelease)
		{
			int num = SemVersion.ComparePrecedence(start.Version, end.Version);
			if (num > 0)
			{
				return true;
			}
			if (num == 0)
			{
				if (start.Inclusive)
				{
					return !end.Inclusive;
				}
				return true;
			}
			if ((object)start.Version == null)
			{
				if (end.Inclusive)
				{
					return false;
				}
				if (!(end.Version == SemVersion.Min))
				{
					if (!includeAllPrerelease)
					{
						return end.Version == SemVersion.MinRelease;
					}
					return false;
				}
				return true;
			}
			if (start.Inclusive || end.Inclusive || includeAllPrerelease || start.Version.IsPrerelease || end.Version.IsPrerelease)
			{
				return false;
			}
			if (start.Version.Major == end.Version.Major && start.Version.Minor == end.Version.Minor)
			{
				return start.Version.Patch == end.Version.Patch - 1;
			}
			return false;
		}

		private static SemVersion Validate(SemVersion version, string paramName)
		{
			if ((object)version == null)
			{
				throw new ArgumentNullException(paramName);
			}
			if (version.MetadataIdentifiers.Count > 0)
			{
				throw new ArgumentException("Cannot have metadata.", paramName);
			}
			return version;
		}
	}
}
namespace Semver.Utility
{
	internal static class CharExtensions
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsDigit(this char c)
		{
			if (c >= '0')
			{
				return c <= '9';
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsAlphaOrHyphen(this char c)
		{
			if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z'))
			{
				return c == '-';
			}
			return true;
		}
	}
	[StructLayout(LayoutKind.Auto)]
	internal struct CombinedHashCode
	{
		private static readonly int RandomSeed = new Random().Next(int.MinValue, int.MaxValue);

		private int hash;

		public static CombinedHashCode Create<T1>(T1 value1)
		{
			return new CombinedHashCode(CombineValue(RandomSeed, value1));
		}

		public static CombinedHashCode Create<T1, T2>(T1 value1, T2 value2)
		{
			return new CombinedHashCode(CombineValue(CombineValue(RandomSeed, value1), value2));
		}

		public static CombinedHashCode Create<T1, T2, T3>(T1 value1, T2 value2, T3 value3)
		{
			return new CombinedHashCode(CombineValue(CombineValue(CombineValue(RandomSeed, value1), value2), value3));
		}

		public static CombinedHashCode Create<T1, T2, T3, T4>(T1 value1, T2 value2, T3 value3, T4 value4)
		{
			return new CombinedHashCode(CombineValue(CombineValue(CombineValue(CombineValue(RandomSeed, value1), value2), value3), value4));
		}

		public static CombinedHashCode Create<T1, T2, T3, T4, T5>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
		{
			return new CombinedHashCode(CombineValue(CombineValue(CombineValue(CombineValue(CombineValue(RandomSeed, value1), value2), value3), value4), value5));
		}

		public static CombinedHashCode CreateForItems<T>(IEnumerable<T> values)
		{
			int hash = RandomSeed;
			foreach (T value in values)
			{
				hash = CombineValue(hash, value);
			}
			return new CombinedHashCode(hash);
		}

		private CombinedHashCode(int hash)
		{
			this.hash = hash;
		}

		public void Add<T>(T value)
		{
			hash = CombineValue(hash, value);
		}

		public static implicit operator int(CombinedHashCode hashCode)
		{
			return hashCode.hash;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("HashCode is a mutable struct and should not be compared with other HashCodes. Use ToHashCode to retrieve the computed hash code.", true)]
		public override int GetHashCode()
		{
			throw new NotSupportedException();
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static int CombineValue<T>(int hash1, T value)
		{
			return (((hash1 << 5) | (hash1 >>> 27)) + hash1) ^ (value?.GetHashCode() ?? 0);
		}
	}
	[ExcludeFromCodeCoverage]
	internal static class DebugChecks
	{
		[Conditional("DEBUG")]
		public static void IsValid(SemVersionStyles style, string paramName)
		{
			if (!style.IsValid())
			{
				throw new ArgumentException("DEBUG: An invalid SemVersionStyles value was used.", paramName);
			}
		}

		[Conditional("DEBUG")]
		public static void IsValid(SemVersionRangeOptions rangeOptions, string paramName)
		{
			if (!rangeOptions.IsValid())
			{
				throw new ArgumentException("DEBUG: An invalid SemVersionRangeOptions value was used.", paramName);
			}
		}

		[Conditional("DEBUG")]
		public static void IsValidMaxLength(int maxLength, string paramName)
		{
			if (maxLength < 0)
			{
				throw new ArgumentOutOfRangeException(paramName, "DEBUG: Must not be negative.");
			}
		}

		[Conditional("DEBUG")]
		public static void IsNotWildcardVersionWithPrerelease(WildcardVersion wildcardVersion, SemVersion semver)
		{
			if (wildcardVersion != 0 && semver.IsPrerelease)
			{
				throw new InvalidOperationException("DEBUG: prerelease not allowed with wildcard");
			}
		}

		[Conditional("DEBUG")]
		public static void IsNotEmpty(StringSegment segment, string paramName)
		{
			if (segment.IsEmpty)
			{
				throw new ArgumentException("DEBUG: Cannot be empty", paramName);
			}
		}

		[Conditional("DEBUG")]
		public static void IsNotNull<T>(T value, string paramName)
		{
			if (value == null)
			{
				throw new ArgumentNullException(paramName, "DEBUG: Value cannot be null.");
			}
		}

		[Conditional("DEBUG")]
		public static void IsNotFailedException(Exception exception, string className, string methodName)
		{
			if (exception != null && exception != VersionParsing.FailedException)
			{
				throw new InvalidOperationException("DEBUG: " + className + "." + methodName + " returned exception other than FailedException", exception);
			}
		}

		[Conditional("DEBUG")]
		public static void NoMetadata(SemVersion version, string paramName)
		{
			if ((object)version != null && version.MetadataIdentifiers.Any())
			{
				throw new ArgumentException("DEBUG: Cannot have metadata.", paramName);
			}
		}

		[Conditional("DEBUG")]
		public static void IsValidVersionNumber(int versionNumber, string kind, string paramName)
		{
			if (versionNumber < 0)
			{
				throw new ArgumentException("DEBUG: " + kind + " version must be greater than or equal to zero.", paramName);
			}
		}

		[Conditional("DEBUG")]
		public static void ContainsNoDefaultValues<T>(IEnumerable<T> values, string kind, string paramName) where T : struct
		{
			if (values.Any((T i) => EqualityComparer<T>.Default.Equals(i, default(T))))
			{
				throw new ArgumentException("DEBUG: " + kind + " identifier cannot be default/null.", paramName);
			}
		}

		[Conditional("DEBUG")]
		public static void AreEqualWhenJoinedWithDots<T>(string value, string param1Name, IReadOnlyList<T> values, string param2Name)
		{
			if (value != string.Join(".", values))
			{
				throw new ArgumentException("DEBUG: must be equal to " + param2Name + " when joined with dots.", param1Name);
			}
		}
	}
	internal static class EnumerableExtensions
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static IReadOnlyList<T> ToReadOnlyList<T>(this IEnumerable<T> values)
		{
			return values.ToList().AsReadOnly();
		}
	}
	internal static class IdentifierString
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int Compare(string left, string right)
		{
			return Math.Sign(string.CompareOrdinal(left, right));
		}
	}
	internal static class IntExtensions
	{
		public static int DecimalDigits(this int n)
		{
			if (n < 10)
			{
				return 1;
			}
			if (n < 100)
			{
				return 2;
			}
			if (n < 1000)
			{
				return 3;
			}
			if (n < 10000)
			{
				return 4;
			}
			if (n < 100000)
			{
				return 5;
			}
			if (n < 1000000)
			{
				return 6;
			}
			if (n < 10000000)
			{
				return 7;
			}
			if (n < 100000000)
			{
				return 8;
			}
			if (n < 1000000000)
			{
				return 9;
			}
			return 10;
		}
	}
	internal static class ReadOnlyList<T>
	{
		public static readonly IReadOnlyList<T> Empty = new List<T>().AsReadOnly();
	}
	internal static class StringExtensions
	{
		private const int DisplayLimit = 100;

		public static bool IsDigits(this string value)
		{
			for (int i = 0; i < value.Length; i++)
			{
				if (!value[i].IsDigit())
				{
					return false;
				}
			}
			return true;
		}

		public static bool IsAlphanumericOrHyphens(this string value)
		{
			foreach (char c in value)
			{
				if (!c.IsAlphaOrHyphen() && !c.IsDigit())
				{
					return false;
				}
			}
			return true;
		}

		public static IReadOnlyList<T> SplitAndMapToReadOnlyList<T>(this string value, char splitOn, Func<string, T> func)
		{
			if (value.Length == 0)
			{
				return ReadOnlyList<T>.Empty;
			}
			int num = 1;
			for (int i = 0; i < value.Length; i++)
			{
				if (value[i] == splitOn)
				{
					num++;
				}
			}
			List<T> list = new List<T>(num);
			int num2 = 0;
			for (int j = 0; j < value.Length; j++)
			{
				if (value[j] == splitOn)
				{
					list.Add(func(value.Substring(num2, j - num2)));
					num2 = j + 1;
				}
			}
			list.Add(func(value.Substring(num2, value.Length - num2)));
			return list.AsReadOnly();
		}

		public static string TrimLeadingZeros(this string value)
		{
			int num = value.Length - 1;
			int i;
			for (i = 0; i < num && value[i] == '0'; i++)
			{
			}
			return value.Substring(i);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static StringSegment Slice(this string value, int offset, int length)
		{
			return new StringSegment(value, offset, length);
		}

		public static string LimitLength(this string value)
		{
			if (value.Length > 100)
			{
				return value.Substring(0, 97) + "...";
			}
			return value;
		}
	}
	[StructLayout(LayoutKind.Auto)]
	internal readonly struct StringSegment
	{
		public readonly string Source;

		public readonly int Offset;

		public readonly int Length;

		private const int DisplayLimit = 100;

		public bool IsEmpty => Length == 0;

		public char this[int i] => Source[Offset + i];

		public StringSegment(string source, int offset, int length)
		{
			Source = source;
			Offset = offset;
			Length = length;
		}

		public StringSegment TrimStartSpaces()
		{
			int i = Offset;
			int num;
			for (num = i + Length - 1; i <= num && Source[i] == ' '; i++)
			{
			}
			return new StringSegment(Source, i, num + 1 - i);
		}

		public StringSegment TrimStartWhitespace()
		{
			int i = Offset;
			int num;
			for (num = i + Length - 1; i <= num && char.IsWhiteSpace(Source[i]); i++)
			{
			}
			return new StringSegment(Source, i, num + 1 - i);
		}

		public StringSegment TrimEndWhitespace()
		{
			int num = Offset + Length - 1;
			while (Offset <= num && char.IsWhiteSpace(Source[num]))
			{
				num--;
			}
			return new StringSegment(Source, Offset, num + 1 - Offset);
		}

		public StringSegment TrimLeadingZeros()
		{
			int i = Offset;
			int num;
			for (num = i + Length - 1; i < num && Source[i] == '0'; i++)
			{
			}
			return new StringSegment(Source, i, num + 1 - i);
		}

		public StringSegment Subsegment(int start, int length)
		{
			return new StringSegment(Source, Offset + start, length);
		}

		public StringSegment Subsegment(int start)
		{
			return new StringSegment(Source, Offset + start, Length - start);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public StringSegment EmptySubsegment()
		{
			return new StringSegment(Source, Offset, 0);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public int IndexOf(char value)
		{
			int num = Source.IndexOf(value, Offset, Length);
			if (num >= 0)
			{
				return num - Offset;
			}
			return num;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public int IndexOf(char value, int startIndex)
		{
			int num = Source.IndexOf(value, Offset + startIndex, Length - startIndex);
			if (num >= 0)
			{
				return num - Offset;
			}
			return num;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public int IndexOf(char value, int startIndex, int count)
		{
			int num = Source.IndexOf(value, Offset + startIndex, count);
			if (num >= 0)
			{
				return num - Offset;
			}
			return num;
		}

		public int SplitCount(char c)
		{
			int num = 1;
			int num2 = Offset + Length;
			for (int i = Offset; i < num2; i++)
			{
				if (Source[i] == c)
				{
					num++;
				}
			}
			return num;
		}

		public IEnumerable<StringSegment> Split(char c)
		{
			int num = Offset;
			int end = num + Length;
			for (int i = num; i < end; i++)
			{
				if (Source[i] == c)
				{
					yield return Subsegment(num - Offset, i - num);
					num = i + 1;
				}
			}
			yield return Subsegment(num - Offset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void SplitBeforeFirst(char c, out StringSegment left, out StringSegment right)
		{
			int num = IndexOf(c);
			StringSegment stringSegment = this;
			if (num >= 0)
			{
				left = stringSegment.Subsegment(0, num);
				right = stringSegment.Subsegment(num);
			}
			else
			{
				left = stringSegment;
				right = stringSegment.EmptySubsegment();
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static implicit operator StringSegment(string value)
		{
			return new StringSegment(value, 0, value.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public override string ToString()
		{
			return Source.Substring(Offset, Length);
		}

		public string ToStringLimitLength()
		{
			if (Length > 100)
			{
				return Subsegment(0, 97).ToString() + "...";
			}
			return ToString();
		}
	}
	[ExcludeFromCodeCoverage]
	internal static class Unreachable
	{
		public static ArgumentException InvalidEnum(StandardOperator @operator)
		{
			return new ArgumentException(string.Format("DEBUG: Invalid {0} value {1}.", "StandardOperator", @operator));
		}

		public static ArgumentException InvalidEnum(WildcardVersion wildcardVersion)
		{
			return new ArgumentException(string.Format("DEBUG: Invalid {0} value {1}.", "WildcardVersion", wildcardVersion));
		}
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	internal readonly struct UnsafeOverload
	{
		public static readonly UnsafeOverload Marker;
	}
	internal static class VersionParsing
	{
		public static readonly Exception FailedException = new Exception("Parse Failed");
	}
}
namespace Semver.Ranges
{
	[StructLayout(LayoutKind.Auto)]
	internal readonly struct LeftBoundedRange : IEquatable<LeftBoundedRange>
	{
		public static readonly LeftBoundedRange Unbounded = new LeftBoundedRange(null, inclusive: false);

		public SemVersion Version { get; }

		public bool Inclusive { get; }

		public bool IncludesPrerelease => Version?.IsPrerelease ?? false;

		public LeftBoundedRange(SemVersion version, bool inclusive)
		{
			Version = version;
			Inclusive = inclusive;
		}

		public bool Contains(SemVersion version)
		{
			int num = SemVersion.ComparePrecedence(Version, version);
			if (!Inclusive)
			{
				return num < 0;
			}
			return num <= 0;
		}

		public LeftBoundedRange Min(LeftBoundedRange other)
		{
			int num = SemVersion.ComparePrecedence(Version, other.Version);
			if (num == 0)
			{
				return new LeftBoundedRange(Version, Inclusive || other.Inclusive);
			}
			if (num >= 0)
			{
				return other;
			}
			return this;
		}

		public LeftBoundedRange Max(LeftBoundedRange other)
		{
			int num = SemVersion.ComparePrecedence(Version, other.Version);
			if (num == 0)
			{
				return new LeftBoundedRange(Version, Inclusive && other.Inclusive);
			}
			if (num >= 0)
			{
				return this;
			}
			return other;
		}

		public bool Equals(LeftBoundedRange other)
		{
			if (object.Equals(Version, other.Version))
			{
				return Inclusive == other.Inclusive;
			}
			return false;
		}

		public override bool Equals(object obj)
		{
			if (obj is LeftBoundedRange other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return CombinedHashCode.Create(Version, Inclusive);
		}

		public static bool operator ==(LeftBoundedRange left, LeftBoundedRange right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(LeftBoundedRange left, LeftBoundedRange right)
		{
			return !left.Equals(right);
		}

		public int CompareTo(RightBoundedRange other)
		{
			int num = SemVersion.PrecedenceComparer.Compare(Version, other.Version);
			if (num != 0)
			{
				return num;
			}
			if (!Inclusive || !other.Inclusive)
			{
				return 1;
			}
			return 0;
		}

		public int CompareTo(LeftBoundedRange other)
		{
			int num = PrecedenceComparer.Instance.Compare(Version, other.Version);
			if (num != 0)
			{
				return num;
			}
			return -Inclusive.CompareTo(other.Inclusive);
		}

		public override string ToString()
		{
			return (Inclusive ? ">=" : ">") + (Version?.ToString() ?? "null");
		}
	}
	[StructLayout(LayoutKind.Auto)]
	internal readonly struct RightBoundedRange : IEquatable<RightBoundedRange>
	{
		public static readonly RightBoundedRange Unbounded = new RightBoundedRange(SemVersion.Max, inclusive: true);

		public SemVersion Version { get; }

		public bool Inclusive { get; }

		public bool IncludesPrerelease
		{
			get
			{
				if (Version.IsPrerelease)
				{
					if (!Inclusive)
					{
						return !Version.PrereleaseIsZero;
					}
					return true;
				}
				return false;
			}
		}

		public RightBoundedRange(SemVersion version, bool inclusive)
		{
			Version = version;
			Inclusive = inclusive;
		}

		public bool Contains(SemVersion version)
		{
			int num = SemVersion.ComparePrecedence(version, Version);
			if (!Inclusive)
			{
				return num < 0;
			}
			return num <= 0;
		}

		public RightBoundedRange Min(RightBoundedRange other)
		{
			int num = SemVersion.ComparePrecedence(Version, other.Version);
			if (num == 0)
			{
				return new RightBoundedRange(Version, Inclusive && other.Inclusive);
			}
			if (num >= 0)
			{
				return other;
			}
			return this;
		}

		public RightBoundedRange Max(RightBoundedRange other)
		{
			int num = SemVersion.ComparePrecedence(Version, other.Version);
			if (num == 0)
			{
				return new RightBoundedRange(Version, Inclusive || other.Inclusive);
			}
			if (num >= 0)
			{
				return this;
			}
			return other;
		}

		public bool Equals(RightBoundedRange other)
		{
			if (object.Equals(Version, other.Version))
			{
				return Inclusive == other.Inclusive;
			}
			return false;
		}

		public override bool Equals(object obj)
		{
			if (obj is RightBoundedRange other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return CombinedHashCode.Create(Version, Inclusive);
		}

		public static bool operator ==(RightBoundedRange left, RightBoundedRange right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(RightBoundedRange left, RightBoundedRange right)
		{
			return !left.Equals(right);
		}

		public int CompareTo(RightBoundedRange other)
		{
			int num = PrecedenceComparer.Instance.Compare(Version, other.Version);
			if (num != 0)
			{
				return num;
			}
			return Inclusive.CompareTo(other.Inclusive);
		}

		public override string ToString()
		{
			return (Inclusive ? "<=" : "<") + Version;
		}
	}
}
namespace Semver.Parsing
{
	internal static class GeneralRangeParser
	{
		public static int CountSplitOnOrOperator(string range)
		{
			int num = 1;
			bool flag = false;
			for (int i = 0; i < range.Length; i++)
			{
				bool flag2 = range[i] == '|';
				if (flag && flag2)
				{
					num++;
					flag = false;
				}
				else
				{
					flag = flag2;
				}
			}
			return num;
		}

		public static IEnumerable<StringSegment> SplitOnOrOperator(string range)
		{
			bool possiblyInSeparator = false;
			int num = 0;
			for (int i = 0; i < range.Length; i++)
			{
				bool flag = range[i] == '|';
				if (possiblyInSeparator && flag)
				{
					possiblyInSeparator = false;
					yield return range.Slice(num, i - 1 - num);
					num = i + 1;
				}
				else
				{
					possiblyInSeparator = flag;
				}
			}
			yield return range.Slice(num, range.Length - num);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsPossibleOperatorChar(char c, SemVersionRangeOptions rangeOptions)
		{
			if (c != '=' && c != '<' && c != '>' && c != '~' && c != '^' && (!char.IsPunctuation(c) || char.IsWhiteSpace(c) || c == '*'))
			{
				if (char.IsSymbol(c))
				{
					if (c == '+')
					{
						return !rangeOptions.HasOption(SemVersionRangeOptions.AllowMetadata);
					}
					return true;
				}
				return false;
			}
			return true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsPossibleVersionChar(char c, SemVersionRangeOptions rangeOptions)
		{
			if (!char.IsWhiteSpace(c))
			{
				if (IsPossibleOperatorChar(c, rangeOptions))
				{
					switch (c)
					{
					case '+':
						return rangeOptions.HasOption(SemVersionRangeOptions.AllowMetadata);
					default:
						return false;
					case '-':
					case '.':
						break;
					}
				}
				return true;
			}
			return false;
		}

		public static Exception ParseOptionalSpaces(ref StringSegment segment, Exception ex)
		{
			segment = segment.TrimStartSpaces();
			if (segment.Length > 0 && char.IsWhiteSpace(segment[0]))
			{
				return ex ?? RangeError.InvalidWhitespace(segment.Offset, segment.Source);
			}
			return null;
		}

		public static void ParseOptionalWhitespace(ref StringSegment segment)
		{
			segment = segment.TrimStartWhitespace();
		}

		public static Exception ParseVersion(ref StringSegment segment, SemVersionRangeOptions rangeOptions, SemVersionParsingOptions parseOptions, Exception ex, int maxLength, out SemVersion semver, out WildcardVersion wildcardVersion)
		{
			int i;
			for (i = 0; i < segment.Length && IsPossibleVersionChar(segment[i], rangeOptions); i++)
			{
			}
			StringSegment version = segment.Subsegment(0, i);
			segment = segment.Subsegment(i);
			Exception ex2 = SemVersionParser.Parse(version, rangeOptions.ToStyles(), parseOptions, ex, maxLength, out semver, out wildcardVersion);
			if (ex2 != null)
			{
				return ex2;
			}
			if (semver.MetadataIdentifiers.Count > 0)
			{
				semver = semver.WithoutMetadata();
			}
			return null;
		}
	}
	internal static class NpmRangeParser
	{
		private const SemVersionRangeOptions StandardRangeOptions = SemVersionRangeOptions.OptionalMinorPatch | SemVersionRangeOptions.AllowLowerV | SemVersionRangeOptions.AllowMetadata;

		private static readonly SemVersionParsingOptions ParsingOptions = new SemVersionParsingOptions(allowWildcardMajorMinorPatch: true, allowWildcardPrerelease: false, missingVersionsAreWildcards: true, (char c) => c == 'x' || c == 'X' || c == '*');

		public static Exception Parse(string range, bool includeAllPrerelease, Exception ex, int maxLength, out SemVersionRange semverRange)
		{
			SemVersionRangeOptions semVersionRangeOptions = SemVersionRangeOptions.OptionalMinorPatch | SemVersionRangeOptions.AllowLowerV | SemVersionRangeOptions.AllowMetadata;
			if (includeAllPrerelease)
			{
				semVersionRangeOptions |= SemVersionRangeOptions.IncludeAllPrerelease;
			}
			return Parse(range, semVersionRangeOptions, ex, maxLength, out semverRange);
		}

		private static Exception Parse(string range, SemVersionRangeOptions rangeOptions, Exception ex, int maxLength, out SemVersionRange semverRange)
		{
			semverRange = null;
			if (range == null)
			{
				return ex ?? new ArgumentNullException("range");
			}
			if (range.Length > maxLength)
			{
				return ex ?? RangeError.TooLong(range, maxLength);
			}
			List<UnbrokenSemVersionRange> list = new List<UnbrokenSemVersionRange>(GeneralRangeParser.CountSplitOnOrOperator(range));
			foreach (StringSegment item in GeneralRangeParser.SplitOnOrOperator(range))
			{
				UnbrokenSemVersionRange unbrokenRange;
				Exception ex2 = ParseUnbrokenRange(item, rangeOptions, ex, maxLength, out unbrokenRange);
				if (ex2 == null)
				{
					list.Add(unbrokenRange);
					continue;
				}
				return ex2;
			}
			semverRange = SemVersionRange.Create(list);
			return null;
		}

		private static Exception ParseUnbrokenRange(StringSegment segment, SemVersionRangeOptions rangeOptions, Exception ex, int maxLength, out UnbrokenSemVersionRange unbrokenRange)
		{
			unbrokenRange = null;
			bool flag = rangeOptions.HasOption(SemVersionRangeOptions.IncludeAllPrerelease);
			LeftBoundedRange leftBound = LeftBoundedRange.Unbounded;
			RightBoundedRange rightBound = RightBoundedRange.Unbounded;
			if (TrySplitOnHyphenRangeSeparator(segment, out var segment2, out var segment3))
			{
				Exception ex2 = ParseHyphenRange(segment2, segment3, rangeOptions, flag, ex, maxLength, ref leftBound, ref rightBound);
				if (ex2 != null)
				{
					return ex2;
				}
			}
			else
			{
				GeneralRangeParser.ParseOptionalWhitespace(ref segment);
				if (segment.IsEmpty)
				{
					unbrokenRange = (flag ? UnbrokenSemVersionRange.All : UnbrokenSemVersionRange.AllRelease);
					return null;
				}
				while (!segment.IsEmpty)
				{
					Exception ex3 = ParseComparison(ref segment, rangeOptions, flag, ex, maxLength, ref leftBound, ref rightBound);
					if (ex3 != null)
					{
						return ex3;
					}
				}
			}
			unbrokenRange = UnbrokenSemVersionRange.Create(leftBound, rightBound, flag);
			return null;
		}

		private static bool TrySplitOnHyphenRangeSeparator(StringSegment segment, out StringSegment segment1, out StringSegment segment2)
		{
			int num = segment.Length - 1;
			int num2 = 1;
			int num3;
			while (num2 < segment.Length && (num3 = segment.IndexOf('-', num2, num - num2)) >= 0)
			{
				int num4 = num3 - 1;
				int num5 = num3 + 1;
				if (char.IsWhiteSpace(segment[num4]) && char.IsWhiteSpace(segment[num5]))
				{
					segment1 = segment.Subsegment(0, num4);
					segment2 = segment.Subsegment(num5 + 1);
					return true;
				}
				num2 = num5;
			}
			segment1 = (segment2 = segment);
			return false;
		}

		private static Exception ParseHyphenRange(StringSegment beforeHyphenSegment, StringSegment afterHyphenSegment, SemVersionRangeOptions rangeOptions, bool includeAllPrerelease, Exception ex, int maxLength, ref LeftBoundedRange leftBound, ref RightBoundedRange rightBound)
		{
			Exception ex2 = ParseHyphenSegment(beforeHyphenSegment, rangeOptions, ex, maxLength, out var semver, out var wildcardVersion);
			if (ex2 != null)
			{
				return ex2;
			}
			ex2 = ParseHyphenSegment(afterHyphenSegment, rangeOptions, ex, maxLength, out var semver2, out var wildcardVersion2);
			if (ex2 != null)
			{
				return ex2;
			}
			WildcardLowerBound(includeAllPrerelease, ref leftBound, semver, wildcardVersion);
			return WildcardUpperBound(ex, ref rightBound, afterHyphenSegment, semver2, wildcardVersion2);
		}

		private static Exception ParseHyphenSegment(StringSegment segment, SemVersionRangeOptions rangeOptions, Exception ex, int maxLength, out SemVersion semver, out WildcardVersion wildcardVersion)
		{
			semver = null;
			wildcardVersion = WildcardVersion.None;
			GeneralRangeParser.ParseOptionalWhitespace(ref segment);
			if (segment.Length == 0)
			{
				return ex ?? RangeError.MissingVersionInHyphenRange(segment.Source);
			}
			if (!GeneralRangeParser.IsPossibleVersionChar(segment[0], rangeOptions))
			{
				return ex ?? RangeError.UnexpectedInHyphenRange(segment[0].ToString());
			}
			Exception ex2 = ParseNpmVersion(ref segment, rangeOptions, ex, maxLength, out semver, out wildcardVersion);
			if (ex2 != null)
			{
				return ex2;
			}
			GeneralRangeParser.ParseOptionalWhitespace(ref segment);
			if (segment.Length != 0)
			{
				return ex ?? RangeError.UnexpectedInHyphenRange(segment.ToString());
			}
			return null;
		}

		private static Exception ParseComparison(ref StringSegment segment, SemVersionRangeOptions rangeOptions, bool includeAllPrerelease, Exception ex, int maxLength, ref LeftBoundedRange leftBound, ref RightBoundedRange rightBound)
		{
			Exception ex2 = ParseOperator(ref segment, ex, out var @operator);
			if (ex2 != null)
			{
				return ex2;
			}
			GeneralRangeParser.ParseOptionalWhitespace(ref segment);
			StringSegment stringSegment = segment;
			ex2 = ParseNpmVersion(ref segment, rangeOptions, ex, maxLength, out var semver, out var wildcardVersion);
			if (ex2 != null)
			{
				return ex2;
			}
			GeneralRangeParser.ParseOptionalWhitespace(ref segment);
			switch (@operator)
			{
			case StandardOperator.GreaterThan:
				return GreaterThan(includeAllPrerelease, ex, ref leftBound, stringSegment, semver, wildcardVersion);
			case StandardOperator.GreaterThanOrEqual:
				WildcardLowerBound(includeAllPrerelease, ref leftBound, semver, wildcardVersion);
				return null;
			case StandardOperator.LessThan:
				return LessThan(ref rightBound, semver, wildcardVersion);
			case StandardOperator.LessThanOrEqual:
				return WildcardUpperBound(ex, ref rightBound, stringSegment, semver, wildcardVersion);
			case StandardOperator.Caret:
			{
				if (wildcardVersion == WildcardVersion.MajorMinorPatchWildcard)
				{
					return null;
				}
				WildcardLowerBound(includeAllPrerelease, ref leftBound, semver, wildcardVersion);
				int major = 0;
				int minor2 = 0;
				int patch2 = 0;
				if (semver.Major != 0 || wildcardVersion == WildcardVersion.MinorPatchWildcard)
				{
					if (semver.Major == int.MaxValue)
					{
						return ex ?? RangeError.MaxVersion(stringSegment);
					}
					major = semver.Major + 1;
				}
				else if (semver.Minor != 0 || wildcardVersion == WildcardVersion.PatchWildcard)
				{
					if (semver.Minor == int.MaxValue)
					{
						return ex ?? RangeError.MaxVersion(stringSegment);
					}
					minor2 = semver.Minor + 1;
				}
				else
				{
					if (semver.Patch == int.MaxValue)
					{
						return ex ?? RangeError.MaxVersion(stringSegment);
					}
					patch2 = semver.Patch + 1;
				}
				rightBound = rightBound.Min(new RightBoundedRange(new SemVersion(major, minor2, patch2, "0", PrereleaseIdentifiers.Zero, "", ReadOnlyList<MetadataIdentifier>.Empty), inclusive: false));
				return null;
			}
			case StandardOperator.Tilde:
				if (wildcardVersion == WildcardVersion.MajorMinorPatchWildcard)
				{
					return null;
				}
				WildcardLowerBound(includeAllPrerelease, ref leftBound, semver, wildcardVersion);
				if (wildcardVersion == WildcardVersion.MinorPatchWildcard)
				{
					if (semver.Major == int.MaxValue)
					{
						return ex ?? RangeError.MaxVersion(stringSegment);
					}
					rightBound = rightBound.Min(new RightBoundedRange(new SemVersion(semver.Major + 1, 0, 0, "0", PrereleaseIdentifiers.Zero, "", ReadOnlyList<MetadataIdentifier>.Empty), inclusive: false));
				}
				else
				{
					if (semver.Minor == int.MaxValue)
					{
						return ex ?? RangeError.MaxVersion(stringSegment);
					}
					SemVersion semVersion = semver;
					int? minor = semver.Minor + 1;
					int? patch = 0;
					IEnumerable<PrereleaseIdentifier> zero = PrereleaseIdentifiers.Zero;
					rightBound = rightBound.Min(new RightBoundedRange(semVersion.With(null, minor, patch, zero), inclusive: false));
				}
				return null;
			case StandardOperator.None:
			case StandardOperator.Equals:
				WildcardLowerBound(includeAllPrerelease, ref leftBound, semver, wildcardVersion);
				return WildcardUpperBound(ex, ref rightBound, stringSegment, semver, wildcardVersion);
			default:
				throw Unreachable.InvalidEnum(@operator);
			}
		}

		public static Exception ParseNpmVersion(ref StringSegment segment, SemVersionRangeOptions rangeOptions, Exception ex, int maxLength, out SemVersion semver, out WildcardVersion wildcardVersion)
		{
			Exception ex2 = GeneralRangeParser.ParseVersion(ref segment, rangeOptions, ParsingOptions, ex, maxLength, out semver, out wildcardVersion);
			if (ex2 != null)
			{
				return ex2;
			}
			if (wildcardVersion != 0 && semver.IsPrerelease)
			{
				return ex ?? RangeError.PrereleaseNotSupportedWithWildcardVersion(segment.Source);
			}
			semver = semver.WithoutMetadata();
			return null;
		}

		private static Exception GreaterThan(bool includeAllPrerelease, Exception ex, ref LeftBoundedRange leftBound, StringSegment versionSegment, SemVersion semver, WildcardVersion wildcardVersion)
		{
			bool inclusive;
			switch (wildcardVersion)
			{
			case WildcardVersion.MajorMinorPatchWildcard:
				leftBound = leftBound.Max(new LeftBoundedRange(SemVersion.Max, inclusive: false));
				return null;
			case WildcardVersion.MinorPatchWildcard:
			{
				if (semver.Major == int.MaxValue)
				{
					return ex ?? RangeError.MaxVersion(versionSegment);
				}
				string prerelease2 = (includeAllPrerelease ? "0" : "");
				IReadOnlyList<PrereleaseIdentifier> prereleaseIdentifiers2 = (includeAllPrerelease ? PrereleaseIdentifiers.Zero : ReadOnlyList<PrereleaseIdentifier>.Empty);
				semver = new SemVersion(semver.Major + 1, 0, 0, prerelease2, prereleaseIdentifiers2, "", ReadOnlyList<MetadataIdentifier>.Empty);
				inclusive = true;
				break;
			}
			case WildcardVersion.PatchWildcard:
			{
				if (semver.Minor == int.MaxValue)
				{
					return ex ?? RangeError.MaxVersion(versionSegment);
				}
				string prerelease = (includeAllPrerelease ? "0" : "");
				IReadOnlyList<PrereleaseIdentifier> prereleaseIdentifiers = (includeAllPrerelease ? PrereleaseIdentifiers.Zero : ReadOnlyList<PrereleaseIdentifier>.Empty);
				semver = new SemVersion(semver.Major, semver.Minor + 1, 0, prerelease, prereleaseIdentifiers, "", ReadOnlyList<MetadataIdentifier>.Empty);
			

SOTFEdit.Companion.Shared.dll

Decompiled 5 months ago
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using MessagePack;
using MessagePack.Formatters;
using MessagePack.Formatters.SOTFEdit.Companion.Shared;
using MessagePack.Formatters.SOTFEdit.Companion.Shared.Messages;
using MessagePack.Internal;
using MessagePack.Resolvers;
using Microsoft.CodeAnalysis;
using SOTFEdit.Companion.Shared;
using SOTFEdit.Companion.Shared.Messages;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SOTFEdit.Companion.Shared")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+91a5dd6e2295d7b1047f4efc60a29b5ee578016a")]
[assembly: AssemblyProduct("SOTFEdit.Companion.Shared")]
[assembly: AssemblyTitle("SOTFEdit.Companion.Shared")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace MessagePack.Formatters.SOTFEdit.Companion.Shared
{
	public sealed class CharacterTargetFormatter : IMessagePackFormatter<CharacterTarget>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, CharacterTarget value, MessagePackSerializerOptions options)
		{
			((MessagePackWriter)(ref writer)).Write((int)value);
		}

		public CharacterTarget Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			return (CharacterTarget)((MessagePackReader)(ref reader)).ReadInt32();
		}
	}
	public sealed class PoiGroupTypeFormatter : IMessagePackFormatter<PoiGroupType>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, PoiGroupType value, MessagePackSerializerOptions options)
		{
			((MessagePackWriter)(ref writer)).Write((int)value);
		}

		public PoiGroupType Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			return (PoiGroupType)((MessagePackReader)(ref reader)).ReadInt32();
		}
	}
}
namespace MessagePack.Formatters.SOTFEdit.Companion.Shared.Messages
{
	public sealed class ICompanionMessageFormatter : IMessagePackFormatter<ICompanionMessage>, IMessagePackFormatter
	{
		private readonly Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>> typeToKeyAndJumpMap;

		private readonly Dictionary<int, int> keyToJumpMap;

		public ICompanionMessageFormatter()
		{
			typeToKeyAndJumpMap = new Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>(10, RuntimeTypeHandleEqualityComparer.Default)
			{
				{
					typeof(CompanionPosMessage).TypeHandle,
					new KeyValuePair<int, int>(0, 0)
				},
				{
					typeof(CompanionPosCollectionMessage).TypeHandle,
					new KeyValuePair<int, int>(1, 1)
				},
				{
					typeof(CompanionTeleportMessage).TypeHandle,
					new KeyValuePair<int, int>(2, 2)
				},
				{
					typeof(CompanionAddPoiMessage).TypeHandle,
					new KeyValuePair<int, int>(3, 3)
				},
				{
					typeof(CompanionPoiListMessage).TypeHandle,
					new KeyValuePair<int, int>(4, 4)
				},
				{
					typeof(CompanionPoiMessage).TypeHandle,
					new KeyValuePair<int, int>(5, 5)
				},
				{
					typeof(CompanionDumpScenesMessage).TypeHandle,
					new KeyValuePair<int, int>(6, 6)
				},
				{
					typeof(CompanionRequestPoiUpdateMessage).TypeHandle,
					new KeyValuePair<int, int>(7, 7)
				},
				{
					typeof(CompanionNetworkPlayerUpdateMessage).TypeHandle,
					new KeyValuePair<int, int>(8, 8)
				},
				{
					typeof(CompanionSettingsMessage).TypeHandle,
					new KeyValuePair<int, int>(9, 9)
				}
			};
			keyToJumpMap = new Dictionary<int, int>(10)
			{
				{ 0, 0 },
				{ 1, 1 },
				{ 2, 2 },
				{ 3, 3 },
				{ 4, 4 },
				{ 5, 5 },
				{ 6, 6 },
				{ 7, 7 },
				{ 8, 8 },
				{ 9, 9 }
			};
		}

		public void Serialize(ref MessagePackWriter writer, ICompanionMessage value, MessagePackSerializerOptions options)
		{
			if (value != null && typeToKeyAndJumpMap.TryGetValue(value.GetType().TypeHandle, out var value2))
			{
				((MessagePackWriter)(ref writer)).WriteArrayHeader(2);
				((MessagePackWriter)(ref writer)).WriteInt32(value2.Key);
				switch (value2.Value)
				{
				case 0:
					FormatterResolverExtensions.GetFormatterWithVerify<CompanionPosMessage>(options.Resolver).Serialize(ref writer, (CompanionPosMessage)value, options);
					break;
				case 1:
					FormatterResolverExtensions.GetFormatterWithVerify<CompanionPosCollectionMessage>(options.Resolver).Serialize(ref writer, (CompanionPosCollectionMessage)value, options);
					break;
				case 2:
					FormatterResolverExtensions.GetFormatterWithVerify<CompanionTeleportMessage>(options.Resolver).Serialize(ref writer, (CompanionTeleportMessage)value, options);
					break;
				case 3:
					FormatterResolverExtensions.GetFormatterWithVerify<CompanionAddPoiMessage>(options.Resolver).Serialize(ref writer, (CompanionAddPoiMessage)value, options);
					break;
				case 4:
					FormatterResolverExtensions.GetFormatterWithVerify<CompanionPoiListMessage>(options.Resolver).Serialize(ref writer, (CompanionPoiListMessage)value, options);
					break;
				case 5:
					FormatterResolverExtensions.GetFormatterWithVerify<CompanionPoiMessage>(options.Resolver).Serialize(ref writer, (CompanionPoiMessage)value, options);
					break;
				case 6:
					FormatterResolverExtensions.GetFormatterWithVerify<CompanionDumpScenesMessage>(options.Resolver).Serialize(ref writer, (CompanionDumpScenesMessage)value, options);
					break;
				case 7:
					FormatterResolverExtensions.GetFormatterWithVerify<CompanionRequestPoiUpdateMessage>(options.Resolver).Serialize(ref writer, (CompanionRequestPoiUpdateMessage)value, options);
					break;
				case 8:
					FormatterResolverExtensions.GetFormatterWithVerify<CompanionNetworkPlayerUpdateMessage>(options.Resolver).Serialize(ref writer, (CompanionNetworkPlayerUpdateMessage)value, options);
					break;
				case 9:
					FormatterResolverExtensions.GetFormatterWithVerify<CompanionSettingsMessage>(options.Resolver).Serialize(ref writer, (CompanionSettingsMessage)value, options);
					break;
				}
			}
			else
			{
				((MessagePackWriter)(ref writer)).WriteNil();
			}
		}

		public ICompanionMessage Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			if (((MessagePackReader)(ref reader)).TryReadNil())
			{
				return null;
			}
			if (((MessagePackReader)(ref reader)).ReadArrayHeader() != 2)
			{
				throw new InvalidOperationException("Invalid Union data was detected. Type:global::SOTFEdit.Companion.Shared.Messages.ICompanionMessage");
			}
			options.Security.DepthStep(ref reader);
			int value = ((MessagePackReader)(ref reader)).ReadInt32();
			if (!keyToJumpMap.TryGetValue(value, out value))
			{
				value = -1;
			}
			ICompanionMessage result = null;
			switch (value)
			{
			case 0:
				result = FormatterResolverExtensions.GetFormatterWithVerify<CompanionPosMessage>(options.Resolver).Deserialize(ref reader, options);
				break;
			case 1:
				result = FormatterResolverExtensions.GetFormatterWithVerify<CompanionPosCollectionMessage>(options.Resolver).Deserialize(ref reader, options);
				break;
			case 2:
				result = FormatterResolverExtensions.GetFormatterWithVerify<CompanionTeleportMessage>(options.Resolver).Deserialize(ref reader, options);
				break;
			case 3:
				result = FormatterResolverExtensions.GetFormatterWithVerify<CompanionAddPoiMessage>(options.Resolver).Deserialize(ref reader, options);
				break;
			case 4:
				result = FormatterResolverExtensions.GetFormatterWithVerify<CompanionPoiListMessage>(options.Resolver).Deserialize(ref reader, options);
				break;
			case 5:
				result = FormatterResolverExtensions.GetFormatterWithVerify<CompanionPoiMessage>(options.Resolver).Deserialize(ref reader, options);
				break;
			case 6:
				result = FormatterResolverExtensions.GetFormatterWithVerify<CompanionDumpScenesMessage>(options.Resolver).Deserialize(ref reader, options);
				break;
			case 7:
				result = FormatterResolverExtensions.GetFormatterWithVerify<CompanionRequestPoiUpdateMessage>(options.Resolver).Deserialize(ref reader, options);
				break;
			case 8:
				result = FormatterResolverExtensions.GetFormatterWithVerify<CompanionNetworkPlayerUpdateMessage>(options.Resolver).Deserialize(ref reader, options);
				break;
			case 9:
				result = FormatterResolverExtensions.GetFormatterWithVerify<CompanionSettingsMessage>(options.Resolver).Deserialize(ref reader, options);
				break;
			default:
				((MessagePackReader)(ref reader)).Skip();
				break;
			}
			int depth = ((MessagePackReader)(ref reader)).Depth;
			((MessagePackReader)(ref reader)).Depth = depth - 1;
			return result;
		}
	}
	public sealed class CompanionAddPoiMessageFormatter : IMessagePackFormatter<CompanionAddPoiMessage>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, CompanionAddPoiMessage value, MessagePackSerializerOptions options)
		{
			if (value == null)
			{
				((MessagePackWriter)(ref writer)).WriteNil();
				return;
			}
			IFormatterResolver resolver = options.Resolver;
			((MessagePackWriter)(ref writer)).WriteArrayHeader(7);
			FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Serialize(ref writer, value.Title, options);
			FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Serialize(ref writer, value.Description, options);
			((MessagePackWriter)(ref writer)).Write(value.Screenshot);
			((MessagePackWriter)(ref writer)).Write(value.X);
			((MessagePackWriter)(ref writer)).Write(value.Y);
			((MessagePackWriter)(ref writer)).Write(value.Z);
			((MessagePackWriter)(ref writer)).Write(value.AreaMask);
		}

		public CompanionAddPoiMessage Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			if (((MessagePackReader)(ref reader)).TryReadNil())
			{
				return null;
			}
			options.Security.DepthStep(ref reader);
			IFormatterResolver resolver = options.Resolver;
			int num = ((MessagePackReader)(ref reader)).ReadArrayHeader();
			CompanionAddPoiMessage companionAddPoiMessage = new CompanionAddPoiMessage();
			for (int i = 0; i < num; i++)
			{
				switch (i)
				{
				case 0:
					companionAddPoiMessage.Title = FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Deserialize(ref reader, options);
					break;
				case 1:
					companionAddPoiMessage.Description = FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Deserialize(ref reader, options);
					break;
				case 2:
				{
					ReadOnlySequence<byte>? readOnlySequence = ((MessagePackReader)(ref reader)).ReadBytes();
					companionAddPoiMessage.Screenshot = CodeGenHelpers.GetArrayFromNullableSequence(ref readOnlySequence);
					break;
				}
				case 3:
					companionAddPoiMessage.X = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 4:
					companionAddPoiMessage.Y = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 5:
					companionAddPoiMessage.Z = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 6:
					companionAddPoiMessage.AreaMask = ((MessagePackReader)(ref reader)).ReadInt32();
					break;
				default:
					((MessagePackReader)(ref reader)).Skip();
					break;
				}
			}
			int depth = ((MessagePackReader)(ref reader)).Depth;
			((MessagePackReader)(ref reader)).Depth = depth - 1;
			return companionAddPoiMessage;
		}
	}
	public sealed class CompanionDumpScenesMessageFormatter : IMessagePackFormatter<CompanionDumpScenesMessage>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, CompanionDumpScenesMessage value, MessagePackSerializerOptions options)
		{
			if (value == null)
			{
				((MessagePackWriter)(ref writer)).WriteNil();
			}
			else
			{
				((MessagePackWriter)(ref writer)).WriteArrayHeader(0);
			}
		}

		public CompanionDumpScenesMessage Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			if (((MessagePackReader)(ref reader)).TryReadNil())
			{
				return null;
			}
			((MessagePackReader)(ref reader)).Skip();
			return new CompanionDumpScenesMessage();
		}
	}
	public sealed class CompanionNetworkPlayerUpdateMessageFormatter : IMessagePackFormatter<CompanionNetworkPlayerUpdateMessage>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, CompanionNetworkPlayerUpdateMessage value, MessagePackSerializerOptions options)
		{
			if (value == null)
			{
				((MessagePackWriter)(ref writer)).WriteNil();
				return;
			}
			IFormatterResolver resolver = options.Resolver;
			((MessagePackWriter)(ref writer)).WriteArrayHeader(2);
			FormatterResolverExtensions.GetFormatterWithVerify<HashSet<int>>(resolver).Serialize(ref writer, value.Added, options);
			FormatterResolverExtensions.GetFormatterWithVerify<HashSet<int>>(resolver).Serialize(ref writer, value.Deleted, options);
		}

		public CompanionNetworkPlayerUpdateMessage Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			if (((MessagePackReader)(ref reader)).TryReadNil())
			{
				return null;
			}
			options.Security.DepthStep(ref reader);
			IFormatterResolver resolver = options.Resolver;
			int num = ((MessagePackReader)(ref reader)).ReadArrayHeader();
			CompanionNetworkPlayerUpdateMessage companionNetworkPlayerUpdateMessage = new CompanionNetworkPlayerUpdateMessage();
			for (int i = 0; i < num; i++)
			{
				switch (i)
				{
				case 0:
					companionNetworkPlayerUpdateMessage.Added = FormatterResolverExtensions.GetFormatterWithVerify<HashSet<int>>(resolver).Deserialize(ref reader, options);
					break;
				case 1:
					companionNetworkPlayerUpdateMessage.Deleted = FormatterResolverExtensions.GetFormatterWithVerify<HashSet<int>>(resolver).Deserialize(ref reader, options);
					break;
				default:
					((MessagePackReader)(ref reader)).Skip();
					break;
				}
			}
			int depth = ((MessagePackReader)(ref reader)).Depth;
			((MessagePackReader)(ref reader)).Depth = depth - 1;
			return companionNetworkPlayerUpdateMessage;
		}
	}
	public sealed class CompanionPoiListMessageFormatter : IMessagePackFormatter<CompanionPoiListMessage>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, CompanionPoiListMessage value, MessagePackSerializerOptions options)
		{
			if (value == null)
			{
				((MessagePackWriter)(ref writer)).WriteNil();
				return;
			}
			IFormatterResolver resolver = options.Resolver;
			((MessagePackWriter)(ref writer)).WriteArrayHeader(2);
			FormatterResolverExtensions.GetFormatterWithVerify<PoiGroupType>(resolver).Serialize(ref writer, value.Type, options);
			FormatterResolverExtensions.GetFormatterWithVerify<List<CompanionPoiMessage>>(resolver).Serialize(ref writer, value.Pois, options);
		}

		public CompanionPoiListMessage Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			if (((MessagePackReader)(ref reader)).TryReadNil())
			{
				return null;
			}
			options.Security.DepthStep(ref reader);
			IFormatterResolver resolver = options.Resolver;
			int num = ((MessagePackReader)(ref reader)).ReadArrayHeader();
			PoiGroupType type = PoiGroupType.Generic;
			List<CompanionPoiMessage> pois = null;
			for (int i = 0; i < num; i++)
			{
				switch (i)
				{
				case 0:
					type = FormatterResolverExtensions.GetFormatterWithVerify<PoiGroupType>(resolver).Deserialize(ref reader, options);
					break;
				case 1:
					pois = FormatterResolverExtensions.GetFormatterWithVerify<List<CompanionPoiMessage>>(resolver).Deserialize(ref reader, options);
					break;
				default:
					((MessagePackReader)(ref reader)).Skip();
					break;
				}
			}
			CompanionPoiListMessage result = new CompanionPoiListMessage(type, pois);
			int depth = ((MessagePackReader)(ref reader)).Depth;
			((MessagePackReader)(ref reader)).Depth = depth - 1;
			return result;
		}
	}
	public sealed class CompanionPoiMessageFormatter : IMessagePackFormatter<CompanionPoiMessage>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, CompanionPoiMessage value, MessagePackSerializerOptions options)
		{
			if (value == null)
			{
				((MessagePackWriter)(ref writer)).WriteNil();
				return;
			}
			IFormatterResolver resolver = options.Resolver;
			((MessagePackWriter)(ref writer)).WriteArrayHeader(7);
			FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Serialize(ref writer, value.Title, options);
			FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Serialize(ref writer, value.Description, options);
			((MessagePackWriter)(ref writer)).Write(value.X);
			((MessagePackWriter)(ref writer)).Write(value.Y);
			((MessagePackWriter)(ref writer)).Write(value.Z);
			((MessagePackWriter)(ref writer)).Write(value.AreaMask);
			FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Serialize(ref writer, value.ScreenshotPath, options);
		}

		public CompanionPoiMessage Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			if (((MessagePackReader)(ref reader)).TryReadNil())
			{
				return null;
			}
			options.Security.DepthStep(ref reader);
			IFormatterResolver resolver = options.Resolver;
			int num = ((MessagePackReader)(ref reader)).ReadArrayHeader();
			string title = null;
			string description = null;
			float x = 0f;
			float y = 0f;
			float z = 0f;
			int areaMask = 0;
			string screenshotPath = null;
			for (int i = 0; i < num; i++)
			{
				switch (i)
				{
				case 0:
					title = FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Deserialize(ref reader, options);
					break;
				case 1:
					description = FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Deserialize(ref reader, options);
					break;
				case 2:
					x = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 3:
					y = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 4:
					z = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 5:
					areaMask = ((MessagePackReader)(ref reader)).ReadInt32();
					break;
				case 6:
					screenshotPath = FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Deserialize(ref reader, options);
					break;
				default:
					((MessagePackReader)(ref reader)).Skip();
					break;
				}
			}
			CompanionPoiMessage result = new CompanionPoiMessage(title, description, x, y, z, areaMask, screenshotPath);
			int depth = ((MessagePackReader)(ref reader)).Depth;
			((MessagePackReader)(ref reader)).Depth = depth - 1;
			return result;
		}
	}
	public sealed class CompanionPosCollectionMessageFormatter : IMessagePackFormatter<CompanionPosCollectionMessage>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, CompanionPosCollectionMessage value, MessagePackSerializerOptions options)
		{
			if (value == null)
			{
				((MessagePackWriter)(ref writer)).WriteNil();
				return;
			}
			IFormatterResolver resolver = options.Resolver;
			((MessagePackWriter)(ref writer)).WriteArrayHeader(1);
			FormatterResolverExtensions.GetFormatterWithVerify<List<CompanionPosMessage>>(resolver).Serialize(ref writer, value.Positions, options);
		}

		public CompanionPosCollectionMessage Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			if (((MessagePackReader)(ref reader)).TryReadNil())
			{
				return null;
			}
			options.Security.DepthStep(ref reader);
			IFormatterResolver resolver = options.Resolver;
			int num = ((MessagePackReader)(ref reader)).ReadArrayHeader();
			CompanionPosCollectionMessage companionPosCollectionMessage = new CompanionPosCollectionMessage();
			for (int i = 0; i < num; i++)
			{
				if (i == 0)
				{
					companionPosCollectionMessage.Positions = FormatterResolverExtensions.GetFormatterWithVerify<List<CompanionPosMessage>>(resolver).Deserialize(ref reader, options);
				}
				else
				{
					((MessagePackReader)(ref reader)).Skip();
				}
			}
			int depth = ((MessagePackReader)(ref reader)).Depth;
			((MessagePackReader)(ref reader)).Depth = depth - 1;
			return companionPosCollectionMessage;
		}
	}
	public sealed class CompanionPosMessageFormatter : IMessagePackFormatter<CompanionPosMessage>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, CompanionPosMessage value, MessagePackSerializerOptions options)
		{
			if (value == null)
			{
				((MessagePackWriter)(ref writer)).WriteNil();
				return;
			}
			IFormatterResolver resolver = options.Resolver;
			((MessagePackWriter)(ref writer)).WriteArrayHeader(8);
			FormatterResolverExtensions.GetFormatterWithVerify<CharacterTarget>(resolver).Serialize(ref writer, value.Target, options);
			((MessagePackWriter)(ref writer)).Write(value.X);
			((MessagePackWriter)(ref writer)).Write(value.Y);
			((MessagePackWriter)(ref writer)).Write(value.Z);
			((MessagePackWriter)(ref writer)).Write(value.Rotation);
			((MessagePackWriter)(ref writer)).Write(value.Mask);
			((MessagePackWriter)(ref writer)).Write(value.InstanceId);
			FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Serialize(ref writer, value.Name, options);
		}

		public CompanionPosMessage Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			if (((MessagePackReader)(ref reader)).TryReadNil())
			{
				return null;
			}
			options.Security.DepthStep(ref reader);
			IFormatterResolver resolver = options.Resolver;
			int num = ((MessagePackReader)(ref reader)).ReadArrayHeader();
			CompanionPosMessage companionPosMessage = new CompanionPosMessage();
			for (int i = 0; i < num; i++)
			{
				switch (i)
				{
				case 0:
					companionPosMessage.Target = FormatterResolverExtensions.GetFormatterWithVerify<CharacterTarget>(resolver).Deserialize(ref reader, options);
					break;
				case 1:
					companionPosMessage.X = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 2:
					companionPosMessage.Y = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 3:
					companionPosMessage.Z = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 4:
					companionPosMessage.Rotation = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 5:
					companionPosMessage.Mask = ((MessagePackReader)(ref reader)).ReadInt32();
					break;
				case 6:
					companionPosMessage.InstanceId = ((MessagePackReader)(ref reader)).ReadInt32();
					break;
				case 7:
					companionPosMessage.Name = FormatterResolverExtensions.GetFormatterWithVerify<string>(resolver).Deserialize(ref reader, options);
					break;
				default:
					((MessagePackReader)(ref reader)).Skip();
					break;
				}
			}
			int depth = ((MessagePackReader)(ref reader)).Depth;
			((MessagePackReader)(ref reader)).Depth = depth - 1;
			return companionPosMessage;
		}
	}
	public sealed class CompanionRequestPoiUpdateMessageFormatter : IMessagePackFormatter<CompanionRequestPoiUpdateMessage>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, CompanionRequestPoiUpdateMessage value, MessagePackSerializerOptions options)
		{
			if (value == null)
			{
				((MessagePackWriter)(ref writer)).WriteNil();
				return;
			}
			IFormatterResolver resolver = options.Resolver;
			((MessagePackWriter)(ref writer)).WriteArrayHeader(1);
			FormatterResolverExtensions.GetFormatterWithVerify<PoiGroupType>(resolver).Serialize(ref writer, value.Type, options);
		}

		public CompanionRequestPoiUpdateMessage Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			if (((MessagePackReader)(ref reader)).TryReadNil())
			{
				return null;
			}
			options.Security.DepthStep(ref reader);
			IFormatterResolver resolver = options.Resolver;
			int num = ((MessagePackReader)(ref reader)).ReadArrayHeader();
			CompanionRequestPoiUpdateMessage companionRequestPoiUpdateMessage = new CompanionRequestPoiUpdateMessage();
			for (int i = 0; i < num; i++)
			{
				if (i == 0)
				{
					companionRequestPoiUpdateMessage.Type = FormatterResolverExtensions.GetFormatterWithVerify<PoiGroupType>(resolver).Deserialize(ref reader, options);
				}
				else
				{
					((MessagePackReader)(ref reader)).Skip();
				}
			}
			int depth = ((MessagePackReader)(ref reader)).Depth;
			((MessagePackReader)(ref reader)).Depth = depth - 1;
			return companionRequestPoiUpdateMessage;
		}
	}
	public sealed class CompanionSettingsMessageFormatter : IMessagePackFormatter<CompanionSettingsMessage>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, CompanionSettingsMessage value, MessagePackSerializerOptions options)
		{
			if (value == null)
			{
				((MessagePackWriter)(ref writer)).WriteNil();
				return;
			}
			IFormatterResolver resolver = options.Resolver;
			((MessagePackWriter)(ref writer)).WriteArrayHeader(1);
			FormatterResolverExtensions.GetFormatterWithVerify<decimal>(resolver).Serialize(ref writer, value.PositionUpdateFrequency, options);
		}

		public CompanionSettingsMessage Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			if (((MessagePackReader)(ref reader)).TryReadNil())
			{
				return null;
			}
			options.Security.DepthStep(ref reader);
			IFormatterResolver resolver = options.Resolver;
			int num = ((MessagePackReader)(ref reader)).ReadArrayHeader();
			CompanionSettingsMessage companionSettingsMessage = new CompanionSettingsMessage();
			for (int i = 0; i < num; i++)
			{
				if (i == 0)
				{
					companionSettingsMessage.PositionUpdateFrequency = FormatterResolverExtensions.GetFormatterWithVerify<decimal>(resolver).Deserialize(ref reader, options);
				}
				else
				{
					((MessagePackReader)(ref reader)).Skip();
				}
			}
			int depth = ((MessagePackReader)(ref reader)).Depth;
			((MessagePackReader)(ref reader)).Depth = depth - 1;
			return companionSettingsMessage;
		}
	}
	public sealed class CompanionTeleportMessageFormatter : IMessagePackFormatter<CompanionTeleportMessage>, IMessagePackFormatter
	{
		public void Serialize(ref MessagePackWriter writer, CompanionTeleportMessage value, MessagePackSerializerOptions options)
		{
			if (value == null)
			{
				((MessagePackWriter)(ref writer)).WriteNil();
				return;
			}
			IFormatterResolver resolver = options.Resolver;
			((MessagePackWriter)(ref writer)).WriteArrayHeader(6);
			FormatterResolverExtensions.GetFormatterWithVerify<CharacterTarget>(resolver).Serialize(ref writer, value.Target, options);
			((MessagePackWriter)(ref writer)).Write(value.X);
			((MessagePackWriter)(ref writer)).Write(value.Y);
			((MessagePackWriter)(ref writer)).Write(value.Z);
			((MessagePackWriter)(ref writer)).Write(value.AreaMask);
			((MessagePackWriter)(ref writer)).Write(value.GraphMask);
		}

		public CompanionTeleportMessage Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
		{
			if (((MessagePackReader)(ref reader)).TryReadNil())
			{
				return null;
			}
			options.Security.DepthStep(ref reader);
			IFormatterResolver resolver = options.Resolver;
			int num = ((MessagePackReader)(ref reader)).ReadArrayHeader();
			CompanionTeleportMessage companionTeleportMessage = new CompanionTeleportMessage();
			for (int i = 0; i < num; i++)
			{
				switch (i)
				{
				case 0:
					companionTeleportMessage.Target = FormatterResolverExtensions.GetFormatterWithVerify<CharacterTarget>(resolver).Deserialize(ref reader, options);
					break;
				case 1:
					companionTeleportMessage.X = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 2:
					companionTeleportMessage.Y = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 3:
					companionTeleportMessage.Z = ((MessagePackReader)(ref reader)).ReadSingle();
					break;
				case 4:
					companionTeleportMessage.AreaMask = ((MessagePackReader)(ref reader)).ReadInt32();
					break;
				case 5:
					companionTeleportMessage.GraphMask = ((MessagePackReader)(ref reader)).ReadInt32();
					break;
				default:
					((MessagePackReader)(ref reader)).Skip();
					break;
				}
			}
			int depth = ((MessagePackReader)(ref reader)).Depth;
			((MessagePackReader)(ref reader)).Depth = depth - 1;
			return companionTeleportMessage;
		}
	}
}
namespace MessagePack.Resolvers
{
	public class GeneratedResolver : IFormatterResolver
	{
		private static class FormatterCache<T>
		{
			internal static readonly IMessagePackFormatter<T> Formatter;

			static FormatterCache()
			{
				object formatter = GeneratedResolverGetFormatterHelper.GetFormatter(typeof(T));
				if (formatter != null)
				{
					Formatter = (IMessagePackFormatter<T>)formatter;
				}
			}
		}

		public static readonly IFormatterResolver Instance = (IFormatterResolver)(object)new GeneratedResolver();

		private GeneratedResolver()
		{
		}

		public IMessagePackFormatter<T> GetFormatter<T>()
		{
			return FormatterCache<T>.Formatter;
		}
	}
	internal static class GeneratedResolverGetFormatterHelper
	{
		private static readonly Dictionary<Type, int> lookup;

		static GeneratedResolverGetFormatterHelper()
		{
			lookup = new Dictionary<Type, int>(16)
			{
				{
					typeof(HashSet<int>),
					0
				},
				{
					typeof(List<CompanionPoiMessage>),
					1
				},
				{
					typeof(List<CompanionPosMessage>),
					2
				},
				{
					typeof(CharacterTarget),
					3
				},
				{
					typeof(PoiGroupType),
					4
				},
				{
					typeof(ICompanionMessage),
					5
				},
				{
					typeof(CompanionAddPoiMessage),
					6
				},
				{
					typeof(CompanionDumpScenesMessage),
					7
				},
				{
					typeof(CompanionNetworkPlayerUpdateMessage),
					8
				},
				{
					typeof(CompanionPoiListMessage),
					9
				},
				{
					typeof(CompanionPoiMessage),
					10
				},
				{
					typeof(CompanionPosCollectionMessage),
					11
				},
				{
					typeof(CompanionPosMessage),
					12
				},
				{
					typeof(CompanionRequestPoiUpdateMessage),
					13
				},
				{
					typeof(CompanionSettingsMessage),
					14
				},
				{
					typeof(CompanionTeleportMessage),
					15
				}
			};
		}

		internal static object GetFormatter(Type t)
		{
			if (!lookup.TryGetValue(t, out var value))
			{
				return null;
			}
			return value switch
			{
				0 => new HashSetFormatter<int>(), 
				1 => new ListFormatter<CompanionPoiMessage>(), 
				2 => new ListFormatter<CompanionPosMessage>(), 
				3 => new CharacterTargetFormatter(), 
				4 => new PoiGroupTypeFormatter(), 
				5 => new ICompanionMessageFormatter(), 
				6 => new CompanionAddPoiMessageFormatter(), 
				7 => new CompanionDumpScenesMessageFormatter(), 
				8 => new CompanionNetworkPlayerUpdateMessageFormatter(), 
				9 => new CompanionPoiListMessageFormatter(), 
				10 => new CompanionPoiMessageFormatter(), 
				11 => new CompanionPosCollectionMessageFormatter(), 
				12 => new CompanionPosMessageFormatter(), 
				13 => new CompanionRequestPoiUpdateMessageFormatter(), 
				14 => new CompanionSettingsMessageFormatter(), 
				15 => new CompanionTeleportMessageFormatter(), 
				_ => null, 
			};
		}
	}
}
namespace SOTFEdit.Companion.Shared
{
	public enum CharacterTarget
	{
		Player,
		Kelvin,
		Virginia,
		NetworkPlayer
	}
	public static class MessagePackInitializer
	{
		private static bool _initialized;

		public static void Initialize()
		{
			if (!_initialized)
			{
				StaticCompositeResolver.Instance.Register((IFormatterResolver[])(object)new IFormatterResolver[2]
				{
					GeneratedResolver.Instance,
					(IFormatterResolver)StandardResolver.Instance
				});
				MessagePackSerializer.DefaultOptions = MessagePackSerializerOptions.Standard.WithResolver((IFormatterResolver)(object)StaticCompositeResolver.Instance);
				_initialized = true;
			}
		}
	}
	public enum PoiGroupType
	{
		Generic,
		Custom,
		Items,
		Actors,
		WorldItems,
		Bunkers,
		Printers,
		Laptops,
		Caves,
		Camps,
		Villages,
		Helicopters,
		Info,
		Doors,
		Crates,
		Supply,
		Ammo,
		CannibalVillages,
		Ponds,
		Lakes,
		Structures,
		ZipLines,
		Player,
		Followers
	}
	public static class PoiGroupTypeUtils
	{
		public static PoiGroupType[] GetSupportedCompanionPoiGroupTypes()
		{
			return (from e in Enum.GetValues<PoiGroupType>().Where(delegate(PoiGroupType e)
				{
					switch (e)
					{
					case PoiGroupType.Custom:
					case PoiGroupType.Items:
					case PoiGroupType.WorldItems:
					case PoiGroupType.Bunkers:
					case PoiGroupType.Printers:
					case PoiGroupType.Laptops:
					case PoiGroupType.Caves:
					case PoiGroupType.Villages:
					case PoiGroupType.Helicopters:
					case PoiGroupType.Doors:
					case PoiGroupType.Lakes:
						return true;
					default:
						return false;
					}
				})
				orderby e.ToString()
				select e).ToArray();
		}
	}
}
namespace SOTFEdit.Companion.Shared.Messages
{
	[MessagePackObject(false)]
	public class CompanionAddPoiMessage : ICompanionMessage
	{
		[Key(0)]
		public string Title { get; set; }

		[Key(1)]
		public string Description { get; set; }

		[Key(2)]
		public byte[] Screenshot { get; set; }

		[Key(3)]
		public float X { get; set; }

		[Key(4)]
		public float Y { get; set; }

		[Key(5)]
		public float Z { get; set; }

		[Key(6)]
		public int AreaMask { get; set; }
	}
	[MessagePackObject(false)]
	public record CompanionDumpScenesMessage : ICompanionMessage;
	[MessagePackObject(false)]
	public class CompanionNetworkPlayerUpdateMessage : ICompanionMessage
	{
		[Key(0)]
		public HashSet<int>? Added { get; set; }

		[Key(1)]
		public HashSet<int>? Deleted { get; set; }
	}
	[MessagePackObject(false)]
	public class CompanionPoiListMessage : ICompanionMessage
	{
		[Key(0)]
		public PoiGroupType Type { get; }

		[Key(1)]
		public List<CompanionPoiMessage> Pois { get; }

		public CompanionPoiListMessage(PoiGroupType type, List<CompanionPoiMessage> pois)
		{
			Type = type;
			Pois = pois;
		}
	}
	[MessagePackObject(false)]
	public class CompanionPoiMessage : ICompanionMessage
	{
		[Key(0)]
		public string Title { get; init; }

		[Key(1)]
		public string? Description { get; init; }

		[Key(2)]
		public float X { get; init; }

		[Key(3)]
		public float Y { get; init; }

		[Key(4)]
		public float Z { get; init; }

		[Key(5)]
		public int AreaMask { get; init; }

		[Key(6)]
		public string? ScreenshotPath { get; init; }

		public CompanionPoiMessage(string title, string? description, float x, float y, float z, int areaMask, string? screenshotPath)
		{
			Title = title;
			Description = description;
			X = x;
			Y = y;
			Z = z;
			AreaMask = areaMask;
			ScreenshotPath = screenshotPath;
		}
	}
	[MessagePackObject(false)]
	public class CompanionPosCollectionMessage : ICompanionMessage
	{
		[Key(0)]
		public List<CompanionPosMessage> Positions { get; set; }
	}
	[MessagePackObject(false)]
	public record CompanionPosMessage : ICompanionMessage
	{
		[Key(0)]
		public CharacterTarget Target { get; set; }

		[Key(1)]
		public float X { get; set; }

		[Key(2)]
		public float Y { get; set; }

		[Key(3)]
		public float Z { get; set; }

		[Key(4)]
		public float Rotation { get; set; }

		[Key(5)]
		public int Mask { get; set; }

		[Key(6)]
		public int InstanceId { get; set; }

		[Key(7)]
		public string? Name { get; set; }
	}
	[MessagePackObject(false)]
	public class CompanionRequestPoiUpdateMessage : ICompanionMessage
	{
		[Key(0)]
		public PoiGroupType Type { get; set; }
	}
	[MessagePackObject(false)]
	public class CompanionSettingsMessage : ICompanionMessage
	{
		[Key(0)]
		public decimal PositionUpdateFrequency { get; set; }
	}
	[MessagePackObject(false)]
	public record CompanionTeleportMessage : ICompanionMessage
	{
		[Key(0)]
		public CharacterTarget Target { get; set; }

		[Key(1)]
		public float X { get; set; }

		[Key(2)]
		public float Y { get; set; }

		[Key(3)]
		public float Z { get; set; }

		[Key(4)]
		public int AreaMask { get; set; }

		[Key(5)]
		public int GraphMask { get; set; }
	}
	[Union(0, typeof(CompanionPosMessage))]
	[Union(1, typeof(CompanionPosCollectionMessage))]
	[Union(2, typeof(CompanionTeleportMessage))]
	[Union(3, typeof(CompanionAddPoiMessage))]
	[Union(4, typeof(CompanionPoiListMessage))]
	[Union(5, typeof(CompanionPoiMessage))]
	[Union(6, typeof(CompanionDumpScenesMessage))]
	[Union(7, typeof(CompanionRequestPoiUpdateMessage))]
	[Union(8, typeof(CompanionNetworkPlayerUpdateMessage))]
	[Union(9, typeof(CompanionSettingsMessage))]
	public interface ICompanionMessage
	{
	}
}

SOTFEdit.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net.Http;
using System.Net.WebSockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Resources;
using System.Windows.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.ComponentModel.__Internals;
using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using ControlzEx.Theming;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using Markdig.Wpf;
using MessagePack;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualBasic.FileIO;
using Microsoft.Xaml.Behaviors;
using NLog;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using SOTFEdit.Companion.Shared;
using SOTFEdit.Companion.Shared.Messages;
using SOTFEdit.Infrastructure;
using SOTFEdit.Infrastructure.Companion;
using SOTFEdit.Infrastructure.Converters;
using SOTFEdit.Model;
using SOTFEdit.Model.Actors;
using SOTFEdit.Model.Events;
using SOTFEdit.Model.Map;
using SOTFEdit.Model.Map.Static;
using SOTFEdit.Model.SaveData;
using SOTFEdit.Model.SaveData.Actor;
using SOTFEdit.Model.SaveData.Armour;
using SOTFEdit.Model.SaveData.Inventory;
using SOTFEdit.Model.SaveData.Storage;
using SOTFEdit.Model.SaveData.Storage.Module;
using SOTFEdit.Model.Savegame;
using SOTFEdit.Model.Storage;
using SOTFEdit.Model.WorldItem;
using SOTFEdit.View;
using SOTFEdit.View.Storage;
using SOTFEdit.ViewModel;
using Semver;
using WatsonWebsocket;
using ZoomControl;
using libc.translation;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: ThemeInfo(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyCompany("codengine")]
[assembly: AssemblyFileVersion("0.12.7")]
[assembly: AssemblyInformationalVersion("0.12.7")]
[assembly: AssemblyProduct("SOTFEdit")]
[assembly: AssemblyTitle("SOTFEdit")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: Guid("d59ec208-5fc6-4336-a9db-dbeb36938f78")]
[assembly: AssemblyAssociatedContentFile("icons8-kleine-axt-doodle-96.ico")]
[assembly: AssemblyAssociatedContentFile("images/map/bright.jpg")]
[assembly: AssemblyAssociatedContentFile("images/map/dark.jpg")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("0.12.7.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace CommunityToolkit.Mvvm.ComponentModel.__Internals
{
	[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.0.0.0")]
	[DebuggerNonUserCode]
	[ExcludeFromCodeCoverage]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[Obsolete("This type is not intended to be used directly by user code")]
	internal static class __KnownINotifyPropertyChangingArgs
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Status = new PropertyChangingEventArgs("Status");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Zoom = new PropertyChangingEventArgs("Zoom");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ZoomInverse = new PropertyChangingEventArgs("ZoomInverse");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Selected = new PropertyChangingEventArgs("Selected");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Affection = new PropertyChangingEventArgs("Affection");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Anger = new PropertyChangingEventArgs("Anger");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Energy = new PropertyChangingEventArgs("Energy");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Fear = new PropertyChangingEventArgs("Fear");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Fullness = new PropertyChangingEventArgs("Fullness");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Health = new PropertyChangingEventArgs("Health");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Hydration = new PropertyChangingEventArgs("Hydration");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Outfit = new PropertyChangingEventArgs("Outfit");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Pos = new PropertyChangingEventArgs("Pos");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs UniqueId = new PropertyChangingEventArgs("UniqueId");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs BoolValue = new PropertyChangingEventArgs("BoolValue");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs IntValue = new PropertyChangingEventArgs("IntValue");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedItem = new PropertyChangingEventArgs("SelectedItem");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs StringValue = new PropertyChangingEventArgs("StringValue");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Enabled = new PropertyChangingEventArgs("Enabled");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Filtered = new PropertyChangingEventArgs("Filtered");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs IsSelected = new PropertyChangingEventArgs("IsSelected");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Position = new PropertyChangingEventArgs("Position");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs X = new PropertyChangingEventArgs("X");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Z = new PropertyChangingEventArgs("Z");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs AreaFilter = new PropertyChangingEventArgs("AreaFilter");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs FullText = new PropertyChangingEventArgs("FullText");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs RequirementsFilter = new PropertyChangingEventArgs("RequirementsFilter");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ShowOnlyUncollectedItems = new PropertyChangingEventArgs("ShowOnlyUncollectedItems");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Title = new PropertyChangingEventArgs("Title");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs IsMoveRequested = new PropertyChangingEventArgs("IsMoveRequested");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs IsZiplineCreationRequested = new PropertyChangingEventArgs("IsZiplineCreationRequested");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs CurrentHealth = new PropertyChangingEventArgs("CurrentHealth");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs FullnessBuff = new PropertyChangingEventArgs("FullnessBuff");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs HydrationBuff = new PropertyChangingEventArgs("HydrationBuff");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs MaxHealth = new PropertyChangingEventArgs("MaxHealth");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Rest = new PropertyChangingEventArgs("Rest");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs RestBuff = new PropertyChangingEventArgs("RestBuff");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedCloth = new PropertyChangingEventArgs("SelectedCloth");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Sickness = new PropertyChangingEventArgs("Sickness");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Stamina = new PropertyChangingEventArgs("Stamina");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs StrengthLevel = new PropertyChangingEventArgs("StrengthLevel");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Sentiment = new PropertyChangingEventArgs("Sentiment");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs RemainingArmourpoints = new PropertyChangingEventArgs("RemainingArmourpoints");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Added = new PropertyChangingEventArgs("Added");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ScrewStructure = new PropertyChangingEventArgs("ScrewStructure");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Count = new PropertyChangingEventArgs("Count");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedItemForAll = new PropertyChangingEventArgs("SelectedItemForAll");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Address = new PropertyChangingEventArgs("Address");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ConnectTimeout = new PropertyChangingEventArgs("ConnectTimeout");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs KeepAliveInterval = new PropertyChangingEventArgs("KeepAliveInterval");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs MapPositionUpdateInterval = new PropertyChangingEventArgs("MapPositionUpdateInterval");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Port = new PropertyChangingEventArgs("Port");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs StatusText = new PropertyChangingEventArgs("StatusText");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ActorSelection = new PropertyChangingEventArgs("ActorSelection");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ModificationMode = new PropertyChangingEventArgs("ModificationMode");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs OnlyInSameAreaAsActor = new PropertyChangingEventArgs("OnlyInSameAreaAsActor");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SkipKelvin = new PropertyChangingEventArgs("SkipKelvin");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SkipVirginia = new PropertyChangingEventArgs("SkipVirginia");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ActorEnergy = new PropertyChangingEventArgs("ActorEnergy");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ActorHealth = new PropertyChangingEventArgs("ActorHealth");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs RemoveSpawner = new PropertyChangingEventArgs("RemoveSpawner");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ReplaceType = new PropertyChangingEventArgs("ReplaceType");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs TeleportMode = new PropertyChangingEventArgs("TeleportMode");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs UpdateEnergy = new PropertyChangingEventArgs("UpdateEnergy");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs UpdateHealth = new PropertyChangingEventArgs("UpdateHealth");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs UpdateInfluences = new PropertyChangingEventArgs("UpdateInfluences");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs InventoryFilter = new PropertyChangingEventArgs("InventoryFilter");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs UnassignedItemsFilter = new PropertyChangingEventArgs("UnassignedItemsFilter");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs FollowerItems = new PropertyChangingEventArgs("FollowerItems");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs FurnitureStructures = new PropertyChangingEventArgs("FurnitureStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs GardeningStructures = new PropertyChangingEventArgs("GardeningStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ItemConstruction = new PropertyChangingEventArgs("ItemConstruction");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ItemsInInventory = new PropertyChangingEventArgs("ItemsInInventory");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ItemsInWeaponRacks = new PropertyChangingEventArgs("ItemsInWeaponRacks");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs LogConstruction = new PropertyChangingEventArgs("LogConstruction");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs LogPlankConstruction = new PropertyChangingEventArgs("LogPlankConstruction");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs MiscStructures = new PropertyChangingEventArgs("MiscStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs StickConstruction = new PropertyChangingEventArgs("StickConstruction");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs StoneConstruction = new PropertyChangingEventArgs("StoneConstruction");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs StorageStructures = new PropertyChangingEventArgs("StorageStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs TrapsStructures = new PropertyChangingEventArgs("TrapsStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs UtilityStructures = new PropertyChangingEventArgs("UtilityStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs CheckVersionOnStartup = new PropertyChangingEventArgs("CheckVersionOnStartup");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs IsMapWindowClosed = new PropertyChangingEventArgs("IsMapWindowClosed");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs LastSaveGameMenuItem = new PropertyChangingEventArgs("LastSaveGameMenuItem");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs PinLeft = new PropertyChangingEventArgs("PinLeft");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs PinPos = new PropertyChangingEventArgs("PinPos");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs PinTop = new PropertyChangingEventArgs("PinTop");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs FamilyId = new PropertyChangingEventArgs("FamilyId");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedActorType = new PropertyChangingEventArgs("SelectedActorType");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedArea = new PropertyChangingEventArgs("SelectedArea");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedSpawnPattern = new PropertyChangingEventArgs("SelectedSpawnPattern");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SpaceBetween = new PropertyChangingEventArgs("SpaceBetween");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SpawnCount = new PropertyChangingEventArgs("SpawnCount");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs XOffset = new PropertyChangingEventArgs("XOffset");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs YOffset = new PropertyChangingEventArgs("YOffset");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ZOffset = new PropertyChangingEventArgs("ZOffset");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs FollowPlayer = new PropertyChangingEventArgs("FollowPlayer");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs IsNotConnected = new PropertyChangingEventArgs("IsNotConnected");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs MapSelection = new PropertyChangingEventArgs("MapSelection");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedPoi = new PropertyChangingEventArgs("SelectedPoi");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Remove = new PropertyChangingEventArgs("Remove");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs ActorView = new PropertyChangingEventArgs("ActorView");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedActorCollection = new PropertyChangingEventArgs("SelectedActorCollection");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs PctRegrow = new PropertyChangingEventArgs("PctRegrow");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs VegetationStateSelected = new PropertyChangingEventArgs("VegetationStateSelected");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SaveDir = new PropertyChangingEventArgs("SaveDir");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs CurrentBackupMode = new PropertyChangingEventArgs("CurrentBackupMode");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs CurrentThemeAccent = new PropertyChangingEventArgs("CurrentThemeAccent");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedLanguage = new PropertyChangingEventArgs("SelectedLanguage");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs AskForBackups = new PropertyChangingEventArgs("AskForBackups");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedStorage = new PropertyChangingEventArgs("SelectedStorage");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedUserControl = new PropertyChangingEventArgs("SelectedUserControl");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs BatchSelectedStructureType = new PropertyChangingEventArgs("BatchSelectedStructureType");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs FilterText = new PropertyChangingEventArgs("FilterText");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs OnlyMissing = new PropertyChangingEventArgs("OnlyMissing");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs De = new PropertyChangingEventArgs("De");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs En = new PropertyChangingEventArgs("En");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Key = new PropertyChangingEventArgs("Key");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Pl = new PropertyChangingEventArgs("Pl");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs CoreGameCompleted = new PropertyChangingEventArgs("CoreGameCompleted");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs CreativeMode = new PropertyChangingEventArgs("CreativeMode");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs CreativeModeItem = new PropertyChangingEventArgs("CreativeModeItem");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs EscapedIsland = new PropertyChangingEventArgs("EscapedIsland");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs SelectedWorldItemType = new PropertyChangingEventArgs("SelectedWorldItemType");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangingEventArgs Max = new PropertyChangingEventArgs("Max");
	}
	[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.0.0.0")]
	[DebuggerNonUserCode]
	[ExcludeFromCodeCoverage]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[Obsolete("This type is not intended to be used directly by user code")]
	internal static class __KnownINotifyPropertyChangedArgs
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Status = new PropertyChangedEventArgs("Status");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Zoom = new PropertyChangedEventArgs("Zoom");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ZoomInverse = new PropertyChangedEventArgs("ZoomInverse");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Selected = new PropertyChangedEventArgs("Selected");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Affection = new PropertyChangedEventArgs("Affection");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Anger = new PropertyChangedEventArgs("Anger");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Energy = new PropertyChangedEventArgs("Energy");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Fear = new PropertyChangedEventArgs("Fear");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Fullness = new PropertyChangedEventArgs("Fullness");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Health = new PropertyChangedEventArgs("Health");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Hydration = new PropertyChangedEventArgs("Hydration");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Outfit = new PropertyChangedEventArgs("Outfit");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Pos = new PropertyChangedEventArgs("Pos");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs UniqueId = new PropertyChangedEventArgs("UniqueId");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs BoolValue = new PropertyChangedEventArgs("BoolValue");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs IntValue = new PropertyChangedEventArgs("IntValue");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedItem = new PropertyChangedEventArgs("SelectedItem");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs StringValue = new PropertyChangedEventArgs("StringValue");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Enabled = new PropertyChangedEventArgs("Enabled");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Visible = new PropertyChangedEventArgs("Visible");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Filtered = new PropertyChangedEventArgs("Filtered");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs IsSelected = new PropertyChangedEventArgs("IsSelected");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs IconZIndex = new PropertyChangedEventArgs("IconZIndex");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Position = new PropertyChangedEventArgs("Position");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs X = new PropertyChangedEventArgs("X");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Z = new PropertyChangedEventArgs("Z");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs AreaFilter = new PropertyChangedEventArgs("AreaFilter");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs FullText = new PropertyChangedEventArgs("FullText");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs RequirementsFilter = new PropertyChangedEventArgs("RequirementsFilter");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ShowOnlyUncollectedItems = new PropertyChangedEventArgs("ShowOnlyUncollectedItems");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Title = new PropertyChangedEventArgs("Title");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs IsMoveRequested = new PropertyChangedEventArgs("IsMoveRequested");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs IsZiplineCreationRequested = new PropertyChangedEventArgs("IsZiplineCreationRequested");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs CurrentHealth = new PropertyChangedEventArgs("CurrentHealth");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs FullnessBuff = new PropertyChangedEventArgs("FullnessBuff");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs HydrationBuff = new PropertyChangedEventArgs("HydrationBuff");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs MaxHealth = new PropertyChangedEventArgs("MaxHealth");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Rest = new PropertyChangedEventArgs("Rest");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs RestBuff = new PropertyChangedEventArgs("RestBuff");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedCloth = new PropertyChangedEventArgs("SelectedCloth");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Sickness = new PropertyChangedEventArgs("Sickness");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Stamina = new PropertyChangedEventArgs("Stamina");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs StrengthLevel = new PropertyChangedEventArgs("StrengthLevel");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Sentiment = new PropertyChangedEventArgs("Sentiment");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs RemainingArmourpoints = new PropertyChangedEventArgs("RemainingArmourpoints");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Added = new PropertyChangedEventArgs("Added");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ScrewStructure = new PropertyChangedEventArgs("ScrewStructure");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Count = new PropertyChangedEventArgs("Count");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Max = new PropertyChangedEventArgs("Max");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedItemForAll = new PropertyChangedEventArgs("SelectedItemForAll");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Address = new PropertyChangedEventArgs("Address");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ConnectTimeout = new PropertyChangedEventArgs("ConnectTimeout");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs KeepAliveInterval = new PropertyChangedEventArgs("KeepAliveInterval");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs MapPositionUpdateInterval = new PropertyChangedEventArgs("MapPositionUpdateInterval");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Port = new PropertyChangedEventArgs("Port");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs StatusText = new PropertyChangedEventArgs("StatusText");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ActorSelection = new PropertyChangedEventArgs("ActorSelection");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ModificationMode = new PropertyChangedEventArgs("ModificationMode");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs OnlyInSameAreaAsActor = new PropertyChangedEventArgs("OnlyInSameAreaAsActor");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SkipKelvin = new PropertyChangedEventArgs("SkipKelvin");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SkipVirginia = new PropertyChangedEventArgs("SkipVirginia");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ActorEnergy = new PropertyChangedEventArgs("ActorEnergy");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ActorHealth = new PropertyChangedEventArgs("ActorHealth");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs RemoveSpawner = new PropertyChangedEventArgs("RemoveSpawner");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ReplaceType = new PropertyChangedEventArgs("ReplaceType");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs TeleportMode = new PropertyChangedEventArgs("TeleportMode");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs UpdateEnergy = new PropertyChangedEventArgs("UpdateEnergy");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs UpdateHealth = new PropertyChangedEventArgs("UpdateHealth");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs UpdateInfluences = new PropertyChangedEventArgs("UpdateInfluences");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs InventoryFilter = new PropertyChangedEventArgs("InventoryFilter");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs UnassignedItemsFilter = new PropertyChangedEventArgs("UnassignedItemsFilter");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs FollowerItems = new PropertyChangedEventArgs("FollowerItems");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs FurnitureStructures = new PropertyChangedEventArgs("FurnitureStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs GardeningStructures = new PropertyChangedEventArgs("GardeningStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ItemConstruction = new PropertyChangedEventArgs("ItemConstruction");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ItemsInInventory = new PropertyChangedEventArgs("ItemsInInventory");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ItemsInWeaponRacks = new PropertyChangedEventArgs("ItemsInWeaponRacks");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs LogConstruction = new PropertyChangedEventArgs("LogConstruction");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs LogPlankConstruction = new PropertyChangedEventArgs("LogPlankConstruction");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs MiscStructures = new PropertyChangedEventArgs("MiscStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs StickConstruction = new PropertyChangedEventArgs("StickConstruction");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs StoneConstruction = new PropertyChangedEventArgs("StoneConstruction");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs StorageStructures = new PropertyChangedEventArgs("StorageStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs TrapsStructures = new PropertyChangedEventArgs("TrapsStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs UtilityStructures = new PropertyChangedEventArgs("UtilityStructures");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs CheckVersionOnStartup = new PropertyChangedEventArgs("CheckVersionOnStartup");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs IsMapWindowClosed = new PropertyChangedEventArgs("IsMapWindowClosed");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs LastSaveGameMenuItem = new PropertyChangedEventArgs("LastSaveGameMenuItem");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs PinLeft = new PropertyChangedEventArgs("PinLeft");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs PinPos = new PropertyChangedEventArgs("PinPos");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs PinTop = new PropertyChangedEventArgs("PinTop");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs FamilyId = new PropertyChangedEventArgs("FamilyId");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedActorType = new PropertyChangedEventArgs("SelectedActorType");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedArea = new PropertyChangedEventArgs("SelectedArea");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedSpawnPattern = new PropertyChangedEventArgs("SelectedSpawnPattern");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SpaceBetween = new PropertyChangedEventArgs("SpaceBetween");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SpawnCount = new PropertyChangedEventArgs("SpawnCount");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs XOffset = new PropertyChangedEventArgs("XOffset");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs YOffset = new PropertyChangedEventArgs("YOffset");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ZOffset = new PropertyChangedEventArgs("ZOffset");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs FollowPlayer = new PropertyChangedEventArgs("FollowPlayer");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs IsNotConnected = new PropertyChangedEventArgs("IsNotConnected");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs MapSelection = new PropertyChangedEventArgs("MapSelection");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs MapImageSource = new PropertyChangedEventArgs("MapImageSource");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs MapBackground = new PropertyChangedEventArgs("MapBackground");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs NetworkPlayerForeground = new PropertyChangedEventArgs("NetworkPlayerForeground");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedPoi = new PropertyChangedEventArgs("SelectedPoi");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Remove = new PropertyChangedEventArgs("Remove");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs ActorView = new PropertyChangedEventArgs("ActorView");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedActorCollection = new PropertyChangedEventArgs("SelectedActorCollection");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs PctRegrow = new PropertyChangedEventArgs("PctRegrow");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs VegetationStateSelected = new PropertyChangedEventArgs("VegetationStateSelected");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs VegetationStateIsAllSelected = new PropertyChangedEventArgs("VegetationStateIsAllSelected");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SaveDir = new PropertyChangedEventArgs("SaveDir");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs CurrentBackupMode = new PropertyChangedEventArgs("CurrentBackupMode");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs CurrentThemeAccent = new PropertyChangedEventArgs("CurrentThemeAccent");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedLanguage = new PropertyChangedEventArgs("SelectedLanguage");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs AskForBackups = new PropertyChangedEventArgs("AskForBackups");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedStorage = new PropertyChangedEventArgs("SelectedStorage");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedUserControl = new PropertyChangedEventArgs("SelectedUserControl");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs BatchSelectedStructureType = new PropertyChangedEventArgs("BatchSelectedStructureType");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs FilterText = new PropertyChangedEventArgs("FilterText");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs OnlyMissing = new PropertyChangedEventArgs("OnlyMissing");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs De = new PropertyChangedEventArgs("De");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs En = new PropertyChangedEventArgs("En");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Key = new PropertyChangedEventArgs("Key");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs Pl = new PropertyChangedEventArgs("Pl");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs CoreGameCompleted = new PropertyChangedEventArgs("CoreGameCompleted");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs CreativeMode = new PropertyChangedEventArgs("CreativeMode");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs CreativeModeItem = new PropertyChangedEventArgs("CreativeModeItem");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs EscapedIsland = new PropertyChangedEventArgs("EscapedIsland");

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("This field is not intended to be referenced directly by user code")]
		public static readonly PropertyChangedEventArgs SelectedWorldItemType = new PropertyChangedEventArgs("SelectedWorldItemType");
	}
}
namespace SOTFEdit
{
	public class App : Application
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<IServiceProvider, GameData> <>9__3_0;

			public static UnhandledExceptionEventHandler <>9__6_0;

			public static DispatcherUnhandledExceptionEventHandler <>9__6_1;

			public static EventHandler<UnobservedTaskExceptionEventArgs> <>9__6_2;

			internal GameData <ConfigureServices>b__3_0(IServiceProvider _)
			{
				return BuildGameDataInstance() ?? throw new Exception("Unable to load Game Data");
			}

			internal void <SetupExceptionHandling>b__6_0(object _, UnhandledExceptionEventArgs e)
			{
				LogUnhandledException((Exception)e.ExceptionObject, "AppDomain.CurrentDomain.UnhandledException");
			}

			internal void <SetupExceptionHandling>b__6_1(object _, DispatcherUnhandledExceptionEventArgs e)
			{
				LogUnhandledException(e.Exception, "Application.Current.DispatcherUnhandledException");
				e.Handled = true;
			}

			internal void <SetupExceptionHandling>b__6_2(object? _, UnobservedTaskExceptionEventArgs e)
			{
				LogUnhandledException(e.Exception, "TaskScheduler.UnobservedTaskException", sendEvent: false);
				e.SetObserved();
			}
		}

		private static readonly ILogger Logger = (ILogger)(object)LogManager.GetCurrentClassLogger();

		private bool _contentLoaded;

		public App()
		{
			InitializeLanguage();
			Logger.Debug("Initializing Application");
			SetupExceptionHandling();
			if (Settings.Default.UpgradeRequired)
			{
				Logger.Info("Upgrading Settings");
				((ApplicationSettingsBase)Settings.Default).Upgrade();
				Settings.Default.UpgradeRequired = false;
				((SettingsBase)Settings.Default).Save();
			}
			MessagePackInitializer.Initialize();
			ConfigureServices();
			Logger.Debug("Initializing Component");
			InitializeComponent();
		}

		private static void InitializeLanguage()
		{
			string text = (string.IsNullOrEmpty(Settings.Default.Language) ? CultureInfo.CurrentCulture.TwoLetterISOLanguageName : Settings.Default.Language);
			if (!LanguageManager.GetAvailableCultures().ToHashSet().Contains(text))
			{
				text = "en";
			}
			CultureInfo.DefaultThreadCurrentUICulture = (CultureInfo.DefaultThreadCurrentCulture = (CultureInfo.CurrentUICulture = (CultureInfo.CurrentCulture = new CultureInfo(text))));
		}

		private static void ConfigureServices()
		{
			Logger.Debug("Configuring Services");
			ServiceCollection services = new ServiceCollection();
			services.AddSingleton(new SavegameManager());
			services.AddSingleton<MainViewModel>();
			services.AddSingleton<ArmorPageViewModel>();
			services.AddSingleton<FollowerPageViewModel>();
			services.AddSingleton<GameSetupPageViewModel>();
			services.AddSingleton<GameStatePageViewModel>();
			services.AddSingleton<InventoryPageViewModel>();
			services.AddSingleton<GamePageViewModel>();
			services.AddSingleton<PlayerPageViewModel>();
			services.AddSingleton<WeatherPageViewModel>();
			services.AddSingleton<StoragePageViewModel>();
			services.AddSingleton((IServiceProvider _) => BuildGameDataInstance() ?? throw new Exception("Unable to load Game Data"));
			services.AddSingleton<StorageFactory>();
			services.AddSingleton<UpdateChecker>();
			services.AddTransient<SelectSavegameViewModel>();
			services.AddSingleton<GamePage>();
			services.AddSingleton<GameStatePage>();
			services.AddSingleton<GameSetupPage>();
			services.AddSingleton<WeatherPage>();
			services.AddSingleton<NpcsPageViewModel>();
			services.AddSingleton<NpcsPage>();
			services.AddSingleton<ActorModifier>();
			services.AddSingleton<ApplicationSettings>();
			services.AddSingleton<StructuresPageViewModel>();
			services.AddSingleton<StructuresPage>();
			services.AddSingleton<MapManager>();
			services.AddSingleton<CompanionPoiStorage>();
			services.AddSingleton<IMessageHandler, CompanionAddPoiMessageHandler>();
			services.AddSingleton<IMessageHandler, CompanionPosCollectionMessageHandler>();
			services.AddSingleton<IMessageHandler, CompanionRequestPoiUpdateMessageHandler>();
			CompanionNetworkPlayerManager networkPlayerManager = new CompanionNetworkPlayerManager();
			services.AddSingleton<IMessageHandler, CompanionNetworkPlayerManager>((IServiceProvider _) => networkPlayerManager);
			services.AddSingleton(networkPlayerManager);
			services.AddSingleton<CompanionMessageHandler>();
			services.AddSingleton<CompanionConnectionManager>();
			services.AddSingleton<PoiLoader>();
			Ioc.Default.ConfigureServices((IServiceProvider)services.BuildServiceProvider());
		}

		private static GameData? BuildGameDataInstance()
		{
			Logger.Info("Loading data.json");
			return JsonConvert.DeserializeObject<GameData>(File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "data", "data.json")));
		}

		protected override void OnStartup(StartupEventArgs e)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			((Application)this).OnStartup(e);
			if (!string.IsNullOrEmpty(Settings.Default.Theme) && !string.IsNullOrEmpty(Settings.Default.ThemeAccent))
			{
				ThemeManager.Current.ChangeTheme((Application)(object)this, Settings.Default.Theme + "." + Settings.Default.ThemeAccent, false);
			}
			Logger.Debug("OnStartup()");
			FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), (PropertyMetadata)new FrameworkPropertyMetadata((object)XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
		}

		private void SetupExceptionHandling()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			Logger.Debug("Setting up exception handling");
			AppDomain.CurrentDomain.UnhandledException += delegate(object _, UnhandledExceptionEventArgs e)
			{
				LogUnhandledException((Exception)e.ExceptionObject, "AppDomain.CurrentDomain.UnhandledException");
			};
			object obj = <>c.<>9__6_1;
			if (obj == null)
			{
				DispatcherUnhandledExceptionEventHandler val = delegate(object _, DispatcherUnhandledExceptionEventArgs e)
				{
					LogUnhandledException(e.Exception, "Application.Current.DispatcherUnhandledException");
					e.Handled = true;
				};
				<>c.<>9__6_1 = val;
				obj = (object)val;
			}
			((Application)this).DispatcherUnhandledException += (DispatcherUnhandledExceptionEventHandler)obj;
			TaskScheduler.UnobservedTaskException += delegate(object? _, UnobservedTaskExceptionEventArgs e)
			{
				LogUnhandledException(e.Exception, "TaskScheduler.UnobservedTaskException", sendEvent: false);
				e.SetObserved();
			};
		}

		private static void LogUnhandledException(Exception exception, string source, bool sendEvent = true)
		{
			string text = "Unhandled exception (" + source + ")";
			try
			{
				AssemblyName name = Assembly.GetExecutingAssembly().GetName();
				text = $"Unhandled exception in {name.Name} v{name.Version}";
			}
			catch (Exception ex)
			{
				Logger.Error(ex, "Exception in LogUnhandledException");
			}
			finally
			{
				if (exception is AggregateException ex2)
				{
					foreach (Exception innerException in ex2.Flatten().InnerExceptions)
					{
						Logger.Error<Exception>(innerException);
					}
				}
				else
				{
					Logger.Error(exception, text);
				}
			}
			if (sendEvent)
			{
				IMessengerExtensions.Send<UnhandledExceptionEvent>((IMessenger)(object)WeakReferenceMessenger.Default, new UnhandledExceptionEvent(exception));
			}
		}

		public static void GetAssemblyVersion(out string assemblyName, out SemVersion assemblyVersion)
		{
			AssemblyName name = Assembly.GetExecutingAssembly().GetName();
			assemblyName = name.Name ?? "SOTFEdit";
			assemblyVersion = SemVersion.FromVersion(name.Version);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("PresentationBuildTasks", "8.0.5.0")]
		public void InitializeComponent()
		{
			if (!_contentLoaded)
			{
				_contentLoaded = true;
				((Application)this).StartupUri = new Uri("/View/SplashWindow.xaml", UriKind.Relative);
				Uri uri = new Uri("/SOTFEdit;component/app.xaml", UriKind.Relative);
				Application.LoadComponent((object)this, uri);
			}
		}

		[STAThread]
		[DebuggerNonUserCode]
		[GeneratedCode("PresentationBuildTasks", "8.0.5.0")]
		public static void Main()
		{
			App app = new App();
			app.InitializeComponent();
			((Application)app).Run();
		}
	}
	public class ApplicationSettings
	{
		public enum BackupMode
		{
			None,
			Default,
			One,
			InitialAndOne
		}

		private ThemeData _accent;

		public List<ThemeData> AccentColors { get; }

		public ThemeData CurrentThemeAccent
		{
			get
			{
				return _accent;
			}
			set
			{
				Settings.Default.ThemeAccent = value.Name;
				_accent = value;
			}
		}

		public BackupMode CurrentBackupMode
		{
			get
			{
				return Settings.Default.BackupMode;
			}
			set
			{
				Settings.Default.BackupMode = value;
			}
		}

		public ApplicationSettings()
		{
			AccentColors = (from x in ThemeManager.Current.Themes
				group x by x.ColorScheme into a
				orderby a.Key
				select new ThemeData(a.Key, a.First().ShowcaseBrush)).ToList();
			Theme appTheme = ThemeManager.Current.DetectTheme();
			_accent = AccentColors.FirstOrDefault(delegate(ThemeData accent)
			{
				if (!(accent.Name == Settings.Default.ThemeAccent))
				{
					string name = accent.Name;
					Theme obj = appTheme;
					return name == ((obj != null) ? obj.ColorScheme : null);
				}
				return true;
			}) ?? AccentColors.First();
		}

		public void Save()
		{
			((SettingsBase)Settings.Default).Save();
		}
	}
	public static class LabExperiments
	{
		public static void ResetCannibalAnger(Savegame selectedSavegame)
		{
			SaveDataWrapper saveDataWrapper = selectedSavegame.SavegameStore.LoadJsonRaw(SavegameStore.FileType.SaveData);
			if (saveDataWrapper == null)
			{
				return;
			}
			JToken jsonBasedToken = saveDataWrapper.GetJsonBasedToken("Data.VailWorldSim");
			if (jsonBasedToken == null)
			{
				return;
			}
			IEnumerable<JToken> enumerable = (IEnumerable<JToken>)jsonBasedToken[(object)"KillStatsList"];
			foreach (JToken item in enumerable ?? Enumerable.Empty<JToken>())
			{
				JToken obj = item[(object)"PlayerKilled"];
				if (obj != null)
				{
					obj.Replace(JToken.op_Implicit(0));
				}
			}
			JToken obj2 = jsonBasedToken[(object)"PlayerStats"];
			if (obj2 != null)
			{
				JToken obj3 = obj2[(object)"CutTrees"];
				if (obj3 != null)
				{
					obj3.Replace(JToken.op_Implicit(0));
				}
			}
			JToken obj4 = jsonBasedToken[(object)"PlayerStats"];
			if (obj4 != null)
			{
				JToken obj5 = obj4[(object)"SeenInVillageCount"];
				if (obj5 != null)
				{
					obj5.Replace(JToken.op_Implicit(0));
				}
			}
			saveDataWrapper.MarkAsModified("Data.VailWorldSim");
		}
	}
	public class SavegameManager : ObservableObject
	{
		private static readonly ILogger Logger = (ILogger)(object)LogManager.GetCurrentClassLogger();

		private static Savegame? _selectedSavegame;

		public static Savegame? SelectedSavegame
		{
			get
			{
				return _selectedSavegame;
			}
			set
			{
				_selectedSavegame = value;
				IMessengerExtensions.Send<SelectedSavegameChangedEvent>((IMessenger)(object)WeakReferenceMessenger.Default, new SelectedSavegameChangedEvent(value));
			}
		}

		public static Dictionary<string, Savegame> GetSavegames()
		{
			string savePath = GetSavePath();
			Logger.Info("Detected savegame path: " + savePath);
			return FindSaveGames(savePath);
		}

		public static string GetSavePath()
		{
			if (string.IsNullOrWhiteSpace(Settings.Default.SavegamePath))
			{
				return GetSavegamePathFromAppData();
			}
			return Settings.Default.SavegamePath;
		}

		private static Dictionary<string, Savegame> FindSaveGames(string? savesPath, string? idFilter = null)
		{
			string idFilter2 = idFilter;
			Logger.Info("Reading savegames from " + savesPath);
			if (!Directory.Exists(savesPath))
			{
				return new Dictionary<string, Savegame>();
			}
			try
			{
				return (from file in new DirectoryInfo(savesPath).GetFiles("SaveData.*", System.IO.SearchOption.AllDirectories)
					select CreateSaveInfo(file.Directory) into savegame
					where savegame != null
					select (savegame) into savegame
					where idFilter2 == null || idFilter2 == savegame.FullPath
					orderby savegame.LastSaveTime descending
					select savegame).DistinctBy((Savegame savegame) => savegame.FullPath).ToDictionary((Savegame savegame) => savegame.FullPath, (Savegame savegame) => savegame);
			}
			catch (Exception ex)
			{
				Logger.Error(ex, "Unable to read savegames from " + savesPath);
			}
			return new Dictionary<string, Savegame>();
		}

		public static Savegame? CreateSaveInfo(DirectoryInfo? directory)
		{
			if (directory == null || !directory.Exists)
			{
				return null;
			}
			return new Savegame(directory.FullName, directory.Name, new SavegameStore(directory.FullName));
		}

		public static string GetSavegamePathFromAppData()
		{
			return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).Replace("Roaming", "LocalLow"), "Endnight", "SonsOfTheForest", "Saves");
		}

		public static Savegame? ReloadSavegame(Savegame selectedSavegame)
		{
			DirectoryInfo directoryInfo = new DirectoryInfo(selectedSavegame.FullPath);
			if (directoryInfo.Exists)
			{
				return CreateSaveInfo(directoryInfo);
			}
			return null;
		}
	}
	[CompilerGenerated]
	[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
	internal sealed class Settings : ApplicationSettingsBase
	{
		private static Settings defaultInstance = (Settings)(object)SettingsBase.Synchronized((SettingsBase)(object)new Settings());

		public static Settings Default => defaultInstance;

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("")]
		public string SavegamePath
		{
			get
			{
				return (string)((SettingsBase)this)["SavegamePath"];
			}
			set
			{
				((SettingsBase)this)["SavegamePath"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("True")]
		public bool UpgradeRequired
		{
			get
			{
				return (bool)((SettingsBase)this)["UpgradeRequired"];
			}
			set
			{
				((SettingsBase)this)["UpgradeRequired"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("True")]
		public bool CheckForUpdates
		{
			get
			{
				return (bool)((SettingsBase)this)["CheckForUpdates"];
			}
			set
			{
				((SettingsBase)this)["CheckForUpdates"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("")]
		public string LastFoundVersion
		{
			get
			{
				return (string)((SettingsBase)this)["LastFoundVersion"];
			}
			set
			{
				((SettingsBase)this)["LastFoundVersion"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("Dark")]
		public string Theme
		{
			get
			{
				return (string)((SettingsBase)this)["Theme"];
			}
			set
			{
				((SettingsBase)this)["Theme"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("Blue")]
		public string ThemeAccent
		{
			get
			{
				return (string)((SettingsBase)this)["ThemeAccent"];
			}
			set
			{
				((SettingsBase)this)["ThemeAccent"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("InitialAndOne")]
		public ApplicationSettings.BackupMode BackupMode
		{
			get
			{
				return (ApplicationSettings.BackupMode)((SettingsBase)this)["BackupMode"];
			}
			set
			{
				((SettingsBase)this)["BackupMode"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("")]
		public string LastSavegame
		{
			get
			{
				return (string)((SettingsBase)this)["LastSavegame"];
			}
			set
			{
				((SettingsBase)this)["LastSavegame"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("")]
		public string Language
		{
			get
			{
				return (string)((SettingsBase)this)["Language"];
			}
			set
			{
				((SettingsBase)this)["Language"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("")]
		public string LastSavegameName
		{
			get
			{
				return (string)((SettingsBase)this)["LastSavegameName"];
			}
			set
			{
				((SettingsBase)this)["LastSavegameName"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("True")]
		public bool FirstRun
		{
			get
			{
				return (bool)((SettingsBase)this)["FirstRun"];
			}
			set
			{
				((SettingsBase)this)["FirstRun"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("_null_")]
		public string SelectedMapGroups
		{
			get
			{
				return (string)((SettingsBase)this)["SelectedMapGroups"];
			}
			set
			{
				((SettingsBase)this)["SelectedMapGroups"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("127.0.0.1")]
		public string CompanionAddress
		{
			get
			{
				return (string)((SettingsBase)this)["CompanionAddress"];
			}
			set
			{
				((SettingsBase)this)["CompanionAddress"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("35321")]
		public int CompanionPort
		{
			get
			{
				return (int)((SettingsBase)this)["CompanionPort"];
			}
			set
			{
				((SettingsBase)this)["CompanionPort"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("15")]
		public short CompanionConnectTimeout
		{
			get
			{
				return (short)((SettingsBase)this)["CompanionConnectTimeout"];
			}
			set
			{
				((SettingsBase)this)["CompanionConnectTimeout"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("Dark")]
		public MapType MapType
		{
			get
			{
				return (MapType)((SettingsBase)this)["MapType"];
			}
			set
			{
				((SettingsBase)this)["MapType"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("30")]
		public short CompanionKeepAliveInterval
		{
			get
			{
				return (short)((SettingsBase)this)["CompanionKeepAliveInterval"];
			}
			set
			{
				((SettingsBase)this)["CompanionKeepAliveInterval"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("0.1")]
		public decimal CompanionMapPositionUpdateInterval
		{
			get
			{
				return (decimal)((SettingsBase)this)["CompanionMapPositionUpdateInterval"];
			}
			set
			{
				((SettingsBase)this)["CompanionMapPositionUpdateInterval"] = value;
			}
		}

		[UserScopedSetting]
		[DebuggerNonUserCode]
		[DefaultSettingValue("False")]
		public bool AskForBackups
		{
			get
			{
				return (bool)((SettingsBase)this)["AskForBackups"];
			}
			set
			{
				((SettingsBase)this)["AskForBackups"] = value;
			}
		}
	}
	public class UpdateChecker
	{
		private static readonly ILogger Logger = (ILogger)(object)LogManager.GetCurrentClassLogger();

		private readonly SemVersion _assemblyVersion;

		private readonly string _changelogUrl;

		private readonly HttpClient _client;

		private readonly string _latestTagUrl;

		private volatile bool _isLoading;

		public UpdateChecker(GameData gameData)
		{
			_latestTagUrl = gameData.Config.LatestTagUrl;
			_changelogUrl = gameData.Config.ChangelogUrl;
			AssemblyName name = Assembly.GetExecutingAssembly().GetName();
			_assemblyVersion = SemVersion.FromVersion(name.Version);
			_client = new HttpClient
			{
				DefaultRequestHeaders = { 
				{
					"User-Agent",
					$"{name.Name}/{_assemblyVersion}"
				} }
			};
		}

		public void CheckForUpdates(bool notifyOnSameVersion, bool notifyOnError, bool invokedManually)
		{
			Task.Run(() => DoCheckForUpdates(notifyOnSameVersion, notifyOnError, invokedManually));
		}

		private async Task DoCheckForUpdates(bool notifyOnSameVersion, bool notifyOnError, bool invokedManually)
		{
			if (_isLoading)
			{
				return;
			}
			_isLoading = true;
			try
			{
				string text = await Load(_latestTagUrl, notifyOnError, invokedManually);
				if (text == null)
				{
					return;
				}
				JToken val = JToken.Parse(text);
				string text2 = ((object)val[(object)"tag_name"])?.ToString();
				if (text2 == null)
				{
					Logger.Warn("Tag version not found in response");
					NotifyOnError(notifyOnError, invokedManually);
					return;
				}
				SemVersion val2 = SemVersion.Parse(text2, (SemVersionStyles)24, 1024);
				switch (val2.ComparePrecedenceTo(_assemblyVersion))
				{
				case 1:
				{
					string link = ((object)val[(object)"html_url"])?.ToString();
					NotifyOnNewerVersion(val2, link, invokedManually);
					break;
				}
				case -1:
				case 0:
					if (notifyOnSameVersion)
					{
						NotifyOnSameVersion(val2, invokedManually);
					}
					break;
				}
			}
			catch (Exception ex)
			{
				Logger.Error(ex, "Error while checking for updates");
				NotifyOnError(notifyOnError, invokedManually);
			}
			finally
			{
				_isLoading = false;
			}
		}

		private async Task<string?> Load(string url, bool notifyOnError, bool invokedManually)
		{
			using HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, url);
			using HttpResponseMessage result = await _client.SendAsync(request);
			if (result.IsSuccessStatusCode)
			{
				return await result.Content.ReadAsStringAsync();
			}
			Logger.Warn($"Got a failure response: {result.StatusCode}");
			NotifyOnError(notifyOnError, invokedManually);
			return null;
		}

		private static void NotifyOnSameVersion(SemVersion latestTagVersion, bool invokedManually)
		{
			Logger.Info("No update found");
			SendResult(new VersionCheckResultEvent(latestTagVersion, isNewer: false, invokedManually));
		}

		private async void NotifyOnNewerVersion(SemVersion latestTagVersion, string? link, bool invokedManually)
		{
			Logger.Info($"Newer version found ({latestTagVersion})");
			SendResult(new VersionCheckResultEvent(latestTagVersion, isNewer: true, invokedManually, await GetChangelog())
			{
				Link = link
			});
		}

		private async Task<string?> GetChangelog()
		{
			try
			{
				return await Load(_changelogUrl, notifyOnError: false, invokedManually: false);
			}
			catch (Exception ex)
			{
				Logger.Error(ex, "Error while loading the changelog");
			}
			return null;
		}

		private static void NotifyOnError(bool notifyOnError, bool invokedManually)
		{
			if (notifyOnError)
			{
				SendResult(new VersionCheckResultEvent(null, isNewer: false, invokedManually, null, isError: true));
			}
		}

		private static void SendResult(VersionCheckResultEvent checkResult)
		{
			VersionCheckResultEvent checkResult2 = checkResult;
			Task.Run(() => IMessengerExtensions.Send<VersionCheckResultEvent>((IMessenger)(object)WeakReferenceMessenger.Default, checkResult2));
		}
	}
}
namespace SOTFEdit.View
{
	[ObservableObject]
	public class AboutWindow : MetroWindow, IComponentConnector, INotifyPropertyChanged, INotifyPropertyChanging
	{
		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		private interface ITaskNotifier<TTask> where TTask : Task
		{
			TTask? Task { get; set; }
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected sealed class TaskNotifier : ITaskNotifier<Task>
		{
			private Task? task;

			Task? ITaskNotifier<Task>.Task
			{
				get
				{
					return task;
				}
				set
				{
					task = value;
				}
			}

			internal TaskNotifier()
			{
			}

			public static implicit operator Task?(TaskNotifier? notifier)
			{
				return notifier?.task;
			}
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected sealed class TaskNotifier<T> : ITaskNotifier<Task<T>>
		{
			private Task<T>? task;

			Task<T>? ITaskNotifier<Task<T>>.Task
			{
				get
				{
					return task;
				}
				set
				{
					task = value;
				}
			}

			internal TaskNotifier()
			{
			}

			public static implicit operator Task<T>?(TaskNotifier<T>? notifier)
			{
				return notifier?.task;
			}
		}

		private bool _contentLoaded;

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator", "8.0.0.0")]
		private RelayCommand? openDiscordCommand;

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator", "8.0.0.0")]
		private RelayCommand? closeWindowCommand;

		public string AssemblyVersion { get; }

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		public IRelayCommand OpenDiscordCommand
		{
			get
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Expected O, but got Unknown
				//IL_0023: Expected O, but got Unknown
				RelayCommand obj = openDiscordCommand;
				if (obj == null)
				{
					RelayCommand val = new RelayCommand((Action)OpenDiscord);
					RelayCommand val2 = val;
					openDiscordCommand = val;
					obj = val2;
				}
				return (IRelayCommand)(object)obj;
			}
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		public IRelayCommand CloseWindowCommand
		{
			get
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Expected O, but got Unknown
				//IL_0023: Expected O, but got Unknown
				RelayCommand obj = closeWindowCommand;
				if (obj == null)
				{
					RelayCommand val = new RelayCommand((Action)CloseWindow);
					RelayCommand val2 = val;
					closeWindowCommand = val;
					obj = val2;
				}
				return (IRelayCommand)(object)obj;
			}
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		public event PropertyChangedEventHandler? PropertyChanged;

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		public event PropertyChangingEventHandler? PropertyChanging;

		public AboutWindow(Window parent)
		{
			App.GetAssemblyVersion(out string _, out SemVersion assemblyVersion);
			AssemblyVersion = $"v{assemblyVersion}";
			((Window)this).Owner = parent;
			((FrameworkElement)this).DataContext = this;
			InitializeComponent();
		}

		[RelayCommand]
		private static void OpenDiscord()
		{
			IMessengerExtensions.Send<RequestStartProcessEvent>((IMessenger)(object)WeakReferenceMessenger.Default, RequestStartProcessEvent.ForUrl("https://discord.gg/867UDYvvqE"));
		}

		[RelayCommand]
		private void CloseWindow()
		{
			((Window)this).Close();
		}

		private void AboutWindow_OnPreviewKeyDown(object sender, KeyEventArgs e)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)e.Key == 13)
			{
				((RoutedEventArgs)e).Handled = true;
				((Window)this).Close();
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("PresentationBuildTasks", "8.0.5.0")]
		public void InitializeComponent()
		{
			if (!_contentLoaded)
			{
				_contentLoaded = true;
				Uri uri = new Uri("/SOTFEdit;component/view/aboutwindow.xaml", UriKind.Relative);
				Application.LoadComponent((object)this, uri);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("PresentationBuildTasks", "8.0.5.0")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void IComponentConnector.Connect(int connectionId, object target)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (connectionId == 1)
			{
				((UIElement)(AboutWindow)target).PreviewKeyDown += new KeyEventHandler(AboutWindow_OnPreviewKeyDown);
			}
			else
			{
				_contentLoaded = true;
			}
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
		{
			this.PropertyChanged?.Invoke(this, e);
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected virtual void OnPropertyChanging(PropertyChangingEventArgs e)
		{
			this.PropertyChanging?.Invoke(this, e);
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
		{
			OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected void OnPropertyChanging([CallerMemberName] string? propertyName = null)
		{
			OnPropertyChanging(new PropertyChangingEventArgs(propertyName));
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected bool SetProperty<T>([NotNullIfNotNull("newValue")] ref T field, T newValue, [CallerMemberName] string? propertyName = null)
		{
			if (EqualityComparer<T>.Default.Equals(field, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			field = newValue;
			OnPropertyChanged(propertyName);
			return true;
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected bool SetProperty<T>([NotNullIfNotNull("newValue")] ref T field, T newValue, IEqualityComparer<T> comparer, [CallerMemberName] string? propertyName = null)
		{
			if (comparer.Equals(field, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			field = newValue;
			OnPropertyChanged(propertyName);
			return true;
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected bool SetProperty<T>(T oldValue, T newValue, Action<T> callback, [CallerMemberName] string? propertyName = null)
		{
			if (EqualityComparer<T>.Default.Equals(oldValue, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			callback(newValue);
			OnPropertyChanged(propertyName);
			return true;
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected bool SetProperty<T>(T oldValue, T newValue, IEqualityComparer<T> comparer, Action<T> callback, [CallerMemberName] string? propertyName = null)
		{
			if (comparer.Equals(oldValue, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			callback(newValue);
			OnPropertyChanged(propertyName);
			return true;
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected bool SetProperty<TModel, T>(T oldValue, T newValue, TModel model, Action<TModel, T> callback, [CallerMemberName] string? propertyName = null) where TModel : class
		{
			if (EqualityComparer<T>.Default.Equals(oldValue, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			callback(model, newValue);
			OnPropertyChanged(propertyName);
			return true;
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected bool SetProperty<TModel, T>(T oldValue, T newValue, IEqualityComparer<T> comparer, TModel model, Action<TModel, T> callback, [CallerMemberName] string? propertyName = null) where TModel : class
		{
			if (comparer.Equals(oldValue, newValue))
			{
				return false;
			}
			OnPropertyChanging(propertyName);
			callback(model, newValue);
			OnPropertyChanged(propertyName);
			return true;
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected bool SetPropertyAndNotifyOnCompletion([NotNull] ref TaskNotifier? taskNotifier, Task? newValue, [CallerMemberName] string? propertyName = null)
		{
			return SetPropertyAndNotifyOnCompletion(taskNotifier ?? (taskNotifier = new TaskNotifier()), newValue, null, propertyName);
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected bool SetPropertyAndNotifyOnCompletion([NotNull] ref TaskNotifier? taskNotifier, Task? newValue, Action<Task?> callback, [CallerMemberName] string? propertyName = null)
		{
			return SetPropertyAndNotifyOnCompletion(taskNotifier ?? (taskNotifier = new TaskNotifier()), newValue, callback, propertyName);
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected bool SetPropertyAndNotifyOnCompletion<T>([NotNull] ref TaskNotifier<T>? taskNotifier, Task<T>? newValue, [CallerMemberName] string? propertyName = null)
		{
			return SetPropertyAndNotifyOnCompletion(taskNotifier ?? (taskNotifier = new TaskNotifier<T>()), newValue, null, propertyName);
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		protected bool SetPropertyAndNotifyOnCompletion<T>([NotNull] ref TaskNotifier<T>? taskNotifier, Task<T>? newValue, Action<Task<T>?> callback, [CallerMemberName] string? propertyName = null)
		{
			return SetPropertyAndNotifyOnCompletion(taskNotifier ?? (taskNotifier = new TaskNotifier<T>()), newValue, callback, propertyName);
		}

		[GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservableObjectGenerator", "8.0.0.0")]
		[ExcludeFromCodeCoverage]
		private bool SetPropertyAndNotifyOnCompletion<TTask>(ITaskNotifier<TTask> taskNotifier, TTask? newValue, Action<TTask?>? callback, [CallerMemberName] string? propertyName = null) where TTask : Task
		{
			TTask newValue2 = newValue;
			ITaskNotifier<TTask> taskNotifier2 = taskNotifier;
			string pro

SpicyTaco.AutoGrid.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SpicyTaco.AutoGrid")]
[assembly: AssemblyDescription("Magical replacement for the default WPF Grid.")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCompany("SpicyTaco")]
[assembly: AssemblyProduct("SpicyTaco.AutoGrid")]
[assembly: AssemblyCopyright("Copyright 2015 © SpicyTaco")]
[assembly: AssemblyTrademark("SpicyTaco")]
[assembly: ComVisible(false)]
[assembly: Guid("7a0e3cec-40fd-4f44-a6d1-b634a68db49a")]
[assembly: AssemblyFileVersion("1.2.29")]
[assembly: XmlnsPrefix("http://schemas.spicytaco.io/", "st")]
[assembly: XmlnsDefinition("http://schemas.spicytaco.io/", "AutoGrid")]
[assembly: TargetFramework(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
[assembly: AssemblyVersion("1.2.29.0")]
namespace AutoGrid;

public class AutoGrid : Grid
{
	public static readonly DependencyProperty AutoIndexProperty = DependencyProperty.RegisterAttached("AutoIndex", typeof(bool), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)true, (FrameworkPropertyMetadataOptions)4));

	public static readonly DependencyProperty RowHeightOverrideProperty = DependencyProperty.RegisterAttached("RowHeightOverride", typeof(GridLength?), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)7));

	public static readonly DependencyProperty ColumnWidthOverrideProperty = DependencyProperty.RegisterAttached("ColumnWidthOverride", typeof(GridLength?), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)7));

	public static readonly DependencyProperty ChildHorizontalAlignmentProperty = DependencyProperty.Register("ChildHorizontalAlignment", typeof(HorizontalAlignment?), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)3, new PropertyChangedCallback(OnChildHorizontalAlignmentChanged)));

	public static readonly DependencyProperty ChildMarginProperty = DependencyProperty.Register("ChildMargin", typeof(Thickness?), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)3, new PropertyChangedCallback(OnChildMarginChanged)));

	public static readonly DependencyProperty ChildVerticalAlignmentProperty = DependencyProperty.Register("ChildVerticalAlignment", typeof(VerticalAlignment?), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)3, new PropertyChangedCallback(OnChildVerticalAlignmentChanged)));

	public static readonly DependencyProperty ColumnsProperty = DependencyProperty.RegisterAttached("Columns", typeof(string), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)"", (FrameworkPropertyMetadataOptions)3, new PropertyChangedCallback(ColumnsChanged)));

	public static readonly DependencyProperty ColumnWidthProperty = DependencyProperty.RegisterAttached("ColumnWidth", typeof(GridLength), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)GridLength.Auto, (FrameworkPropertyMetadataOptions)3, new PropertyChangedCallback(FixedColumnWidthChanged)));

	public static readonly DependencyProperty IsAutoIndexingProperty = DependencyProperty.Register("IsAutoIndexing", typeof(bool), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)true, (FrameworkPropertyMetadataOptions)3, new PropertyChangedCallback(OnPropertyChanged)));

	public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)(Orientation)0, (FrameworkPropertyMetadataOptions)3, new PropertyChangedCallback(OnPropertyChanged)));

	public static readonly DependencyProperty RowHeightProperty = DependencyProperty.RegisterAttached("RowHeight", typeof(GridLength), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)GridLength.Auto, (FrameworkPropertyMetadataOptions)3, new PropertyChangedCallback(FixedRowHeightChanged)));

	public static readonly DependencyProperty RowsProperty = DependencyProperty.RegisterAttached("Rows", typeof(string), typeof(AutoGrid), (PropertyMetadata)new FrameworkPropertyMetadata((object)"", (FrameworkPropertyMetadataOptions)3, new PropertyChangedCallback(RowsChanged)));

	private bool _shouldReindex = true;

	private int _rowOrColumnCount;

	[Category("Layout")]
	[Description("Presets the horizontal alignment of all child controls")]
	public HorizontalAlignment? ChildHorizontalAlignment
	{
		get
		{
			return (HorizontalAlignment?)((DependencyObject)this).GetValue(ChildHorizontalAlignmentProperty);
		}
		set
		{
			((DependencyObject)this).SetValue(ChildHorizontalAlignmentProperty, (object)value);
		}
	}

	[Category("Layout")]
	[Description("Presets the margin of all child controls")]
	public Thickness? ChildMargin
	{
		get
		{
			return (Thickness?)((DependencyObject)this).GetValue(ChildMarginProperty);
		}
		set
		{
			((DependencyObject)this).SetValue(ChildMarginProperty, (object)value);
		}
	}

	[Category("Layout")]
	[Description("Presets the vertical alignment of all child controls")]
	public VerticalAlignment? ChildVerticalAlignment
	{
		get
		{
			return (VerticalAlignment?)((DependencyObject)this).GetValue(ChildVerticalAlignmentProperty);
		}
		set
		{
			((DependencyObject)this).SetValue(ChildVerticalAlignmentProperty, (object)value);
		}
	}

	[Category("Layout")]
	[Description("Defines all columns using comma separated grid length notation")]
	public string Columns
	{
		get
		{
			return (string)((DependencyObject)this).GetValue(ColumnsProperty);
		}
		set
		{
			((DependencyObject)this).SetValue(ColumnsProperty, (object)value);
		}
	}

	[Category("Layout")]
	[Description("Presets the width of all columns set using the ColumnCount property")]
	public GridLength ColumnWidth
	{
		get
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			return (GridLength)((DependencyObject)this).GetValue(ColumnWidthProperty);
		}
		set
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((DependencyObject)this).SetValue(ColumnWidthProperty, (object)value);
		}
	}

	[Category("Layout")]
	[Description("Set to false to disable the auto layout functionality")]
	public bool IsAutoIndexing
	{
		get
		{
			return (bool)((DependencyObject)this).GetValue(IsAutoIndexingProperty);
		}
		set
		{
			((DependencyObject)this).SetValue(IsAutoIndexingProperty, (object)value);
		}
	}

	[Category("Layout")]
	[Description("Defines the directionality of the autolayout. Use vertical for a column first layout, horizontal for a row first layout.")]
	public Orientation Orientation
	{
		get
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			return (Orientation)((DependencyObject)this).GetValue(OrientationProperty);
		}
		set
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((DependencyObject)this).SetValue(OrientationProperty, (object)value);
		}
	}

	[Category("Layout")]
	[Description("Presets the height of all rows set using the RowCount property")]
	public GridLength RowHeight
	{
		get
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			return (GridLength)((DependencyObject)this).GetValue(RowHeightProperty);
		}
		set
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((DependencyObject)this).SetValue(RowHeightProperty, (object)value);
		}
	}

	[Category("Layout")]
	[Description("Defines all rows using comma separated grid length notation")]
	public string Rows
	{
		get
		{
			return (string)((DependencyObject)this).GetValue(RowsProperty);
		}
		set
		{
			((DependencyObject)this).SetValue(RowsProperty, (object)value);
		}
	}

	public static void SetAutoIndex(DependencyObject element, bool value)
	{
		element.SetValue(AutoIndexProperty, (object)value);
	}

	public static bool GetAutoIndex(DependencyObject element)
	{
		return (bool)element.GetValue(AutoIndexProperty);
	}

	public static void SetRowHeightOverride(DependencyObject element, GridLength? value)
	{
		element.SetValue(RowHeightOverrideProperty, (object)value);
	}

	public static GridLength? GetRowHeightOverride(DependencyObject element)
	{
		return (GridLength?)element.GetValue(RowHeightOverrideProperty);
	}

	public static void SetColumnWidthOverride(DependencyObject element, GridLength? value)
	{
		element.SetValue(ColumnWidthOverrideProperty, (object)value);
	}

	public static GridLength? GetColumnWidthOverride(DependencyObject element)
	{
		return (GridLength?)element.GetValue(ColumnWidthOverrideProperty);
	}

	public static void ColumnCountChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		if ((int)((DependencyPropertyChangedEventArgs)(ref e)).NewValue >= 0)
		{
			AutoGrid autoGrid = d as AutoGrid;
			GridLength width = GridLength.Auto;
			if (((Grid)autoGrid).ColumnDefinitions.Count > 0)
			{
				width = ((Grid)autoGrid).ColumnDefinitions[0].Width;
			}
			((Grid)autoGrid).ColumnDefinitions.Clear();
			for (int i = 0; i < (int)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; i++)
			{
				((Grid)autoGrid).ColumnDefinitions.Add(new ColumnDefinition
				{
					Width = width
				});
			}
		}
	}

	public static void ColumnsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		if (!((string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue == string.Empty))
		{
			AutoGrid autoGrid = d as AutoGrid;
			((Grid)autoGrid).ColumnDefinitions.Clear();
			GridLength[] array = Parse((string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue);
			GridLength[] array2 = array;
			foreach (GridLength width in array2)
			{
				((Grid)autoGrid).ColumnDefinitions.Add(new ColumnDefinition
				{
					Width = width
				});
			}
		}
	}

	public static void FixedColumnWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		AutoGrid autoGrid = d as AutoGrid;
		if (((Grid)autoGrid).ColumnDefinitions.Count == 0)
		{
			((Grid)autoGrid).ColumnDefinitions.Add(new ColumnDefinition());
		}
		for (int i = 0; i < ((Grid)autoGrid).ColumnDefinitions.Count; i++)
		{
			((Grid)autoGrid).ColumnDefinitions[i].Width = (GridLength)((DependencyPropertyChangedEventArgs)(ref e)).NewValue;
		}
	}

	public static void FixedRowHeightChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		AutoGrid autoGrid = d as AutoGrid;
		if (((Grid)autoGrid).RowDefinitions.Count == 0)
		{
			((Grid)autoGrid).RowDefinitions.Add(new RowDefinition());
		}
		for (int i = 0; i < ((Grid)autoGrid).RowDefinitions.Count; i++)
		{
			((Grid)autoGrid).RowDefinitions[i].Height = (GridLength)((DependencyPropertyChangedEventArgs)(ref e)).NewValue;
		}
	}

	public static GridLength[] Parse(string text)
	{
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		string[] array = text.Split(new char[1] { ',' });
		GridLength[] array2 = (GridLength[])(object)new GridLength[array.Length];
		for (int i = 0; i < array.Length; i++)
		{
			string text2 = array[i];
			double result;
			if (Enumerable.Contains(text2, '*'))
			{
				if (!double.TryParse(text2.Replace("*", ""), out result))
				{
					result = 1.0;
				}
				array2[i] = new GridLength(result, (GridUnitType)2);
			}
			else if (double.TryParse(text2, out result))
			{
				array2[i] = new GridLength(result);
			}
			else
			{
				array2[i] = GridLength.Auto;
			}
		}
		return array2;
	}

	public static void RowCountChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		if ((int)((DependencyPropertyChangedEventArgs)(ref e)).NewValue >= 0)
		{
			AutoGrid autoGrid = d as AutoGrid;
			GridLength height = GridLength.Auto;
			if (((Grid)autoGrid).RowDefinitions.Count > 0)
			{
				height = ((Grid)autoGrid).RowDefinitions[0].Height;
			}
			((Grid)autoGrid).RowDefinitions.Clear();
			for (int i = 0; i < (int)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; i++)
			{
				((Grid)autoGrid).RowDefinitions.Add(new RowDefinition
				{
					Height = height
				});
			}
		}
	}

	public static void RowsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		if (!((string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue == string.Empty))
		{
			AutoGrid autoGrid = d as AutoGrid;
			((Grid)autoGrid).RowDefinitions.Clear();
			GridLength[] array = Parse((string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue);
			GridLength[] array2 = array;
			foreach (GridLength height in array2)
			{
				((Grid)autoGrid).RowDefinitions.Add(new RowDefinition
				{
					Height = height
				});
			}
		}
	}

	private static void OnChildHorizontalAlignmentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		AutoGrid autoGrid = d as AutoGrid;
		foreach (UIElement child in ((Panel)autoGrid).Children)
		{
			UIElement val = child;
			if (autoGrid.ChildHorizontalAlignment.HasValue)
			{
				((DependencyObject)val).SetValue(FrameworkElement.HorizontalAlignmentProperty, (object)autoGrid.ChildHorizontalAlignment);
			}
			else
			{
				((DependencyObject)val).SetValue(FrameworkElement.HorizontalAlignmentProperty, DependencyProperty.UnsetValue);
			}
		}
	}

	private static void OnChildMarginChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		AutoGrid autoGrid = d as AutoGrid;
		foreach (UIElement child in ((Panel)autoGrid).Children)
		{
			UIElement val = child;
			if (autoGrid.ChildMargin.HasValue)
			{
				((DependencyObject)val).SetValue(FrameworkElement.MarginProperty, (object)autoGrid.ChildMargin);
			}
			else
			{
				((DependencyObject)val).SetValue(FrameworkElement.MarginProperty, DependencyProperty.UnsetValue);
			}
		}
	}

	private static void OnChildVerticalAlignmentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		AutoGrid autoGrid = d as AutoGrid;
		foreach (UIElement child in ((Panel)autoGrid).Children)
		{
			UIElement val = child;
			if (autoGrid.ChildVerticalAlignment.HasValue)
			{
				((DependencyObject)val).SetValue(FrameworkElement.VerticalAlignmentProperty, (object)autoGrid.ChildVerticalAlignment);
			}
			else
			{
				((DependencyObject)val).SetValue(FrameworkElement.VerticalAlignmentProperty, DependencyProperty.UnsetValue);
			}
		}
	}

	private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
	{
		((AutoGrid)(object)d)._shouldReindex = true;
	}

	private void ApplyChildLayout(UIElement child)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		if (ChildMargin.HasValue)
		{
			((DependencyObject)(object)child).SetIfDefault<Thickness>(FrameworkElement.MarginProperty, ChildMargin.Value);
		}
		if (ChildHorizontalAlignment.HasValue)
		{
			((DependencyObject)(object)child).SetIfDefault<HorizontalAlignment>(FrameworkElement.HorizontalAlignmentProperty, ChildHorizontalAlignment.Value);
		}
		if (ChildVerticalAlignment.HasValue)
		{
			((DependencyObject)(object)child).SetIfDefault<VerticalAlignment>(FrameworkElement.VerticalAlignmentProperty, ChildVerticalAlignment.Value);
		}
	}

	private int Clamp(int value, int max)
	{
		return (value > max) ? max : value;
	}

	public void PerformLayout()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Invalid comparison between Unknown and I4
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Expected O, but got Unknown
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Expected O, but got Unknown
		//IL_052e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0561: Unknown result type (might be due to invalid IL or missing references)
		//IL_0594: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Expected O, but got Unknown
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Expected O, but got Unknown
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
		bool flag = (int)Orientation == 1;
		if (!_shouldReindex && (!IsAutoIndexing || ((!flag || _rowOrColumnCount == ((Grid)this).ColumnDefinitions.Count) && (flag || _rowOrColumnCount == ((Grid)this).RowDefinitions.Count))))
		{
			return;
		}
		_shouldReindex = false;
		if (IsAutoIndexing)
		{
			_rowOrColumnCount = ((((Grid)this).ColumnDefinitions.Count != 0) ? ((Grid)this).ColumnDefinitions.Count : ((Grid)this).RowDefinitions.Count);
			if (_rowOrColumnCount == 0)
			{
				_rowOrColumnCount = 1;
			}
			int num = 0;
			foreach (UIElement child in ((Panel)this).Children)
			{
				UIElement val = child;
				if (GetAutoIndex((DependencyObject)(object)val))
				{
					num += ((((Grid)this).ColumnDefinitions.Count != 0) ? Grid.GetColumnSpan(val) : Grid.GetRowSpan(val));
				}
			}
			if (((Grid)this).ColumnDefinitions.Count != 0)
			{
				int num2 = (int)Math.Ceiling((double)num / (double)_rowOrColumnCount);
				while (((Grid)this).RowDefinitions.Count < num2)
				{
					RowDefinition val2 = new RowDefinition();
					val2.Height = RowHeight;
					((Grid)this).RowDefinitions.Add(val2);
				}
				if (((Grid)this).RowDefinitions.Count > num2)
				{
					((Grid)this).RowDefinitions.RemoveRange(num2, ((Grid)this).RowDefinitions.Count - num2);
				}
			}
			else
			{
				int num3 = (int)Math.Ceiling((double)num / (double)_rowOrColumnCount);
				while (((Grid)this).ColumnDefinitions.Count < num3)
				{
					ColumnDefinition val3 = new ColumnDefinition();
					val3.Width = ColumnWidth;
					((Grid)this).ColumnDefinitions.Add(val3);
				}
				if (((Grid)this).ColumnDefinitions.Count > num3)
				{
					((Grid)this).ColumnDefinitions.RemoveRange(num3, ((Grid)this).ColumnDefinitions.Count - num3);
				}
			}
		}
		int cellPosition = 0;
		Queue<int> cellsToSkip = new Queue<int>();
		foreach (UIElement child2 in ((Panel)this).Children)
		{
			UIElement val4 = child2;
			if (IsAutoIndexing && GetAutoIndex((DependencyObject)(object)val4))
			{
				if (cellsToSkip.Any() && cellsToSkip.Peek() == cellPosition)
				{
					cellsToSkip.Dequeue();
					cellPosition++;
				}
				if (!flag)
				{
					int num4 = cellPosition / ((Grid)this).ColumnDefinitions.Count;
					Grid.SetRow(val4, num4);
					int num5 = cellPosition % ((Grid)this).ColumnDefinitions.Count;
					Grid.SetColumn(val4, num5);
					int rowSpan = Grid.GetRowSpan(val4);
					if (rowSpan > 1)
					{
						Enumerable.Range(1, rowSpan).ToList().ForEach(delegate(int x)
						{
							cellsToSkip.Enqueue(cellPosition + ((Grid)this).ColumnDefinitions.Count * x);
						});
					}
					GridLength? rowHeightOverride = GetRowHeightOverride((DependencyObject)(object)val4);
					if (rowHeightOverride.HasValue)
					{
						((Grid)this).RowDefinitions[num4].Height = rowHeightOverride.Value;
					}
					GridLength? columnWidthOverride = GetColumnWidthOverride((DependencyObject)(object)val4);
					if (columnWidthOverride.HasValue)
					{
						((Grid)this).ColumnDefinitions[num5].Width = columnWidthOverride.Value;
					}
					cellPosition += Grid.GetColumnSpan(val4);
				}
				else
				{
					int num6 = cellPosition % ((Grid)this).RowDefinitions.Count;
					Grid.SetRow(val4, num6);
					int num7 = cellPosition / ((Grid)this).RowDefinitions.Count;
					Grid.SetColumn(val4, num7);
					int columnSpan = Grid.GetColumnSpan(val4);
					if (columnSpan > 1)
					{
						Enumerable.Range(1, columnSpan).ToList().ForEach(delegate(int x)
						{
							cellsToSkip.Enqueue(cellPosition + ((Grid)this).RowDefinitions.Count * x);
						});
					}
					GridLength? rowHeightOverride2 = GetRowHeightOverride((DependencyObject)(object)val4);
					if (rowHeightOverride2.HasValue)
					{
						((Grid)this).RowDefinitions[num6].Height = rowHeightOverride2.Value;
					}
					GridLength? columnWidthOverride2 = GetColumnWidthOverride((DependencyObject)(object)val4);
					if (columnWidthOverride2.HasValue)
					{
						((Grid)this).ColumnDefinitions[num7].Width = columnWidthOverride2.Value;
					}
					cellPosition += Grid.GetRowSpan(val4);
				}
			}
			if (ChildMargin.HasValue)
			{
				((DependencyObject)(object)val4).SetIfDefault<Thickness>(FrameworkElement.MarginProperty, ChildMargin.Value);
			}
			if (ChildHorizontalAlignment.HasValue)
			{
				((DependencyObject)(object)val4).SetIfDefault<HorizontalAlignment>(FrameworkElement.HorizontalAlignmentProperty, ChildHorizontalAlignment.Value);
			}
			if (ChildVerticalAlignment.HasValue)
			{
				((DependencyObject)(object)val4).SetIfDefault<VerticalAlignment>(FrameworkElement.VerticalAlignmentProperty, ChildVerticalAlignment.Value);
			}
		}
	}

	protected override Size MeasureOverride(Size constraint)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		PerformLayout();
		return ((Grid)this).MeasureOverride(constraint);
	}

	protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)
	{
		_shouldReindex = true;
		((Grid)this).OnVisualChildrenChanged(visualAdded, visualRemoved);
	}
}
public static class DependencyHelpers
{
	public static DependencyProperty GetDependencyProperty(Type type, string propertyName)
	{
		DependencyProperty result = null;
		if (type != null)
		{
			FieldInfo field = type.GetField(propertyName + "Property", BindingFlags.Static | BindingFlags.Public);
			if (field != null)
			{
				object? value = field.GetValue(null);
				result = (DependencyProperty)((value is DependencyProperty) ? value : null);
			}
		}
		return result;
	}

	public static DependencyProperty GetDependencyProperty(this DependencyObject o, string propertyName)
	{
		DependencyProperty result = null;
		if (o != null)
		{
			result = GetDependencyProperty(((object)o).GetType(), propertyName);
		}
		return result;
	}

	public static bool SetIfDefault<T>(this DependencyObject o, DependencyProperty property, T value)
	{
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Invalid comparison between Unknown and I4
		if (o == null)
		{
			throw new ArgumentNullException("o", "DependencyObject cannot be null");
		}
		if (property == null)
		{
			throw new ArgumentNullException("property", "DependencyProperty cannot be null");
		}
		if (!property.PropertyType.IsAssignableFrom(typeof(T)))
		{
			throw new ArgumentException($"Expected {property.Name} to be of type {typeof(T).Name} but was {property.PropertyType}");
		}
		ValueSource valueSource = DependencyPropertyHelper.GetValueSource(o, property);
		if ((int)((ValueSource)(ref valueSource)).BaseValueSource == 1)
		{
			o.SetValue(property, (object)value);
			return true;
		}
		return false;
	}
}
public class StackPanel : Panel
{
	public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(StackPanel), (PropertyMetadata)new FrameworkPropertyMetadata((object)(Orientation)1, (FrameworkPropertyMetadataOptions)3));

	public static readonly DependencyProperty MarginBetweenChildrenProperty = DependencyProperty.Register("MarginBetweenChildren", typeof(double), typeof(StackPanel), (PropertyMetadata)new FrameworkPropertyMetadata((object)0.0, (FrameworkPropertyMetadataOptions)3));

	public static readonly DependencyProperty FillProperty = DependencyProperty.RegisterAttached("Fill", typeof(StackPanelFill), typeof(StackPanel), (PropertyMetadata)new FrameworkPropertyMetadata((object)StackPanelFill.Auto, (FrameworkPropertyMetadataOptions)15));

	public Orientation Orientation
	{
		get
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			return (Orientation)((DependencyObject)this).GetValue(OrientationProperty);
		}
		set
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((DependencyObject)this).SetValue(OrientationProperty, (object)value);
		}
	}

	public double MarginBetweenChildren
	{
		get
		{
			return (double)((DependencyObject)this).GetValue(MarginBetweenChildrenProperty);
		}
		set
		{
			((DependencyObject)this).SetValue(MarginBetweenChildrenProperty, (object)value);
		}
	}

	protected override Size MeasureOverride(Size constraint)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Invalid comparison between Unknown and I4
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Unknown result type (might be due to invalid IL or missing references)
		UIElementCollection internalChildren = ((Panel)this).InternalChildren;
		double val = 0.0;
		double val2 = 0.0;
		double num = 0.0;
		double num2 = 0.0;
		bool flag = (int)Orientation == 0;
		double num3 = CalculateTotalMarginToAdd(internalChildren, MarginBetweenChildren);
		Size val4 = default(Size);
		for (int i = 0; i < internalChildren.Count; i++)
		{
			UIElement val3 = internalChildren[i];
			if (val3 != null && GetFill((DependencyObject)(object)val3) == StackPanelFill.Auto)
			{
				((Size)(ref val4))..ctor(Math.Max(0.0, ((Size)(ref constraint)).Width - num), Math.Max(0.0, ((Size)(ref constraint)).Height - num2));
				val3.Measure(val4);
				Size desiredSize = val3.DesiredSize;
				if (flag)
				{
					num += ((Size)(ref desiredSize)).Width;
					val2 = Math.Max(val2, num2 + ((Size)(ref desiredSize)).Height);
				}
				else
				{
					val = Math.Max(val, num + ((Size)(ref desiredSize)).Width);
					num2 += ((Size)(ref desiredSize)).Height;
				}
			}
		}
		if (flag)
		{
			num += num3;
		}
		else
		{
			num2 += num3;
		}
		int num4 = ((IEnumerable)internalChildren).OfType<UIElement>().Count((UIElement x) => GetFill((DependencyObject)(object)x) == StackPanelFill.Fill && (int)x.Visibility != 2);
		double num5 = (flag ? Math.Max(0.0, ((Size)(ref constraint)).Width - num) : Math.Max(0.0, ((Size)(ref constraint)).Height - num2));
		double num6 = ((num4 > 0) ? (num5 / (double)num4) : 0.0);
		for (int j = 0; j < internalChildren.Count; j++)
		{
			UIElement val5 = internalChildren[j];
			if (val5 != null && GetFill((DependencyObject)(object)val5) == StackPanelFill.Fill)
			{
				Size val6 = (flag ? new Size(num6, Math.Max(0.0, ((Size)(ref constraint)).Height - num2)) : new Size(Math.Max(0.0, ((Size)(ref constraint)).Width - num), num6));
				val5.Measure(val6);
				Size desiredSize2 = val5.DesiredSize;
				if (flag)
				{
					num += ((Size)(ref desiredSize2)).Width;
					val2 = Math.Max(val2, num2 + ((Size)(ref desiredSize2)).Height);
				}
				else
				{
					val = Math.Max(val, num + ((Size)(ref desiredSize2)).Width);
					num2 += ((Size)(ref desiredSize2)).Height;
				}
			}
		}
		val = Math.Max(val, num);
		val2 = Math.Max(val2, num2);
		Size result = default(Size);
		((Size)(ref result))..ctor(val, val2);
		return result;
	}

	protected override Size ArrangeOverride(Size arrangeSize)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Invalid comparison between Unknown and I4
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Invalid comparison between Unknown and I4
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Invalid comparison between Unknown and I4
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		UIElementCollection internalChildren = ((Panel)this).InternalChildren;
		int count = internalChildren.Count;
		double num = 0.0;
		double num2 = 0.0;
		bool flag = (int)Orientation == 0;
		double marginBetweenChildren = MarginBetweenChildren;
		double num3 = CalculateTotalMarginToAdd(internalChildren, marginBetweenChildren);
		double num4 = 0.0;
		int num5 = 0;
		foreach (UIElement item in ((IEnumerable)internalChildren).OfType<UIElement>())
		{
			StackPanelFill fill = GetFill((DependencyObject)(object)item);
			if (fill != 0)
			{
				if ((int)item.Visibility != 2 && fill != StackPanelFill.Ignored)
				{
					num5++;
				}
				continue;
			}
			Size desiredSize;
			double num6;
			if (!flag)
			{
				desiredSize = item.DesiredSize;
				num6 = ((Size)(ref desiredSize)).Height;
			}
			else
			{
				desiredSize = item.DesiredSize;
				num6 = ((Size)(ref desiredSize)).Width;
			}
			double num7 = num6;
			num4 += num7;
		}
		double num8 = (flag ? Math.Max(0.0, ((Size)(ref arrangeSize)).Width - num4 - num3) : Math.Max(0.0, ((Size)(ref arrangeSize)).Height - num4 - num3));
		double num9 = num8 / (double)num5;
		Rect val2 = default(Rect);
		for (int i = 0; i < count; i++)
		{
			UIElement val = internalChildren[i];
			if (val != null)
			{
				Size desiredSize2 = val.DesiredSize;
				StackPanelFill fill2 = GetFill((DependencyObject)(object)val);
				bool flag2 = (int)val.Visibility == 2 || fill2 == StackPanelFill.Ignored;
				bool flag3 = i == count - 1;
				double num10 = ((flag3 || flag2) ? 0.0 : marginBetweenChildren);
				((Rect)(ref val2))..ctor(num, num2, Math.Max(0.0, ((Size)(ref arrangeSize)).Width - num), Math.Max(0.0, ((Size)(ref arrangeSize)).Height - num2));
				if (flag)
				{
					((Rect)(ref val2)).Width = ((fill2 == StackPanelFill.Auto || flag2) ? ((Size)(ref desiredSize2)).Width : num9);
					((Rect)(ref val2)).Height = ((Size)(ref arrangeSize)).Height;
					num += ((Rect)(ref val2)).Width + num10;
				}
				else
				{
					((Rect)(ref val2)).Width = ((Size)(ref arrangeSize)).Width;
					((Rect)(ref val2)).Height = ((fill2 == StackPanelFill.Auto || flag2) ? ((Size)(ref desiredSize2)).Height : num9);
					num2 += ((Rect)(ref val2)).Height + num10;
				}
				val.Arrange(val2);
			}
		}
		return arrangeSize;
	}

	private static double CalculateTotalMarginToAdd(UIElementCollection children, double marginBetweenChildren)
	{
		int num = ((IEnumerable)children).OfType<UIElement>().Count((UIElement x) => (int)x.Visibility != 2 && GetFill((DependencyObject)(object)x) != StackPanelFill.Ignored);
		int num2 = Math.Max(num - 1, 0);
		return marginBetweenChildren * (double)num2;
	}

	public static void SetFill(DependencyObject element, StackPanelFill value)
	{
		element.SetValue(FillProperty, (object)value);
	}

	public static StackPanelFill GetFill(DependencyObject element)
	{
		return (StackPanelFill)element.GetValue(FillProperty);
	}
}
public enum StackPanelFill
{
	Auto,
	Fill,
	Ignored
}

System.Text.Encodings.Web.dll

Decompiled 5 months ago
using System;
using System.Buffers;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Numerics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
using System.Runtime.Intrinsics.X86;
using System.Runtime.Versioning;
using System.Text.Unicode;
using System.Threading;
using FxResources.System.Text.Encodings.Web;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Text.Encodings.Web")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides types for encoding and escaping strings for use in JavaScript, HyperText Markup Language (HTML), and uniform resource locators (URL).\r\n\r\nCommonly Used Types:\r\nSystem.Text.Encodings.Web.HtmlEncoder\r\nSystem.Text.Encodings.Web.UrlEncoder\r\nSystem.Text.Encodings.Web.JavaScriptEncoder")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Text.Encodings.Web")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
[module: SkipLocalsInit]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NativeIntegerAttribute : Attribute
	{
		public readonly bool[] TransformFlags;

		public NativeIntegerAttribute()
		{
			TransformFlags = new bool[1] { true };
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FxResources.System.Text.Encodings.Web
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class HexConverter
	{
		public enum Casing : uint
		{
			Upper = 0u,
			Lower = 8224u
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
		{
			uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
			uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
			buffer[startingIndex + 1] = (byte)num2;
			buffer[startingIndex] = (byte)(num2 >> 8);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
		{
			uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
			uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
			buffer[startingIndex + 1] = (char)(num2 & 0xFFu);
			buffer[startingIndex] = (char)(num2 >> 8);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static char ToCharUpper(int value)
		{
			value &= 0xF;
			value += 48;
			if (value > 57)
			{
				value += 7;
			}
			return (char)value;
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

		internal static string TextEncoderDoesNotImplementMaxOutputCharsPerInputChar => GetResourceString("TextEncoderDoesNotImplementMaxOutputCharsPerInputChar");

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

		internal static string GetResourceString(string resourceKey)
		{
			if (UsingResourceKeys())
			{
				return resourceKey;
			}
			string result = null;
			try
			{
				result = ResourceManager.GetString(resourceKey);
			}
			catch (MissingManifestResourceException)
			{
			}
			return result;
		}
	}
}
namespace System.Text
{
	internal static class UnicodeUtility
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsAsciiCodePoint(uint value)
		{
			return value <= 127;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsBmpCodePoint(uint value)
		{
			return value <= 65535;
		}
	}
	[DefaultMember("Item")]
	internal ref struct ValueStringBuilder
	{
		private char[] _arrayToReturnToPool;

		private Span<char> _chars;

		private int _pos;

		public int Length
		{
			get
			{
				return _pos;
			}
			set
			{
				_pos = value;
			}
		}

		public ValueStringBuilder(Span<char> initialBuffer)
		{
			_arrayToReturnToPool = null;
			_chars = initialBuffer;
			_pos = 0;
		}

		public override string ToString()
		{
			string result = _chars.Slice(0, _pos).ToString();
			Dispose();
			return result;
		}

		public ReadOnlySpan<char> AsSpan()
		{
			return _chars.Slice(0, _pos);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Span<char> AppendSpan(int length)
		{
			int pos = _pos;
			if (pos > _chars.Length - length)
			{
				Grow(length);
			}
			_pos = pos + length;
			return _chars.Slice(pos, length);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void Grow(int additionalCapacityBeyondPos)
		{
			int minimumLength = (int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), Math.Min((uint)(_chars.Length * 2), 2147483591u));
			char[] array = ArrayPool<char>.Shared.Rent(minimumLength);
			_chars.Slice(0, _pos).CopyTo(array);
			char[] arrayToReturnToPool = _arrayToReturnToPool;
			_chars = (_arrayToReturnToPool = array);
			if (arrayToReturnToPool != null)
			{
				ArrayPool<char>.Shared.Return(arrayToReturnToPool);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Dispose()
		{
			char[] arrayToReturnToPool = _arrayToReturnToPool;
			this = default(System.Text.ValueStringBuilder);
			if (arrayToReturnToPool != null)
			{
				ArrayPool<char>.Shared.Return(arrayToReturnToPool);
			}
		}
	}
}
namespace System.Text.Unicode
{
	internal static class UnicodeHelpers
	{
		private static ReadOnlySpan<byte> DefinedCharsBitmapSpan => new byte[8192]
		{
			0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 127, 0, 0, 0, 0,
			254, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 252, 240, 215, 255, 255, 251, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 254, 255, 255, 255,
			127, 254, 255, 255, 255, 255, 255, 231, 254, 255,
			255, 255, 255, 255, 255, 0, 255, 255, 255, 135,
			31, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 191, 255, 255, 255, 255,
			255, 255, 255, 231, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 3, 0, 255, 255,
			255, 255, 255, 255, 255, 231, 255, 255, 255, 255,
			255, 63, 255, 127, 255, 255, 255, 79, 255, 7,
			255, 255, 255, 127, 3, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 239, 159, 249, 255, 255, 253,
			197, 243, 159, 121, 128, 176, 207, 255, 255, 127,
			238, 135, 249, 255, 255, 253, 109, 211, 135, 57,
			2, 94, 192, 255, 127, 0, 238, 191, 251, 255,
			255, 253, 237, 243, 191, 59, 1, 0, 207, 255,
			3, 254, 238, 159, 249, 255, 255, 253, 237, 243,
			159, 57, 224, 176, 207, 255, 255, 0, 236, 199,
			61, 214, 24, 199, 255, 195, 199, 61, 129, 0,
			192, 255, 255, 7, 255, 223, 253, 255, 255, 253,
			255, 243, 223, 61, 96, 39, 207, 255, 128, 255,
			255, 223, 253, 255, 255, 253, 239, 243, 223, 61,
			96, 96, 207, 255, 6, 0, 255, 223, 253, 255,
			255, 255, 255, 255, 223, 253, 240, 255, 207, 255,
			255, 255, 238, 255, 127, 252, 255, 255, 251, 47,
			127, 132, 95, 255, 192, 255, 28, 0, 254, 255,
			255, 255, 255, 255, 255, 135, 255, 255, 255, 15,
			0, 0, 0, 0, 214, 247, 255, 255, 175, 255,
			255, 63, 95, 63, 255, 243, 0, 0, 0, 0,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 254,
			255, 255, 255, 31, 254, 255, 255, 255, 255, 254,
			255, 255, 255, 223, 255, 223, 255, 7, 0, 0,
			0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 191, 32, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 61, 127, 61, 255, 255,
			255, 255, 255, 61, 255, 255, 255, 255, 61, 127,
			61, 255, 127, 255, 255, 255, 255, 255, 255, 255,
			61, 255, 255, 255, 255, 255, 255, 255, 255, 231,
			255, 255, 255, 31, 255, 255, 255, 3, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 63, 63,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			254, 255, 255, 31, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 1, 255, 255, 63, 128,
			255, 255, 127, 0, 255, 255, 15, 0, 255, 223,
			13, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 63, 255, 3, 255, 3, 255, 255,
			255, 3, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 1, 255, 255, 255, 255, 255, 7,
			255, 255, 255, 255, 255, 255, 255, 255, 63, 0,
			255, 255, 255, 127, 255, 15, 255, 15, 241, 255,
			255, 255, 255, 63, 31, 0, 255, 255, 255, 255,
			255, 15, 255, 255, 255, 3, 255, 199, 255, 255,
			255, 255, 255, 255, 255, 207, 255, 255, 255, 255,
			255, 255, 255, 127, 255, 255, 255, 159, 255, 3,
			255, 3, 255, 63, 255, 255, 255, 127, 0, 0,
			0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 31, 255, 255, 255, 255, 255, 127,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 15, 240, 255, 255, 255, 255,
			255, 255, 255, 248, 255, 227, 255, 255, 255, 255,
			255, 255, 255, 1, 255, 255, 255, 255, 255, 231,
			255, 0, 255, 255, 255, 255, 255, 7, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 63, 63, 255, 255, 255, 255,
			63, 63, 255, 170, 255, 255, 255, 63, 255, 255,
			255, 255, 255, 255, 223, 255, 223, 255, 207, 239,
			255, 255, 220, 127, 0, 248, 255, 255, 255, 124,
			255, 255, 255, 255, 255, 127, 223, 255, 243, 255,
			255, 127, 255, 31, 255, 255, 255, 255, 1, 0,
			255, 255, 255, 255, 1, 0, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 15, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 127, 0, 0, 0,
			255, 7, 0, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			207, 255, 255, 255, 191, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 15, 254,
			255, 255, 255, 255, 191, 32, 255, 255, 255, 255,
			255, 255, 255, 128, 1, 128, 255, 255, 127, 0,
			127, 127, 127, 127, 127, 127, 127, 127, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 63, 0, 0, 0, 0, 255, 255,
			255, 251, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 15, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			63, 0, 0, 0, 255, 15, 254, 255, 255, 255,
			255, 255, 255, 255, 254, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 127, 254, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 224, 255,
			255, 255, 255, 255, 254, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 127, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 15, 0, 255, 255,
			255, 255, 255, 127, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 31, 255, 255, 255, 255,
			255, 255, 127, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 15, 0, 0,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 7,
			235, 3, 0, 0, 252, 255, 255, 255, 255, 255,
			255, 31, 255, 3, 255, 255, 255, 255, 255, 255,
			255, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			63, 192, 255, 3, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 15, 128,
			255, 255, 255, 31, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 191, 255, 195, 255, 255, 255, 127,
			255, 255, 255, 255, 255, 255, 127, 0, 255, 63,
			255, 243, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 7, 0, 0, 248, 255, 255,
			127, 0, 126, 126, 126, 0, 127, 127, 255, 255,
			255, 255, 255, 255, 255, 15, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 63, 255, 3, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			15, 0, 255, 255, 127, 248, 255, 255, 255, 255,
			255, 15, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 63, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 3, 0, 0,
			0, 0, 127, 0, 248, 224, 255, 255, 127, 95,
			219, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 7, 0, 248, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 252, 255, 255, 255, 255, 255,
			255, 128, 0, 0, 0, 0, 255, 255, 255, 255,
			255, 3, 255, 255, 255, 255, 255, 255, 247, 255,
			127, 15, 223, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 31,
			254, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 127, 252, 252, 252, 28, 127, 127,
			0, 62
		};

		internal static ReadOnlySpan<byte> GetDefinedBmpCodePointsBitmapLittleEndian()
		{
			return DefinedCharsBitmapSpan;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void GetUtf16SurrogatePairFromAstralScalarValue(uint scalar, out char highSurrogate, out char lowSurrogate)
		{
			highSurrogate = (char)(scalar + 56557568 >> 10);
			lowSurrogate = (char)((scalar & 0x3FF) + 56320);
		}

		internal static int GetUtf8RepresentationForScalarValue(uint scalar)
		{
			if (scalar <= 127)
			{
				return (byte)scalar;
			}
			if (scalar <= 2047)
			{
				byte b = (byte)(0xC0u | (scalar >> 6));
				byte b2 = (byte)(0x80u | (scalar & 0x3Fu));
				return (b2 << 8) | b;
			}
			if (scalar <= 65535)
			{
				byte b3 = (byte)(0xE0u | (scalar >> 12));
				byte b4 = (byte)(0x80u | ((scalar >> 6) & 0x3Fu));
				byte b5 = (byte)(0x80u | (scalar & 0x3Fu));
				return (((b5 << 8) | b4) << 8) | b3;
			}
			byte b6 = (byte)(0xF0u | (scalar >> 18));
			byte b7 = (byte)(0x80u | ((scalar >> 12) & 0x3Fu));
			byte b8 = (byte)(0x80u | ((scalar >> 6) & 0x3Fu));
			byte b9 = (byte)(0x80u | (scalar & 0x3Fu));
			return (((((b9 << 8) | b8) << 8) | b7) << 8) | b6;
		}
	}
	public sealed class UnicodeRange
	{
		public int FirstCodePoint { get; private set; }

		public int Length { get; private set; }

		public UnicodeRange(int firstCodePoint, int length)
		{
			if (firstCodePoint < 0 || firstCodePoint > 65535)
			{
				throw new ArgumentOutOfRangeException("firstCodePoint");
			}
			if (length < 0 || (long)firstCodePoint + (long)length > 65536)
			{
				throw new ArgumentOutOfRangeException("length");
			}
			FirstCodePoint = firstCodePoint;
			Length = length;
		}

		public static UnicodeRange Create(char firstCharacter, char lastCharacter)
		{
			if (lastCharacter < firstCharacter)
			{
				throw new ArgumentOutOfRangeException("lastCharacter");
			}
			return new UnicodeRange(firstCharacter, 1 + (lastCharacter - firstCharacter));
		}
	}
	public static class UnicodeRanges
	{
		private static UnicodeRange _none;

		private static UnicodeRange _all;

		private static UnicodeRange _u0000;

		private static UnicodeRange _u0080;

		private static UnicodeRange _u0100;

		private static UnicodeRange _u0180;

		private static UnicodeRange _u0250;

		private static UnicodeRange _u02B0;

		private static UnicodeRange _u0300;

		private static UnicodeRange _u0370;

		private static UnicodeRange _u0400;

		private static UnicodeRange _u0500;

		private static UnicodeRange _u0530;

		private static UnicodeRange _u0590;

		private static UnicodeRange _u0600;

		private static UnicodeRange _u0700;

		private static UnicodeRange _u0750;

		private static UnicodeRange _u0780;

		private static UnicodeRange _u07C0;

		private static UnicodeRange _u0800;

		private static UnicodeRange _u0840;

		private static UnicodeRange _u0860;

		private static UnicodeRange _u0870;

		private static UnicodeRange _u08A0;

		private static UnicodeRange _u0900;

		private static UnicodeRange _u0980;

		private static UnicodeRange _u0A00;

		private static UnicodeRange _u0A80;

		private static UnicodeRange _u0B00;

		private static UnicodeRange _u0B80;

		private static UnicodeRange _u0C00;

		private static UnicodeRange _u0C80;

		private static UnicodeRange _u0D00;

		private static UnicodeRange _u0D80;

		private static UnicodeRange _u0E00;

		private static UnicodeRange _u0E80;

		private static UnicodeRange _u0F00;

		private static UnicodeRange _u1000;

		private static UnicodeRange _u10A0;

		private static UnicodeRange _u1100;

		private static UnicodeRange _u1200;

		private static UnicodeRange _u1380;

		private static UnicodeRange _u13A0;

		private static UnicodeRange _u1400;

		private static UnicodeRange _u1680;

		private static UnicodeRange _u16A0;

		private static UnicodeRange _u1700;

		private static UnicodeRange _u1720;

		private static UnicodeRange _u1740;

		private static UnicodeRange _u1760;

		private static UnicodeRange _u1780;

		private static UnicodeRange _u1800;

		private static UnicodeRange _u18B0;

		private static UnicodeRange _u1900;

		private static UnicodeRange _u1950;

		private static UnicodeRange _u1980;

		private static UnicodeRange _u19E0;

		private static UnicodeRange _u1A00;

		private static UnicodeRange _u1A20;

		private static UnicodeRange _u1AB0;

		private static UnicodeRange _u1B00;

		private static UnicodeRange _u1B80;

		private static UnicodeRange _u1BC0;

		private static UnicodeRange _u1C00;

		private static UnicodeRange _u1C50;

		private static UnicodeRange _u1C80;

		private static UnicodeRange _u1C90;

		private static UnicodeRange _u1CC0;

		private static UnicodeRange _u1CD0;

		private static UnicodeRange _u1D00;

		private static UnicodeRange _u1D80;

		private static UnicodeRange _u1DC0;

		private static UnicodeRange _u1E00;

		private static UnicodeRange _u1F00;

		private static UnicodeRange _u2000;

		private static UnicodeRange _u2070;

		private static UnicodeRange _u20A0;

		private static UnicodeRange _u20D0;

		private static UnicodeRange _u2100;

		private static UnicodeRange _u2150;

		private static UnicodeRange _u2190;

		private static UnicodeRange _u2200;

		private static UnicodeRange _u2300;

		private static UnicodeRange _u2400;

		private static UnicodeRange _u2440;

		private static UnicodeRange _u2460;

		private static UnicodeRange _u2500;

		private static UnicodeRange _u2580;

		private static UnicodeRange _u25A0;

		private static UnicodeRange _u2600;

		private static UnicodeRange _u2700;

		private static UnicodeRange _u27C0;

		private static UnicodeRange _u27F0;

		private static UnicodeRange _u2800;

		private static UnicodeRange _u2900;

		private static UnicodeRange _u2980;

		private static UnicodeRange _u2A00;

		private static UnicodeRange _u2B00;

		private static UnicodeRange _u2C00;

		private static UnicodeRange _u2C60;

		private static UnicodeRange _u2C80;

		private static UnicodeRange _u2D00;

		private static UnicodeRange _u2D30;

		private static UnicodeRange _u2D80;

		private static UnicodeRange _u2DE0;

		private static UnicodeRange _u2E00;

		private static UnicodeRange _u2E80;

		private static UnicodeRange _u2F00;

		private static UnicodeRange _u2FF0;

		private static UnicodeRange _u3000;

		private static UnicodeRange _u3040;

		private static UnicodeRange _u30A0;

		private static UnicodeRange _u3100;

		private static UnicodeRange _u3130;

		private static UnicodeRange _u3190;

		private static UnicodeRange _u31A0;

		private static UnicodeRange _u31C0;

		private static UnicodeRange _u31F0;

		private static UnicodeRange _u3200;

		private static UnicodeRange _u3300;

		private static UnicodeRange _u3400;

		private static UnicodeRange _u4DC0;

		private static UnicodeRange _u4E00;

		private static UnicodeRange _uA000;

		private static UnicodeRange _uA490;

		private static UnicodeRange _uA4D0;

		private static UnicodeRange _uA500;

		private static UnicodeRange _uA640;

		private static UnicodeRange _uA6A0;

		private static UnicodeRange _uA700;

		private static UnicodeRange _uA720;

		private static UnicodeRange _uA800;

		private static UnicodeRange _uA830;

		private static UnicodeRange _uA840;

		private static UnicodeRange _uA880;

		private static UnicodeRange _uA8E0;

		private static UnicodeRange _uA900;

		private static UnicodeRange _uA930;

		private static UnicodeRange _uA960;

		private static UnicodeRange _uA980;

		private static UnicodeRange _uA9E0;

		private static UnicodeRange _uAA00;

		private static UnicodeRange _uAA60;

		private static UnicodeRange _uAA80;

		private static UnicodeRange _uAAE0;

		private static UnicodeRange _uAB00;

		private static UnicodeRange _uAB30;

		private static UnicodeRange _uAB70;

		private static UnicodeRange _uABC0;

		private static UnicodeRange _uAC00;

		private static UnicodeRange _uD7B0;

		private static UnicodeRange _uF900;

		private static UnicodeRange _uFB00;

		private static UnicodeRange _uFB50;

		private static UnicodeRange _uFE00;

		private static UnicodeRange _uFE10;

		private static UnicodeRange _uFE20;

		private static UnicodeRange _uFE30;

		private static UnicodeRange _uFE50;

		private static UnicodeRange _uFE70;

		private static UnicodeRange _uFF00;

		private static UnicodeRange _uFFF0;

		public static UnicodeRange None => _none ?? CreateEmptyRange(ref _none);

		public static UnicodeRange All => _all ?? CreateRange(ref _all, '\0', '\uffff');

		public static UnicodeRange BasicLatin => _u0000 ?? CreateRange(ref _u0000, '\0', '\u007f');

		public static UnicodeRange Latin1Supplement => _u0080 ?? CreateRange(ref _u0080, '\u0080', 'ÿ');

		public static UnicodeRange LatinExtendedA => _u0100 ?? CreateRange(ref _u0100, 'Ā', 'ſ');

		public static UnicodeRange LatinExtendedB => _u0180 ?? CreateRange(ref _u0180, 'ƀ', 'ɏ');

		public static UnicodeRange IpaExtensions => _u0250 ?? CreateRange(ref _u0250, 'ɐ', 'ʯ');

		public static UnicodeRange SpacingModifierLetters => _u02B0 ?? CreateRange(ref _u02B0, 'ʰ', '\u02ff');

		public static UnicodeRange CombiningDiacriticalMarks => _u0300 ?? CreateRange(ref _u0300, '\u0300', '\u036f');

		public static UnicodeRange GreekandCoptic => _u0370 ?? CreateRange(ref _u0370, 'Ͱ', 'Ͽ');

		public static UnicodeRange Cyrillic => _u0400 ?? CreateRange(ref _u0400, 'Ѐ', 'ӿ');

		public static UnicodeRange CyrillicSupplement => _u0500 ?? CreateRange(ref _u0500, 'Ԁ', 'ԯ');

		public static UnicodeRange Armenian => _u0530 ?? CreateRange(ref _u0530, '\u0530', '֏');

		public static UnicodeRange Hebrew => _u0590 ?? CreateRange(ref _u0590, '\u0590', '\u05ff');

		public static UnicodeRange Arabic => _u0600 ?? CreateRange(ref _u0600, '\u0600', 'ۿ');

		public static UnicodeRange Syriac => _u0700 ?? CreateRange(ref _u0700, '܀', 'ݏ');

		public static UnicodeRange ArabicSupplement => _u0750 ?? CreateRange(ref _u0750, 'ݐ', 'ݿ');

		public static UnicodeRange Thaana => _u0780 ?? CreateRange(ref _u0780, 'ހ', '\u07bf');

		public static UnicodeRange NKo => _u07C0 ?? CreateRange(ref _u07C0, '߀', '߿');

		public static UnicodeRange Samaritan => _u0800 ?? CreateRange(ref _u0800, 'ࠀ', '\u083f');

		public static UnicodeRange Mandaic => _u0840 ?? CreateRange(ref _u0840, 'ࡀ', '\u085f');

		public static UnicodeRange SyriacSupplement => _u0860 ?? CreateRange(ref _u0860, 'ࡠ', '\u086f');

		public static UnicodeRange ArabicExtendedB => _u0870 ?? CreateRange(ref _u0870, '\u0870', '\u089f');

		public static UnicodeRange ArabicExtendedA => _u08A0 ?? CreateRange(ref _u08A0, 'ࢠ', '\u08ff');

		public static UnicodeRange Devanagari => _u0900 ?? CreateRange(ref _u0900, '\u0900', 'ॿ');

		public static UnicodeRange Bengali => _u0980 ?? CreateRange(ref _u0980, 'ঀ', '\u09ff');

		public static UnicodeRange Gurmukhi => _u0A00 ?? CreateRange(ref _u0A00, '\u0a00', '\u0a7f');

		public static UnicodeRange Gujarati => _u0A80 ?? CreateRange(ref _u0A80, '\u0a80', '\u0aff');

		public static UnicodeRange Oriya => _u0B00 ?? CreateRange(ref _u0B00, '\u0b00', '\u0b7f');

		public static UnicodeRange Tamil => _u0B80 ?? CreateRange(ref _u0B80, '\u0b80', '\u0bff');

		public static UnicodeRange Telugu => _u0C00 ?? CreateRange(ref _u0C00, '\u0c00', '౿');

		public static UnicodeRange Kannada => _u0C80 ?? CreateRange(ref _u0C80, 'ಀ', '\u0cff');

		public static UnicodeRange Malayalam => _u0D00 ?? CreateRange(ref _u0D00, '\u0d00', 'ൿ');

		public static UnicodeRange Sinhala => _u0D80 ?? CreateRange(ref _u0D80, '\u0d80', '\u0dff');

		public static UnicodeRange Thai => _u0E00 ?? CreateRange(ref _u0E00, '\u0e00', '\u0e7f');

		public static UnicodeRange Lao => _u0E80 ?? CreateRange(ref _u0E80, '\u0e80', '\u0eff');

		public static UnicodeRange Tibetan => _u0F00 ?? CreateRange(ref _u0F00, 'ༀ', '\u0fff');

		public static UnicodeRange Myanmar => _u1000 ?? CreateRange(ref _u1000, 'က', '႟');

		public static UnicodeRange Georgian => _u10A0 ?? CreateRange(ref _u10A0, 'Ⴀ', 'ჿ');

		public static UnicodeRange HangulJamo => _u1100 ?? CreateRange(ref _u1100, 'ᄀ', 'ᇿ');

		public static UnicodeRange Ethiopic => _u1200 ?? CreateRange(ref _u1200, 'ሀ', '\u137f');

		public static UnicodeRange EthiopicSupplement => _u1380 ?? CreateRange(ref _u1380, 'ᎀ', '\u139f');

		public static UnicodeRange Cherokee => _u13A0 ?? CreateRange(ref _u13A0, 'Ꭰ', '\u13ff');

		public static UnicodeRange UnifiedCanadianAboriginalSyllabics => _u1400 ?? CreateRange(ref _u1400, '᐀', 'ᙿ');

		public static UnicodeRange Ogham => _u1680 ?? CreateRange(ref _u1680, '\u1680', '\u169f');

		public static UnicodeRange Runic => _u16A0 ?? CreateRange(ref _u16A0, 'ᚠ', '\u16ff');

		public static UnicodeRange Tagalog => _u1700 ?? CreateRange(ref _u1700, 'ᜀ', '\u171f');

		public static UnicodeRange Hanunoo => _u1720 ?? CreateRange(ref _u1720, 'ᜠ', '\u173f');

		public static UnicodeRange Buhid => _u1740 ?? CreateRange(ref _u1740, 'ᝀ', '\u175f');

		public static UnicodeRange Tagbanwa => _u1760 ?? CreateRange(ref _u1760, 'ᝠ', '\u177f');

		public static UnicodeRange Khmer => _u1780 ?? CreateRange(ref _u1780, 'ក', '\u17ff');

		public static UnicodeRange Mongolian => _u1800 ?? CreateRange(ref _u1800, '᠀', '\u18af');

		public static UnicodeRange UnifiedCanadianAboriginalSyllabicsExtended => _u18B0 ?? CreateRange(ref _u18B0, 'ᢰ', '\u18ff');

		public static UnicodeRange Limbu => _u1900 ?? CreateRange(ref _u1900, 'ᤀ', '᥏');

		public static UnicodeRange TaiLe => _u1950 ?? CreateRange(ref _u1950, 'ᥐ', '\u197f');

		public static UnicodeRange NewTaiLue => _u1980 ?? CreateRange(ref _u1980, 'ᦀ', '᧟');

		public static UnicodeRange KhmerSymbols => _u19E0 ?? CreateRange(ref _u19E0, '᧠', '᧿');

		public static UnicodeRange Buginese => _u1A00 ?? CreateRange(ref _u1A00, 'ᨀ', '᨟');

		public static UnicodeRange TaiTham => _u1A20 ?? CreateRange(ref _u1A20, 'ᨠ', '\u1aaf');

		public static UnicodeRange CombiningDiacriticalMarksExtended => _u1AB0 ?? CreateRange(ref _u1AB0, '\u1ab0', '\u1aff');

		public static UnicodeRange Balinese => _u1B00 ?? CreateRange(ref _u1B00, '\u1b00', '\u1b7f');

		public static UnicodeRange Sundanese => _u1B80 ?? CreateRange(ref _u1B80, '\u1b80', 'ᮿ');

		public static UnicodeRange Batak => _u1BC0 ?? CreateRange(ref _u1BC0, 'ᯀ', '᯿');

		public static UnicodeRange Lepcha => _u1C00 ?? CreateRange(ref _u1C00, 'ᰀ', 'ᱏ');

		public static UnicodeRange OlChiki => _u1C50 ?? CreateRange(ref _u1C50, '᱐', '᱿');

		public static UnicodeRange CyrillicExtendedC => _u1C80 ?? CreateRange(ref _u1C80, 'ᲀ', '\u1c8f');

		public static UnicodeRange GeorgianExtended => _u1C90 ?? CreateRange(ref _u1C90, 'Ა', 'Ჿ');

		public static UnicodeRange SundaneseSupplement => _u1CC0 ?? CreateRange(ref _u1CC0, '᳀', '\u1ccf');

		public static UnicodeRange VedicExtensions => _u1CD0 ?? CreateRange(ref _u1CD0, '\u1cd0', '\u1cff');

		public static UnicodeRange PhoneticExtensions => _u1D00 ?? CreateRange(ref _u1D00, 'ᴀ', 'ᵿ');

		public static UnicodeRange PhoneticExtensionsSupplement => _u1D80 ?? CreateRange(ref _u1D80, 'ᶀ', 'ᶿ');

		public static UnicodeRange CombiningDiacriticalMarksSupplement => _u1DC0 ?? CreateRange(ref _u1DC0, '\u1dc0', '\u1dff');

		public static UnicodeRange LatinExtendedAdditional => _u1E00 ?? CreateRange(ref _u1E00, 'Ḁ', 'ỿ');

		public static UnicodeRange GreekExtended => _u1F00 ?? CreateRange(ref _u1F00, 'ἀ', '\u1fff');

		public static UnicodeRange GeneralPunctuation => _u2000 ?? CreateRange(ref _u2000, '\u2000', '\u206f');

		public static UnicodeRange SuperscriptsandSubscripts => _u2070 ?? CreateRange(ref _u2070, '⁰', '\u209f');

		public static UnicodeRange CurrencySymbols => _u20A0 ?? CreateRange(ref _u20A0, '₠', '\u20cf');

		public static UnicodeRange CombiningDiacriticalMarksforSymbols => _u20D0 ?? CreateRange(ref _u20D0, '\u20d0', '\u20ff');

		public static UnicodeRange LetterlikeSymbols => _u2100 ?? CreateRange(ref _u2100, '℀', '⅏');

		public static UnicodeRange NumberForms => _u2150 ?? CreateRange(ref _u2150, '⅐', '\u218f');

		public static UnicodeRange Arrows => _u2190 ?? CreateRange(ref _u2190, '←', '⇿');

		public static UnicodeRange MathematicalOperators => _u2200 ?? CreateRange(ref _u2200, '∀', '⋿');

		public static UnicodeRange MiscellaneousTechnical => _u2300 ?? CreateRange(ref _u2300, '⌀', '⏿');

		public static UnicodeRange ControlPictures => _u2400 ?? CreateRange(ref _u2400, '␀', '\u243f');

		public static UnicodeRange OpticalCharacterRecognition => _u2440 ?? CreateRange(ref _u2440, '⑀', '\u245f');

		public static UnicodeRange EnclosedAlphanumerics => _u2460 ?? CreateRange(ref _u2460, '①', '⓿');

		public static UnicodeRange BoxDrawing => _u2500 ?? CreateRange(ref _u2500, '─', '╿');

		public static UnicodeRange BlockElements => _u2580 ?? CreateRange(ref _u2580, '▀', '▟');

		public static UnicodeRange GeometricShapes => _u25A0 ?? CreateRange(ref _u25A0, '■', '◿');

		public static UnicodeRange MiscellaneousSymbols => _u2600 ?? CreateRange(ref _u2600, '☀', '⛿');

		public static UnicodeRange Dingbats => _u2700 ?? CreateRange(ref _u2700, '✀', '➿');

		public static UnicodeRange MiscellaneousMathematicalSymbolsA => _u27C0 ?? CreateRange(ref _u27C0, '⟀', '⟯');

		public static UnicodeRange SupplementalArrowsA => _u27F0 ?? CreateRange(ref _u27F0, '⟰', '⟿');

		public static UnicodeRange BraillePatterns => _u2800 ?? CreateRange(ref _u2800, '⠀', '⣿');

		public static UnicodeRange SupplementalArrowsB => _u2900 ?? CreateRange(ref _u2900, '⤀', '⥿');

		public static UnicodeRange MiscellaneousMathematicalSymbolsB => _u2980 ?? CreateRange(ref _u2980, '⦀', '⧿');

		public static UnicodeRange SupplementalMathematicalOperators => _u2A00 ?? CreateRange(ref _u2A00, '⨀', '⫿');

		public static UnicodeRange MiscellaneousSymbolsandArrows => _u2B00 ?? CreateRange(ref _u2B00, '⬀', '⯿');

		public static UnicodeRange Glagolitic => _u2C00 ?? CreateRange(ref _u2C00, 'Ⰰ', '\u2c5f');

		public static UnicodeRange LatinExtendedC => _u2C60 ?? CreateRange(ref _u2C60, 'Ⱡ', 'Ɀ');

		public static UnicodeRange Coptic => _u2C80 ?? CreateRange(ref _u2C80, 'Ⲁ', '⳿');

		public static UnicodeRange GeorgianSupplement => _u2D00 ?? CreateRange(ref _u2D00, 'ⴀ', '\u2d2f');

		public static UnicodeRange Tifinagh => _u2D30 ?? CreateRange(ref _u2D30, 'ⴰ', '\u2d7f');

		public static UnicodeRange EthiopicExtended => _u2D80 ?? CreateRange(ref _u2D80, 'ⶀ', '\u2ddf');

		public static UnicodeRange CyrillicExtendedA => _u2DE0 ?? CreateRange(ref _u2DE0, '\u2de0', '\u2dff');

		public static UnicodeRange SupplementalPunctuation => _u2E00 ?? CreateRange(ref _u2E00, '⸀', '\u2e7f');

		public static UnicodeRange CjkRadicalsSupplement => _u2E80 ?? CreateRange(ref _u2E80, '⺀', '\u2eff');

		public static UnicodeRange KangxiRadicals => _u2F00 ?? CreateRange(ref _u2F00, '⼀', '\u2fdf');

		public static UnicodeRange IdeographicDescriptionCharacters => _u2FF0 ?? CreateRange(ref _u2FF0, '⿰', '\u2fff');

		public static UnicodeRange CjkSymbolsandPunctuation => _u3000 ?? CreateRange(ref _u3000, '\u3000', '〿');

		public static UnicodeRange Hiragana => _u3040 ?? CreateRange(ref _u3040, '\u3040', 'ゟ');

		public static UnicodeRange Katakana => _u30A0 ?? CreateRange(ref _u30A0, '゠', 'ヿ');

		public static UnicodeRange Bopomofo => _u3100 ?? CreateRange(ref _u3100, '\u3100', 'ㄯ');

		public static UnicodeRange HangulCompatibilityJamo => _u3130 ?? CreateRange(ref _u3130, '\u3130', '\u318f');

		public static UnicodeRange Kanbun => _u3190 ?? CreateRange(ref _u3190, '㆐', '㆟');

		public static UnicodeRange BopomofoExtended => _u31A0 ?? CreateRange(ref _u31A0, 'ㆠ', 'ㆿ');

		public static UnicodeRange CjkStrokes => _u31C0 ?? CreateRange(ref _u31C0, '㇀', '\u31ef');

		public static UnicodeRange KatakanaPhoneticExtensions => _u31F0 ?? CreateRange(ref _u31F0, 'ㇰ', 'ㇿ');

		public static UnicodeRange EnclosedCjkLettersandMonths => _u3200 ?? CreateRange(ref _u3200, '㈀', '㋿');

		public static UnicodeRange CjkCompatibility => _u3300 ?? CreateRange(ref _u3300, '㌀', '㏿');

		public static UnicodeRange CjkUnifiedIdeographsExtensionA => _u3400 ?? CreateRange(ref _u3400, '㐀', '䶿');

		public static UnicodeRange YijingHexagramSymbols => _u4DC0 ?? CreateRange(ref _u4DC0, '䷀', '䷿');

		public static UnicodeRange CjkUnifiedIdeographs => _u4E00 ?? CreateRange(ref _u4E00, '一', '\u9fff');

		public static UnicodeRange YiSyllables => _uA000 ?? CreateRange(ref _uA000, 'ꀀ', '\ua48f');

		public static UnicodeRange YiRadicals => _uA490 ?? CreateRange(ref _uA490, '꒐', '\ua4cf');

		public static UnicodeRange Lisu => _uA4D0 ?? CreateRange(ref _uA4D0, 'ꓐ', '꓿');

		public static UnicodeRange Vai => _uA500 ?? CreateRange(ref _uA500, 'ꔀ', '\ua63f');

		public static UnicodeRange CyrillicExtendedB => _uA640 ?? CreateRange(ref _uA640, 'Ꙁ', '\ua69f');

		public static UnicodeRange Bamum => _uA6A0 ?? CreateRange(ref _uA6A0, 'ꚠ', '\ua6ff');

		public static UnicodeRange ModifierToneLetters => _uA700 ?? CreateRange(ref _uA700, '\ua700', 'ꜟ');

		public static UnicodeRange LatinExtendedD => _uA720 ?? CreateRange(ref _uA720, '\ua720', 'ꟿ');

		public static UnicodeRange SylotiNagri => _uA800 ?? CreateRange(ref _uA800, 'ꠀ', '\ua82f');

		public static UnicodeRange CommonIndicNumberForms => _uA830 ?? CreateRange(ref _uA830, '꠰', '\ua83f');

		public static UnicodeRange Phagspa => _uA840 ?? CreateRange(ref _uA840, 'ꡀ', '\ua87f');

		public static UnicodeRange Saurashtra => _uA880 ?? CreateRange(ref _uA880, '\ua880', '\ua8df');

		public static UnicodeRange DevanagariExtended => _uA8E0 ?? CreateRange(ref _uA8E0, '\ua8e0', '\ua8ff');

		public static UnicodeRange KayahLi => _uA900 ?? CreateRange(ref _uA900, '꤀', '꤯');

		public static UnicodeRange Rejang => _uA930 ?? CreateRange(ref _uA930, 'ꤰ', '꥟');

		public static UnicodeRange HangulJamoExtendedA => _uA960 ?? CreateRange(ref _uA960, 'ꥠ', '\ua97f');

		public static UnicodeRange Javanese => _uA980 ?? CreateRange(ref _uA980, '\ua980', '꧟');

		public static UnicodeRange MyanmarExtendedB => _uA9E0 ?? CreateRange(ref _uA9E0, 'ꧠ', '\ua9ff');

		public static UnicodeRange Cham => _uAA00 ?? CreateRange(ref _uAA00, 'ꨀ', '꩟');

		public static UnicodeRange MyanmarExtendedA => _uAA60 ?? CreateRange(ref _uAA60, 'ꩠ', 'ꩿ');

		public static UnicodeRange TaiViet => _uAA80 ?? CreateRange(ref _uAA80, 'ꪀ', '꫟');

		public static UnicodeRange MeeteiMayekExtensions => _uAAE0 ?? CreateRange(ref _uAAE0, 'ꫠ', '\uaaff');

		public static UnicodeRange EthiopicExtendedA => _uAB00 ?? CreateRange(ref _uAB00, '\uab00', '\uab2f');

		public static UnicodeRange LatinExtendedE => _uAB30 ?? CreateRange(ref _uAB30, 'ꬰ', '\uab6f');

		public static UnicodeRange CherokeeSupplement => _uAB70 ?? CreateRange(ref _uAB70, 'ꭰ', 'ꮿ');

		public static UnicodeRange MeeteiMayek => _uABC0 ?? CreateRange(ref _uABC0, 'ꯀ', '\uabff');

		public static UnicodeRange HangulSyllables => _uAC00 ?? CreateRange(ref _uAC00, '가', '\ud7af');

		public static UnicodeRange HangulJamoExtendedB => _uD7B0 ?? CreateRange(ref _uD7B0, 'ힰ', '\ud7ff');

		public static UnicodeRange CjkCompatibilityIdeographs => _uF900 ?? CreateRange(ref _uF900, '豈', '\ufaff');

		public static UnicodeRange AlphabeticPresentationForms => _uFB00 ?? CreateRange(ref _uFB00, 'ff', 'ﭏ');

		public static UnicodeRange ArabicPresentationFormsA => _uFB50 ?? CreateRange(ref _uFB50, 'ﭐ', '\ufdff');

		public static UnicodeRange VariationSelectors => _uFE00 ?? CreateRange(ref _uFE00, '\ufe00', '\ufe0f');

		public static UnicodeRange VerticalForms => _uFE10 ?? CreateRange(ref _uFE10, '︐', '\ufe1f');

		public static UnicodeRange CombiningHalfMarks => _uFE20 ?? CreateRange(ref _uFE20, '\ufe20', '\ufe2f');

		public static UnicodeRange CjkCompatibilityForms => _uFE30 ?? CreateRange(ref _uFE30, '︰', '\ufe4f');

		public static UnicodeRange SmallFormVariants => _uFE50 ?? CreateRange(ref _uFE50, '﹐', '\ufe6f');

		public static UnicodeRange ArabicPresentationFormsB => _uFE70 ?? CreateRange(ref _uFE70, 'ﹰ', '\ufeff');

		public static UnicodeRange HalfwidthandFullwidthForms => _uFF00 ?? CreateRange(ref _uFF00, '\uff00', '\uffef');

		public static UnicodeRange Specials => _uFFF0 ?? CreateRange(ref _uFFF0, '\ufff0', '\uffff');

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static UnicodeRange CreateEmptyRange([NotNull] ref UnicodeRange range)
		{
			Volatile.Write(ref range, new UnicodeRange(0, 0));
			return range;
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static UnicodeRange CreateRange([NotNull] ref UnicodeRange range, char first, char last)
		{
			Volatile.Write(ref range, UnicodeRange.Create(first, last));
			return range;
		}
	}
}
namespace System.Text.Encodings.Web
{
	internal struct AsciiByteMap
	{
		private unsafe fixed byte Buffer[128];

		internal unsafe void InsertAsciiChar(char key, byte value)
		{
			if (key < '\u0080')
			{
				Buffer[(uint)key] = value;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal unsafe readonly bool TryLookup(Rune key, out byte value)
		{
			if (key.IsAscii)
			{
				byte b = Buffer[(uint)key.Value];
				if (b != 0)
				{
					value = b;
					return true;
				}
			}
			value = 0;
			return false;
		}
	}
	internal struct AllowedBmpCodePointsBitmap
	{
		private unsafe fixed uint Bitmap[2048];

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe void AllowChar(char value)
		{
			_GetIndexAndOffset(value, out UIntPtr index, out int offset);
			ref uint reference = ref Bitmap[(ulong)index];
			reference |= (uint)(1 << offset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe void ForbidChar(char value)
		{
			_GetIndexAndOffset(value, out UIntPtr index, out int offset);
			ref uint reference = ref Bitmap[(ulong)index];
			reference &= (uint)(~(1 << offset));
		}

		public void ForbidHtmlCharacters()
		{
			ForbidChar('<');
			ForbidChar('>');
			ForbidChar('&');
			ForbidChar('\'');
			ForbidChar('"');
			ForbidChar('+');
		}

		public unsafe void ForbidUndefinedCharacters()
		{
			fixed (uint* pointer = Bitmap)
			{
				ReadOnlySpan<byte> values = UnicodeHelpers.GetDefinedBmpCodePointsBitmapLittleEndian();
				Span<uint> span = new Span<uint>(pointer, 2048);
				if (Vector.IsHardwareAccelerated && BitConverter.IsLittleEndian)
				{
					while (!values.IsEmpty)
					{
						(new Vector<uint>(values) & new Vector<uint>(span)).CopyTo(span);
						values = values.Slice(Vector<byte>.Count);
						span = span.Slice(Vector<uint>.Count);
					}
					return;
				}
				for (int i = 0; i < span.Length; i++)
				{
					span[i] &= BinaryPrimitives.ReadUInt32LittleEndian(values.Slice(i * 4));
				}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe readonly bool IsCharAllowed(char value)
		{
			_GetIndexAndOffset(value, out UIntPtr index, out int offset);
			if ((Bitmap[(ulong)index] & (uint)(1 << offset)) != 0)
			{
				return true;
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe readonly bool IsCodePointAllowed(uint value)
		{
			if (!System.Text.UnicodeUtility.IsBmpCodePoint(value))
			{
				return false;
			}
			_GetIndexAndOffset(value, out UIntPtr index, out int offset);
			if ((Bitmap[(ulong)index] & (uint)(1 << offset)) != 0)
			{
				return true;
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static void _GetIndexAndOffset(uint value, out nuint index, out int offset)
		{
			index = value >> 5;
			offset = (int)(value & 0x1F);
		}
	}
	internal sealed class OptimizedInboxTextEncoder
	{
		[StructLayout(LayoutKind.Explicit)]
		private struct AllowedAsciiCodePoints
		{
			[FieldOffset(0)]
			private unsafe fixed byte AsBytes[16];

			[FieldOffset(0)]
			internal Vector128<byte> AsVector;

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			internal unsafe readonly bool IsAllowedAsciiCodePoint(uint codePoint)
			{
				if (codePoint > 127)
				{
					return false;
				}
				uint num = AsBytes[codePoint & 0xF];
				if ((num & (uint)(1 << (int)(codePoint >> 4))) == 0)
				{
					return false;
				}
				return true;
			}

			internal unsafe void PopulateAllowedCodePoints(in AllowedBmpCodePointsBitmap allowedBmpCodePoints)
			{
				this = default(AllowedAsciiCodePoints);
				for (int i = 32; i < 127; i++)
				{
					if (allowedBmpCodePoints.IsCharAllowed((char)i))
					{
						ref byte reference = ref AsBytes[i & 0xF];
						reference |= (byte)(1 << (i >> 4));
					}
				}
			}
		}

		private struct AsciiPreescapedData
		{
			private unsafe fixed ulong Data[128];

			internal unsafe void PopulatePreescapedData(in AllowedBmpCodePointsBitmap allowedCodePointsBmp, ScalarEscaperBase innerEncoder)
			{
				this = default(AsciiPreescapedData);
				byte* intPtr = stackalloc byte[16];
				// IL initblk instruction
				Unsafe.InitBlock(intPtr, 0, 16);
				Span<char> span = new Span<char>(intPtr, 8);
				Span<char> span2 = span;
				for (int i = 0; i < 128; i++)
				{
					Rune value = new Rune(i);
					ulong num;
					int num2;
					if (!Rune.IsControl(value) && allowedCodePointsBmp.IsCharAllowed((char)i))
					{
						num = (uint)i;
						num2 = 1;
					}
					else
					{
						num2 = innerEncoder.EncodeUtf16(value, span2.Slice(0, 6));
						num = 0uL;
						span2.Slice(num2).Clear();
						for (int num3 = num2 - 1; num3 >= 0; num3--)
						{
							uint num4 = span2[num3];
							num = (num << 8) | num4;
						}
					}
					Data[i] = num | ((ulong)(uint)num2 << 56);
				}
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			internal unsafe readonly bool TryGetPreescapedData(uint codePoint, out ulong preescapedData)
			{
				if (codePoint <= 127)
				{
					preescapedData = Data[codePoint];
					return true;
				}
				preescapedData = 0uL;
				return false;
			}
		}

		private readonly AllowedAsciiCodePoints _allowedAsciiCodePoints;

		private readonly AsciiPreescapedData _asciiPreescapedData;

		private readonly AllowedBmpCodePointsBitmap _allowedBmpCodePoints;

		private readonly ScalarEscaperBase _scalarEscaper;

		internal OptimizedInboxTextEncoder(ScalarEscaperBase scalarEscaper, in AllowedBmpCodePointsBitmap allowedCodePointsBmp, bool forbidHtmlSensitiveCharacters = true, ReadOnlySpan<char> extraCharactersToEscape = default(ReadOnlySpan<char>))
		{
			_scalarEscaper = scalarEscaper;
			_allowedBmpCodePoints = allowedCodePointsBmp;
			_allowedBmpCodePoints.ForbidUndefinedCharacters();
			if (forbidHtmlSensitiveCharacters)
			{
				_allowedBmpCodePoints.ForbidHtmlCharacters();
			}
			ReadOnlySpan<char> readOnlySpan = extraCharactersToEscape;
			for (int i = 0; i < readOnlySpan.Length; i++)
			{
				char value = readOnlySpan[i];
				_allowedBmpCodePoints.ForbidChar(value);
			}
			_asciiPreescapedData.PopulatePreescapedData(in _allowedBmpCodePoints, scalarEscaper);
			_allowedAsciiCodePoints.PopulateAllowedCodePoints(in _allowedBmpCodePoints);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[Obsolete("FindFirstCharacterToEncode has been deprecated. It should only be used by the TextEncoder adapter.")]
		public unsafe int FindFirstCharacterToEncode(char* text, int textLength)
		{
			return GetIndexOfFirstCharToEncode(new ReadOnlySpan<char>(text, textLength));
		}

		[Obsolete("TryEncodeUnicodeScalar has been deprecated. It should only be used by the TextEncoder adapter.")]
		public unsafe bool TryEncodeUnicodeScalar(int unicodeScalar, char* buffer, int bufferLength, out int numberOfCharactersWritten)
		{
			Span<char> destination = new Span<char>(buffer, bufferLength);
			if (_allowedBmpCodePoints.IsCodePointAllowed((uint)unicodeScalar))
			{
				if (!destination.IsEmpty)
				{
					destination[0] = (char)unicodeScalar;
					numberOfCharactersWritten = 1;
					return true;
				}
			}
			else
			{
				int num = _scalarEscaper.EncodeUtf16(new Rune(unicodeScalar), destination);
				if (num >= 0)
				{
					numberOfCharactersWritten = num;
					return true;
				}
			}
			numberOfCharactersWritten = 0;
			return false;
		}

		public OperationStatus Encode(ReadOnlySpan<char> source, Span<char> destination, out int charsConsumed, out int charsWritten, bool isFinalBlock)
		{
			_AssertThisNotNull();
			int num = 0;
			int num2 = 0;
			OperationStatus result2;
			while (true)
			{
				int num3;
				Rune result;
				if (SpanUtility.IsValidIndex(source, num))
				{
					char c = source[num];
					if (_asciiPreescapedData.TryGetPreescapedData(c, out var preescapedData))
					{
						if (SpanUtility.IsValidIndex(destination, num2))
						{
							destination[num2] = (char)(byte)preescapedData;
							if (((int)preescapedData & 0xFF00) == 0)
							{
								num2++;
								num++;
								continue;
							}
							preescapedData >>= 8;
							num3 = num2 + 1;
							while (SpanUtility.IsValidIndex(destination, num3))
							{
								destination[num3++] = (char)(byte)preescapedData;
								if ((byte)(preescapedData >>= 8) != 0)
								{
									continue;
								}
								goto IL_0091;
							}
						}
						goto IL_0148;
					}
					if (Rune.TryCreate(c, out result))
					{
						goto IL_00e1;
					}
					int index = num + 1;
					if (SpanUtility.IsValidIndex(source, index))
					{
						if (Rune.TryCreate(c, source[index], out result))
						{
							goto IL_00e1;
						}
					}
					else if (!isFinalBlock && char.IsHighSurrogate(c))
					{
						result2 = OperationStatus.NeedMoreData;
						break;
					}
					result = Rune.ReplacementChar;
					goto IL_010d;
				}
				result2 = OperationStatus.Done;
				break;
				IL_0148:
				result2 = OperationStatus.DestinationTooSmall;
				break;
				IL_0091:
				num2 = num3;
				num++;
				continue;
				IL_010d:
				int num4 = _scalarEscaper.EncodeUtf16(result, destination.Slice(num2));
				if (num4 >= 0)
				{
					num2 += num4;
					num += result.Utf16SequenceLength;
					continue;
				}
				goto IL_0148;
				IL_00e1:
				if (!IsScalarValueAllowed(result))
				{
					goto IL_010d;
				}
				if (result.TryEncodeToUtf16(destination.Slice(num2), out var charsWritten2))
				{
					num2 += charsWritten2;
					num += charsWritten2;
					continue;
				}
				goto IL_0148;
			}
			charsConsumed = num;
			charsWritten = num2;
			return result2;
		}

		public OperationStatus EncodeUtf8(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock)
		{
			_AssertThisNotNull();
			int num = 0;
			int num2 = 0;
			OperationStatus result2;
			while (true)
			{
				int num3;
				if (SpanUtility.IsValidIndex(source, num))
				{
					uint codePoint = source[num];
					if (_asciiPreescapedData.TryGetPreescapedData(codePoint, out var preescapedData))
					{
						if (SpanUtility.TryWriteUInt64LittleEndian(destination, num2, preescapedData))
						{
							num2 += (int)(preescapedData >> 56);
							num++;
							continue;
						}
						num3 = num2;
						while (SpanUtility.IsValidIndex(destination, num3))
						{
							destination[num3++] = (byte)preescapedData;
							if ((byte)(preescapedData >>= 8) != 0)
							{
								continue;
							}
							goto IL_0076;
						}
					}
					else
					{
						Rune result;
						int bytesConsumed2;
						OperationStatus operationStatus = Rune.DecodeFromUtf8(source.Slice(num), out result, out bytesConsumed2);
						if (operationStatus != 0)
						{
							if (!isFinalBlock && operationStatus == OperationStatus.NeedMoreData)
							{
								result2 = OperationStatus.NeedMoreData;
								break;
							}
						}
						else if (IsScalarValueAllowed(result))
						{
							if (result.TryEncodeToUtf8(destination.Slice(num2), out var bytesWritten2))
							{
								num2 += bytesWritten2;
								num += bytesWritten2;
								continue;
							}
							goto IL_0103;
						}
						int num4 = _scalarEscaper.EncodeUtf8(result, destination.Slice(num2));
						if (num4 >= 0)
						{
							num2 += num4;
							num += bytesConsumed2;
							continue;
						}
					}
					goto IL_0103;
				}
				result2 = OperationStatus.Done;
				break;
				IL_0076:
				num2 = num3;
				num++;
				continue;
				IL_0103:
				result2 = OperationStatus.DestinationTooSmall;
				break;
			}
			bytesConsumed = num;
			bytesWritten = num2;
			return result2;
		}

		public unsafe int GetIndexOfFirstByteToEncode(ReadOnlySpan<byte> data)
		{
			int length = data.Length;
			if (Ssse3.IsSupported || (AdvSimd.Arm64.IsSupported && BitConverter.IsLittleEndian))
			{
				int num;
				fixed (byte* pData = data)
				{
					UIntPtr uIntPtr = ((!AdvSimd.Arm64.IsSupported || !BitConverter.IsLittleEndian) ? GetIndexOfFirstByteToEncodeSsse3(pData, (uint)length) : GetIndexOfFirstByteToEncodeAdvSimd64(pData, (uint)length));
					num = (int)(nuint)uIntPtr;
				}
				if (!SpanUtility.IsValidIndex(data, num))
				{
					return -1;
				}
				if (System.Text.UnicodeUtility.IsAsciiCodePoint(data[num]))
				{
					return num;
				}
				data = data.Slice(num);
			}
			Rune result;
			int bytesConsumed;
			while (!data.IsEmpty && Rune.DecodeFromUtf8(data, out result, out bytesConsumed) == OperationStatus.Done && bytesConsumed < 4 && _allowedBmpCodePoints.IsCharAllowed((char)result.Value))
			{
				data = data.Slice(bytesConsumed);
			}
			if (!data.IsEmpty)
			{
				return length - data.Length;
			}
			return -1;
		}

		public unsafe int GetIndexOfFirstCharToEncode(ReadOnlySpan<char> data)
		{
			fixed (char* ptr = data)
			{
				nuint num = (uint)data.Length;
				nuint num2 = 0u;
				if (Ssse3.IsSupported)
				{
					num2 = GetIndexOfFirstCharToEncodeSsse3(ptr, num);
				}
				else if (AdvSimd.Arm64.IsSupported && BitConverter.IsLittleEndian)
				{
					num2 = GetIndexOfFirstCharToEncodeAdvSimd64(ptr, num);
				}
				if (num2 < num)
				{
					_AssertThisNotNull();
					nint num3 = 0;
					while (true)
					{
						if (num - num2 >= 8)
						{
							num3 = -1;
							if (_allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]))
							{
								num2 += 8;
								continue;
							}
							num2 += (nuint)num3;
							break;
						}
						for (; num2 < num && _allowedBmpCodePoints.IsCharAllowed(ptr[num2]); num2++)
						{
						}
						break;
					}
				}
				int num4 = (int)num2;
				if (num4 == (int)num)
				{
					num4 = -1;
				}
				return num4;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool IsScalarValueAllowed(Rune value)
		{
			return _allowedBmpCodePoints.IsCodePointAllowed((uint)value.Value);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void _AssertThisNotNull()
		{
			_ = GetType() == typeof(OptimizedInboxTextEncoder);
		}

		private unsafe nuint GetIndexOfFirstByteToEncodeSsse3(byte* pData, nuint lengthInBytes)
		{
			Vector128<byte> zero = Vector128<byte>.Zero;
			Vector128<byte> right = Vector128.Create((byte)7);
			Vector128<byte> value = Vector128.Create(1, 2, 4, 8, 16, 32, 64, 128, 0, 0, 0, 0, 0, 0, 0, 0);
			Vector128<byte> asVector = _allowedAsciiCodePoints.AsVector;
			nuint num = 0u;
			if (lengthInBytes < 16)
			{
				goto IL_00b2;
			}
			nuint num2 = lengthInBytes & unchecked((nuint)(0xFFFFFFF0));
			int num3;
			while (true)
			{
				Vector128<byte> vector = Sse2.LoadVector128(pData + num);
				Vector128<byte> left = Ssse3.Shuffle(asVector, vector);
				Vector128<byte> right2 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left2 = Sse2.And(left, right2);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left2, zero));
				if (((uint)num3 & 0xFFFFu) != 0)
				{
					break;
				}
				if ((num += 16) < num2)
				{
					continue;
				}
				goto IL_00b2;
			}
			goto IL_01ae;
			IL_00b2:
			if ((lengthInBytes & 8) != 0)
			{
				Vector128<byte> vector2 = Sse2.LoadScalarVector128((ulong*)(pData + num)).AsByte();
				Vector128<byte> left3 = Ssse3.Shuffle(asVector, vector2);
				Vector128<byte> right3 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector2.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left4 = Sse2.And(left3, right3);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left4, zero));
				if ((byte)num3 != 0)
				{
					goto IL_01ae;
				}
				num += 8;
			}
			if ((lengthInBytes & 4) != 0)
			{
				Vector128<byte> vector3 = Sse2.LoadScalarVector128((uint*)(pData + num)).AsByte();
				Vector128<byte> left5 = Ssse3.Shuffle(asVector, vector3);
				Vector128<byte> right4 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector3.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left6 = Sse2.And(left5, right4);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left6, zero));
				if (((uint)num3 & 0xFu) != 0)
				{
					goto IL_01ae;
				}
				num += 4;
			}
			if ((lengthInBytes & 3) != 0)
			{
				while (_allowedAsciiCodePoints.IsAllowedAsciiCodePoint(pData[num]) && ++num != lengthInBytes)
				{
				}
			}
			goto IL_01ab;
			IL_01ae:
			num += (uint)BitOperations.TrailingZeroCount(num3);
			goto IL_01ab;
			IL_01ab:
			return num;
		}

		private unsafe nuint GetIndexOfFirstCharToEncodeSsse3(char* pData, nuint lengthInChars)
		{
			Vector128<byte> zero = Vector128<byte>.Zero;
			Vector128<byte> right = Vector128.Create((byte)7);
			Vector128<byte> value = Vector128.Create(1, 2, 4, 8, 16, 32, 64, 128, 0, 0, 0, 0, 0, 0, 0, 0);
			Vector128<byte> asVector = _allowedAsciiCodePoints.AsVector;
			nuint num = 0u;
			if (lengthInChars < 16)
			{
				goto IL_00d3;
			}
			nuint num2 = lengthInChars & unchecked((nuint)(0xFFFFFFF0));
			int num3;
			while (true)
			{
				Vector128<byte> vector = Sse2.PackUnsignedSaturate(Sse2.LoadVector128((short*)(pData + num)), Sse2.LoadVector128((short*)(pData + 8 + num)));
				Vector128<byte> left = Ssse3.Shuffle(asVector, vector);
				Vector128<byte> right2 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left2 = Sse2.And(left, right2);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left2, zero));
				if (((uint)num3 & 0xFFFFu) != 0)
				{
					break;
				}
				if ((num += 16) < num2)
				{
					continue;
				}
				goto IL_00d3;
			}
			goto IL_01e9;
			IL_00d3:
			if ((lengthInChars & 8) != 0)
			{
				Vector128<byte> vector2 = Sse2.PackUnsignedSaturate(Sse2.LoadVector128((short*)(pData + num)), zero.AsInt16());
				Vector128<byte> left3 = Ssse3.Shuffle(asVector, vector2);
				Vector128<byte> right3 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector2.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left4 = Sse2.And(left3, right3);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left4, zero));
				if ((byte)num3 != 0)
				{
					goto IL_01e9;
				}
				num += 8;
			}
			if ((lengthInChars & 4) != 0)
			{
				Vector128<byte> vector3 = Sse2.PackUnsignedSaturate(Sse2.LoadScalarVector128((ulong*)(pData + num)).AsInt16(), zero.AsInt16());
				Vector128<byte> left5 = Ssse3.Shuffle(asVector, vector3);
				Vector128<byte> right4 = Ssse3.Shuffle(value, Sse2.And(Sse2.ShiftRightLogical(vector3.AsUInt32(), 4).AsByte(), right));
				Vector128<byte> left6 = Sse2.And(left5, right4);
				num3 = Sse2.MoveMask(Sse2.CompareEqual(left6, zero));
				if (((uint)num3 & 0xFu) != 0)
				{
					goto IL_01e9;
				}
				num += 4;
			}
			if ((lengthInChars & 3) != 0)
			{
				while (_allowedAsciiCodePoints.IsAllowedAsciiCodePoint(pData[num]) && ++num != lengthInChars)
				{
				}
			}
			goto IL_01e6;
			IL_01e9:
			num += (uint)BitOperations.TrailingZeroCount(num3);
			goto IL_01e6;
			IL_01e6:
			return num;
		}

		private unsafe nuint GetIndexOfFirstByteToEncodeAdvSimd64(byte* pData, nuint lengthInBytes)
		{
			Vector128<byte> right = Vector128.Create((byte)15);
			Vector128<byte> table = Vector128.Create(1, 2, 4, 8, 16, 32, 64, 128, 0, 0, 0, 0, 0, 0, 0, 0);
			Vector128<byte> right2 = Vector128.Create((ushort)61455).AsByte();
			Vector128<byte> asVector = _allowedAsciiCodePoints.AsVector;
			nuint num = 0u;
			if (lengthInBytes < 16)
			{
				goto IL_00c9;
			}
			nuint num2 = lengthInBytes & unchecked((nuint)(0xFFFFFFF0));
			ulong num3;
			while (true)
			{
				Vector128<byte> vector = AdvSimd.LoadVector128(pData + num);
				Vector128<byte> left = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector, right));
				Vector128<byte> right3 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector.AsSByte(), 4).AsByte());
				Vector128<byte> left2 = AdvSimd.CompareTest(left, right3);
				Vector128<byte> vector2 = AdvSimd.And(left2, right2);
				num3 = AdvSimd.Arm64.AddPairwise(vector2, vector2).AsUInt64().ToScalar();
				if (num3 != ulong.MaxValue)
				{
					break;
				}
				if ((num += 16) < num2)
				{
					continue;
				}
				goto IL_00c9;
			}
			num += (uint)(BitOperations.TrailingZeroCount(~num3) >>> 2);
			goto IL_01c6;
			IL_01db:
			num += (uint)(BitOperations.TrailingZeroCount(~num3) >>> 3);
			goto IL_01c6;
			IL_00c9:
			if ((lengthInBytes & 8) != 0)
			{
				Vector128<byte> vector3 = AdvSimd.LoadVector64(pData + num).ToVector128Unsafe();
				Vector128<byte> left3 = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector3, right));
				Vector128<byte> right4 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector3.AsSByte(), 4).AsByte());
				Vector128<byte> vector4 = AdvSimd.CompareTest(left3, right4);
				num3 = vector4.AsUInt64().ToScalar();
				if (num3 != ulong.MaxValue)
				{
					goto IL_01db;
				}
				num += 8;
			}
			if ((lengthInBytes & 4) != 0)
			{
				Vector128<byte> vector5 = Vector128.CreateScalarUnsafe(Unsafe.ReadUnaligned<uint>(pData + num)).AsByte();
				Vector128<byte> left4 = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector5, right));
				Vector128<byte> right5 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector5.AsSByte(), 4).AsByte());
				Vector128<byte> vector6 = AdvSimd.CompareTest(left4, right5);
				num3 = vector6.AsUInt32().ToScalar();
				if (num3 != uint.MaxValue)
				{
					goto IL_01db;
				}
				num += 4;
			}
			if ((lengthInBytes & 3) != 0)
			{
				while (_allowedAsciiCodePoints.IsAllowedAsciiCodePoint(pData[num]) && ++num != lengthInBytes)
				{
				}
			}
			goto IL_01c6;
			IL_01c6:
			return num;
		}

		private unsafe nuint GetIndexOfFirstCharToEncodeAdvSimd64(char* pData, nuint lengthInChars)
		{
			Vector128<byte> right = Vector128.Create((byte)15);
			Vector128<byte> table = Vector128.Create(1, 2, 4, 8, 16, 32, 64, 128, 0, 0, 0, 0, 0, 0, 0, 0);
			Vector128<byte> right2 = Vector128.Create((ushort)61455).AsByte();
			Vector128<byte> asVector = _allowedAsciiCodePoints.AsVector;
			nuint num = 0u;
			if (lengthInChars < 16)
			{
				goto IL_00ef;
			}
			nuint num2 = lengthInChars & unchecked((nuint)(0xFFFFFFF0));
			ulong num3;
			while (true)
			{
				Vector128<byte> vector = AdvSimd.ExtractNarrowingSaturateUnsignedUpper(AdvSimd.ExtractNarrowingSaturateUnsignedLower(AdvSimd.LoadVector128((short*)(pData + num))), AdvSimd.LoadVector128((short*)(pData + 8 + num)));
				Vector128<byte> left = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector, right));
				Vector128<byte> right3 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector.AsSByte(), 4).AsByte());
				Vector128<byte> left2 = AdvSimd.CompareTest(left, right3);
				Vector128<byte> vector2 = AdvSimd.And(left2, right2);
				num3 = AdvSimd.Arm64.AddPairwise(vector2, vector2).AsUInt64().ToScalar();
				if (num3 != ulong.MaxValue)
				{
					break;
				}
				if ((num += 16) < num2)
				{
					continue;
				}
				goto IL_00ef;
			}
			num += (uint)(BitOperations.TrailingZeroCount(~num3) >>> 2);
			goto IL_0204;
			IL_0219:
			num += (uint)(BitOperations.TrailingZeroCount(~num3) >>> 3);
			goto IL_0204;
			IL_00ef:
			if ((lengthInChars & 8) != 0)
			{
				Vector128<byte> vector3 = AdvSimd.ExtractNarrowingSaturateUnsignedLower(AdvSimd.LoadVector128((short*)(pData + num))).AsByte().ToVector128Unsafe();
				Vector128<byte> left3 = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector3, right));
				Vector128<byte> right4 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector3.AsSByte(), 4).AsByte());
				Vector128<byte> vector4 = AdvSimd.CompareTest(left3, right4);
				num3 = vector4.AsUInt64().ToScalar();
				if (num3 != ulong.MaxValue)
				{
					goto IL_0219;
				}
				num += 8;
			}
			if ((lengthInChars & 4) != 0)
			{
				Vector128<byte> vector5 = AdvSimd.ExtractNarrowingSaturateUnsignedLower(AdvSimd.LoadVector64((short*)(pData + num)).ToVector128Unsafe()).ToVector128Unsafe();
				Vector128<byte> left4 = AdvSimd.Arm64.VectorTableLookup(asVector, AdvSimd.And(vector5, right));
				Vector128<byte> right5 = AdvSimd.Arm64.VectorTableLookup(table, AdvSimd.ShiftRightArithmetic(vector5.AsSByte(), 4).AsByte());
				Vector128<byte> vector6 = AdvSimd.CompareTest(left4, right5);
				num3 = vector6.AsUInt32().ToScalar();
				if (num3 != uint.MaxValue)
				{
					goto IL_0219;
				}
				num += 4;
			}
			if ((lengthInChars & 3) != 0)
			{
				while (_allowedAsciiCodePoints.IsAllowedAsciiCodePoint(pData[num]) && ++num != lengthInChars)
				{
				}
			}
			goto IL_0204;
			IL_0204:
			return num;
		}
	}
	internal sealed class DefaultUrlEncoder : UrlEncoder
	{
		private sealed class EscaperImplementation : ScalarEscaperBase
		{
			internal static readonly EscaperImplementation Singleton = new EscaperImplementation();

			private EscaperImplementation()
			{
			}

			internal override int EncodeUtf8(Rune value, Span<byte> destination)
			{
				uint utf8RepresentationForScalarValue = (uint)UnicodeHelpers.GetUtf8RepresentationForScalarValue((uint)value.Value);
				if (SpanUtility.IsValidIndex(destination, 2))
				{
					destination[0] = 37;
					System.HexConverter.ToBytesBuffer((byte)utf8RepresentationForScalarValue, destination, 1);
					if ((utf8RepresentationForScalarValue >>= 8) == 0)
					{
						return 3;
					}
					if (SpanUtility.IsValidIndex(destination, 5))
					{
						destination[3] = 37;
						System.HexConverter.ToBytesBuffer((byte)utf8RepresentationForScalarValue, destination, 4);
						if ((utf8RepresentationForScalarValue >>= 8) == 0)
						{
							return 6;
						}
						if (SpanUtility.IsValidIndex(destination, 8))
						{
							destination[6] = 37;
							System.HexConverter.ToBytesBuffer((byte)utf8RepresentationForScalarValue, destination, 7);
							if ((utf8RepresentationForScalarValue >>= 8) == 0)
							{
								return 9;
							}
							if (SpanUtility.IsValidIndex(destination, 11))
							{
								destination[9] = 37;
								System.HexConverter.ToBytesBuffer((byte)utf8RepresentationForScalarValue, destination, 10);
								return 12;
							}
						}
					}
				}
				return -1;
			}

			internal override int EncodeUtf16(Rune value, Span<char> destination)
			{
				uint utf8RepresentationForScalarValue = (uint)UnicodeHelpers.GetUtf8RepresentationForScalarValue((uint)value.Value);
				if (SpanUtility.IsValidIndex(destination, 2))
				{
					destination[0] = '%';
					System.HexConverter.ToCharsBuffer((byte)utf8RepresentationForScalarValue, destination, 1);
					if ((utf8RepresentationForScalarValue >>= 8) == 0)
					{
						return 3;
					}
					if (SpanUtility.IsValidIndex(destination, 5))
					{
						destination[3] = '%';
						System.HexConverter.ToCharsBuffer((byte)utf8RepresentationForScalarValue, destination, 4);
						if ((utf8RepresentationForScalarValue >>= 8) == 0)
						{
							return 6;
						}
						if (SpanUtility.IsValidIndex(destination, 8))
						{
							destination[6] = '%';
							System.HexConverter.ToCharsBuffer((byte)utf8RepresentationForScalarValue, destination, 7);
							if ((utf8RepresentationForScalarValue >>= 8) == 0)
							{
								return 9;
							}
							if (SpanUtility.IsValidIndex(destination, 11))
							{
								destination[9] = '%';
								System.HexConverter.ToCharsBuffer((byt

System.Text.Json.dll

Decompiled 5 months ago
using System;
using System.Buffers;
using System.Buffers.Text;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Numerics;
using System.Reflection;
using System.Reflection.Emit;
using System.Reflection.Metadata;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Reflection;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Converters;
using System.Text.Json.Serialization.Metadata;
using System.Threading;
using System.Threading.Tasks;
using FxResources.System.Text.Json;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MetadataUpdateHandler(typeof(JsonSerializerOptionsUpdateHandler))]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Text.Json")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides high-performance and low-allocating types that serialize objects to JavaScript Object Notation (JSON) text and deserialize JSON text to objects, with UTF-8 support built-in. Also provides types to read and write JSON text encoded as UTF-8, and to create an in-memory document object model (DOM), that is read-only, for random access of the JSON elements within a structured view of the data.\r\n\r\nThe System.Text.Json library is built-in as part of the shared framework in .NET Runtime. The package can be installed when you need to use it in other target frameworks.")]
[assembly: AssemblyFileVersion("7.0.323.6910")]
[assembly: AssemblyInformationalVersion("7.0.3+0a2bda10e81d901396c3cff95533529e3a93ad47")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Text.Json")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: TypeForwardedTo(typeof(IsExternalInit))]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
[module: SkipLocalsInit]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class ScopedRefAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FxResources.System.Text.Json
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class HexConverter
	{
		public static ReadOnlySpan<byte> CharToHexLookup => new byte[256]
		{
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 0, 1,
			2, 3, 4, 5, 6, 7, 8, 9, 255, 255,
			255, 255, 255, 255, 255, 10, 11, 12, 13, 14,
			15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 10, 11, 12,
			13, 14, 15, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255
		};

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int FromChar(int c)
		{
			if (c < CharToHexLookup.Length)
			{
				return CharToHexLookup[c];
			}
			return 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsHexChar(int c)
		{
			if (IntPtr.Size == 8)
			{
				ulong num = (uint)(c - 48);
				ulong num2 = (ulong)(-17875860044349952L << (int)num);
				ulong num3 = num - 64;
				if ((long)(num2 & num3) >= 0L)
				{
					return false;
				}
				return true;
			}
			return FromChar(c) != 255;
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

		internal static string ArrayDepthTooLarge => GetResourceString("ArrayDepthTooLarge");

		internal static string CannotReadIncompleteUTF16 => GetResourceString("CannotReadIncompleteUTF16");

		internal static string CannotReadInvalidUTF16 => GetResourceString("CannotReadInvalidUTF16");

		internal static string CannotStartObjectArrayAfterPrimitiveOrClose => GetResourceString("CannotStartObjectArrayAfterPrimitiveOrClose");

		internal static string CannotStartObjectArrayWithoutProperty => GetResourceString("CannotStartObjectArrayWithoutProperty");

		internal static string CannotTranscodeInvalidUtf8 => GetResourceString("CannotTranscodeInvalidUtf8");

		internal static string CannotDecodeInvalidBase64 => GetResourceString("CannotDecodeInvalidBase64");

		internal static string CannotTranscodeInvalidUtf16 => GetResourceString("CannotTranscodeInvalidUtf16");

		internal static string CannotEncodeInvalidUTF16 => GetResourceString("CannotEncodeInvalidUTF16");

		internal static string CannotEncodeInvalidUTF8 => GetResourceString("CannotEncodeInvalidUTF8");

		internal static string CannotWritePropertyWithinArray => GetResourceString("CannotWritePropertyWithinArray");

		internal static string CannotWritePropertyAfterProperty => GetResourceString("CannotWritePropertyAfterProperty");

		internal static string CannotWriteValueAfterPrimitiveOrClose => GetResourceString("CannotWriteValueAfterPrimitiveOrClose");

		internal static string CannotWriteValueWithinObject => GetResourceString("CannotWriteValueWithinObject");

		internal static string DepthTooLarge => GetResourceString("DepthTooLarge");

		internal static string DestinationTooShort => GetResourceString("DestinationTooShort");

		internal static string EndOfCommentNotFound => GetResourceString("EndOfCommentNotFound");

		internal static string EndOfStringNotFound => GetResourceString("EndOfStringNotFound");

		internal static string ExpectedEndAfterSingleJson => GetResourceString("ExpectedEndAfterSingleJson");

		internal static string ExpectedEndOfDigitNotFound => GetResourceString("ExpectedEndOfDigitNotFound");

		internal static string ExpectedFalse => GetResourceString("ExpectedFalse");

		internal static string ExpectedJsonTokens => GetResourceString("ExpectedJsonTokens");

		internal static string ExpectedOneCompleteToken => GetResourceString("ExpectedOneCompleteToken");

		internal static string ExpectedNextDigitEValueNotFound => GetResourceString("ExpectedNextDigitEValueNotFound");

		internal static string ExpectedNull => GetResourceString("ExpectedNull");

		internal static string ExpectedSeparatorAfterPropertyNameNotFound => GetResourceString("ExpectedSeparatorAfterPropertyNameNotFound");

		internal static string ExpectedStartOfPropertyNotFound => GetResourceString("ExpectedStartOfPropertyNotFound");

		internal static string ExpectedStartOfPropertyOrValueNotFound => GetResourceString("ExpectedStartOfPropertyOrValueNotFound");

		internal static string ExpectedStartOfValueNotFound => GetResourceString("ExpectedStartOfValueNotFound");

		internal static string ExpectedTrue => GetResourceString("ExpectedTrue");

		internal static string ExpectedValueAfterPropertyNameNotFound => GetResourceString("ExpectedValueAfterPropertyNameNotFound");

		internal static string FailedToGetLargerSpan => GetResourceString("FailedToGetLargerSpan");

		internal static string FoundInvalidCharacter => GetResourceString("FoundInvalidCharacter");

		internal static string InvalidCast => GetResourceString("InvalidCast");

		internal static string InvalidCharacterAfterEscapeWithinString => GetResourceString("InvalidCharacterAfterEscapeWithinString");

		internal static string InvalidCharacterWithinString => GetResourceString("InvalidCharacterWithinString");

		internal static string InvalidEndOfJsonNonPrimitive => GetResourceString("InvalidEndOfJsonNonPrimitive");

		internal static string InvalidHexCharacterWithinString => GetResourceString("InvalidHexCharacterWithinString");

		internal static string JsonDocumentDoesNotSupportComments => GetResourceString("JsonDocumentDoesNotSupportComments");

		internal static string JsonElementHasWrongType => GetResourceString("JsonElementHasWrongType");

		internal static string TypeInfoResolverImmutable => GetResourceString("TypeInfoResolverImmutable");

		internal static string TypeInfoImmutable => GetResourceString("TypeInfoImmutable");

		internal static string PropertyInfoImmutable => GetResourceString("PropertyInfoImmutable");

		internal static string MaxDepthMustBePositive => GetResourceString("MaxDepthMustBePositive");

		internal static string CommentHandlingMustBeValid => GetResourceString("CommentHandlingMustBeValid");

		internal static string MismatchedObjectArray => GetResourceString("MismatchedObjectArray");

		internal static string CannotWriteEndAfterProperty => GetResourceString("CannotWriteEndAfterProperty");

		internal static string ObjectDepthTooLarge => GetResourceString("ObjectDepthTooLarge");

		internal static string PropertyNameTooLarge => GetResourceString("PropertyNameTooLarge");

		internal static string FormatDecimal => GetResourceString("FormatDecimal");

		internal static string FormatDouble => GetResourceString("FormatDouble");

		internal static string FormatInt32 => GetResourceString("FormatInt32");

		internal static string FormatInt64 => GetResourceString("FormatInt64");

		internal static string FormatSingle => GetResourceString("FormatSingle");

		internal static string FormatUInt32 => GetResourceString("FormatUInt32");

		internal static string FormatUInt64 => GetResourceString("FormatUInt64");

		internal static string RequiredDigitNotFoundAfterDecimal => GetResourceString("RequiredDigitNotFoundAfterDecimal");

		internal static string RequiredDigitNotFoundAfterSign => GetResourceString("RequiredDigitNotFoundAfterSign");

		internal static string RequiredDigitNotFoundEndOfData => GetResourceString("RequiredDigitNotFoundEndOfData");

		internal static string SpecialNumberValuesNotSupported => GetResourceString("SpecialNumberValuesNotSupported");

		internal static string ValueTooLarge => GetResourceString("ValueTooLarge");

		internal static string ZeroDepthAtEnd => GetResourceString("ZeroDepthAtEnd");

		internal static string DeserializeUnableToConvertValue => GetResourceString("DeserializeUnableToConvertValue");

		internal static string DeserializeWrongType => GetResourceString("DeserializeWrongType");

		internal static string SerializationInvalidBufferSize => GetResourceString("SerializationInvalidBufferSize");

		internal static string InvalidComparison => GetResourceString("InvalidComparison");

		internal static string UnsupportedFormat => GetResourceString("UnsupportedFormat");

		internal static string ExpectedStartOfPropertyOrValueAfterComment => GetResourceString("ExpectedStartOfPropertyOrValueAfterComment");

		internal static string TrailingCommaNotAllowedBeforeArrayEnd => GetResourceString("TrailingCommaNotAllowedBeforeArrayEnd");

		internal static string TrailingCommaNotAllowedBeforeObjectEnd => GetResourceString("TrailingCommaNotAllowedBeforeObjectEnd");

		internal static string SerializerOptionsImmutable => GetResourceString("SerializerOptionsImmutable");

		internal static string StreamNotWritable => GetResourceString("StreamNotWritable");

		internal static string CannotWriteCommentWithEmbeddedDelimiter => GetResourceString("CannotWriteCommentWithEmbeddedDelimiter");

		internal static string SerializerPropertyNameConflict => GetResourceString("SerializerPropertyNameConflict");

		internal static string SerializerPropertyNameNull => GetResourceString("SerializerPropertyNameNull");

		internal static string SerializationDataExtensionPropertyInvalid => GetResourceString("SerializationDataExtensionPropertyInvalid");

		internal static string SerializationDuplicateTypeAttribute => GetResourceString("SerializationDuplicateTypeAttribute");

		internal static string SerializationNotSupportedType => GetResourceString("SerializationNotSupportedType");

		internal static string TypeRequiresAsyncSerialization => GetResourceString("TypeRequiresAsyncSerialization");

		internal static string InvalidCharacterAtStartOfComment => GetResourceString("InvalidCharacterAtStartOfComment");

		internal static string UnexpectedEndOfDataWhileReadingComment => GetResourceString("UnexpectedEndOfDataWhileReadingComment");

		internal static string CannotSkip => GetResourceString("CannotSkip");

		internal static string NotEnoughData => GetResourceString("NotEnoughData");

		internal static string UnexpectedEndOfLineSeparator => GetResourceString("UnexpectedEndOfLineSeparator");

		internal static string JsonSerializerDoesNotSupportComments => GetResourceString("JsonSerializerDoesNotSupportComments");

		internal static string DeserializeNoConstructor => GetResourceString("DeserializeNoConstructor");

		internal static string DeserializePolymorphicInterface => GetResourceString("DeserializePolymorphicInterface");

		internal static string SerializationConverterOnAttributeNotCompatible => GetResourceString("SerializationConverterOnAttributeNotCompatible");

		internal static string SerializationConverterOnAttributeInvalid => GetResourceString("SerializationConverterOnAttributeInvalid");

		internal static string SerializationConverterRead => GetResourceString("SerializationConverterRead");

		internal static string SerializationConverterNotCompatible => GetResourceString("SerializationConverterNotCompatible");

		internal static string ResolverTypeNotCompatible => GetResourceString("ResolverTypeNotCompatible");

		internal static string ResolverTypeInfoOptionsNotCompatible => GetResourceString("ResolverTypeInfoOptionsNotCompatible");

		internal static string SerializationConverterWrite => GetResourceString("SerializationConverterWrite");

		internal static string NamingPolicyReturnNull => GetResourceString("NamingPolicyReturnNull");

		internal static string SerializationDuplicateAttribute => GetResourceString("SerializationDuplicateAttribute");

		internal static string SerializeUnableToSerialize => GetResourceString("SerializeUnableToSerialize");

		internal static string FormatByte => GetResourceString("FormatByte");

		internal static string FormatInt16 => GetResourceString("FormatInt16");

		internal static string FormatSByte => GetResourceString("FormatSByte");

		internal static string FormatUInt16 => GetResourceString("FormatUInt16");

		internal static string SerializerCycleDetected => GetResourceString("SerializerCycleDetected");

		internal static string InvalidLeadingZeroInNumber => GetResourceString("InvalidLeadingZeroInNumber");

		internal static string MetadataCannotParsePreservedObjectToImmutable => GetResourceString("MetadataCannotParsePreservedObjectToImmutable");

		internal static string MetadataDuplicateIdFound => GetResourceString("MetadataDuplicateIdFound");

		internal static string MetadataIdIsNotFirstProperty => GetResourceString("MetadataIdIsNotFirstProperty");

		internal static string MetadataInvalidReferenceToValueType => GetResourceString("MetadataInvalidReferenceToValueType");

		internal static string MetadataInvalidTokenAfterValues => GetResourceString("MetadataInvalidTokenAfterValues");

		internal static string MetadataPreservedArrayFailed => GetResourceString("MetadataPreservedArrayFailed");

		internal static string MetadataInvalidPropertyInArrayMetadata => GetResourceString("MetadataInvalidPropertyInArrayMetadata");

		internal static string MetadataStandaloneValuesProperty => GetResourceString("MetadataStandaloneValuesProperty");

		internal static string MetadataReferenceCannotContainOtherProperties => GetResourceString("MetadataReferenceCannotContainOtherProperties");

		internal static string MetadataReferenceNotFound => GetResourceString("MetadataReferenceNotFound");

		internal static string MetadataValueWasNotString => GetResourceString("MetadataValueWasNotString");

		internal static string MetadataInvalidPropertyWithLeadingDollarSign => GetResourceString("MetadataInvalidPropertyWithLeadingDollarSign");

		internal static string MetadataUnexpectedProperty => GetResourceString("MetadataUnexpectedProperty");

		internal static string MetadataDuplicateTypeProperty => GetResourceString("MetadataDuplicateTypeProperty");

		internal static string MultipleMembersBindWithConstructorParameter => GetResourceString("MultipleMembersBindWithConstructorParameter");

		internal static string ConstructorParamIncompleteBinding => GetResourceString("ConstructorParamIncompleteBinding");

		internal static string ConstructorMaxOf64Parameters => GetResourceString("ConstructorMaxOf64Parameters");

		internal static string ObjectWithParameterizedCtorRefMetadataNotSupported => GetResourceString("ObjectWithParameterizedCtorRefMetadataNotSupported");

		internal static string SerializerConverterFactoryReturnsNull => GetResourceString("SerializerConverterFactoryReturnsNull");

		internal static string SerializationNotSupportedParentType => GetResourceString("SerializationNotSupportedParentType");

		internal static string ExtensionDataCannotBindToCtorParam => GetResourceString("ExtensionDataCannotBindToCtorParam");

		internal static string BufferMaximumSizeExceeded => GetResourceString("BufferMaximumSizeExceeded");

		internal static string CannotSerializeInvalidType => GetResourceString("CannotSerializeInvalidType");

		internal static string SerializeTypeInstanceNotSupported => GetResourceString("SerializeTypeInstanceNotSupported");

		internal static string JsonIncludeOnNonPublicInvalid => GetResourceString("JsonIncludeOnNonPublicInvalid");

		internal static string CannotSerializeInvalidMember => GetResourceString("CannotSerializeInvalidMember");

		internal static string CannotPopulateCollection => GetResourceString("CannotPopulateCollection");

		internal static string ConstructorContainsNullParameterNames => GetResourceString("ConstructorContainsNullParameterNames");

		internal static string DefaultIgnoreConditionAlreadySpecified => GetResourceString("DefaultIgnoreConditionAlreadySpecified");

		internal static string DefaultIgnoreConditionInvalid => GetResourceString("DefaultIgnoreConditionInvalid");

		internal static string DictionaryKeyTypeNotSupported => GetResourceString("DictionaryKeyTypeNotSupported");

		internal static string IgnoreConditionOnValueTypeInvalid => GetResourceString("IgnoreConditionOnValueTypeInvalid");

		internal static string NumberHandlingOnPropertyInvalid => GetResourceString("NumberHandlingOnPropertyInvalid");

		internal static string ConverterCanConvertMultipleTypes => GetResourceString("ConverterCanConvertMultipleTypes");

		internal static string MetadataReferenceOfTypeCannotBeAssignedToType => GetResourceString("MetadataReferenceOfTypeCannotBeAssignedToType");

		internal static string DeserializeUnableToAssignValue => GetResourceString("DeserializeUnableToAssignValue");

		internal static string DeserializeUnableToAssignNull => GetResourceString("DeserializeUnableToAssignNull");

		internal static string SerializerConverterFactoryReturnsJsonConverterFactory => GetResourceString("SerializerConverterFactoryReturnsJsonConverterFactory");

		internal static string NodeElementWrongType => GetResourceString("NodeElementWrongType");

		internal static string NodeElementCannotBeObjectOrArray => GetResourceString("NodeElementCannotBeObjectOrArray");

		internal static string NodeAlreadyHasParent => GetResourceString("NodeAlreadyHasParent");

		internal static string NodeCycleDetected => GetResourceString("NodeCycleDetected");

		internal static string NodeUnableToConvert => GetResourceString("NodeUnableToConvert");

		internal static string NodeUnableToConvertElement => GetResourceString("NodeUnableToConvertElement");

		internal static string NodeValueNotAllowed => GetResourceString("NodeValueNotAllowed");

		internal static string NodeWrongType => GetResourceString("NodeWrongType");

		internal static string NodeDuplicateKey => GetResourceString("NodeDuplicateKey");

		internal static string SerializerContextOptionsImmutable => GetResourceString("SerializerContextOptionsImmutable");

		internal static string NoMetadataForType => GetResourceString("NoMetadataForType");

		internal static string CollectionIsReadOnly => GetResourceString("CollectionIsReadOnly");

		internal static string ArrayIndexNegative => GetResourceString("ArrayIndexNegative");

		internal static string ArrayTooSmall => GetResourceString("ArrayTooSmall");

		internal static string NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty => GetResourceString("NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty");

		internal static string NoMetadataForTypeProperties => GetResourceString("NoMetadataForTypeProperties");

		internal static string FieldCannotBeVirtual => GetResourceString("FieldCannotBeVirtual");

		internal static string MissingFSharpCoreMember => GetResourceString("MissingFSharpCoreMember");

		internal static string FSharpDiscriminatedUnionsNotSupported => GetResourceString("FSharpDiscriminatedUnionsNotSupported");

		internal static string NoMetadataForTypeCtorParams => GetResourceString("NoMetadataForTypeCtorParams");

		internal static string Polymorphism_DerivedConverterDoesNotSupportMetadata => GetResourceString("Polymorphism_DerivedConverterDoesNotSupportMetadata");

		internal static string Polymorphism_TypeDoesNotSupportPolymorphism => GetResourceString("Polymorphism_TypeDoesNotSupportPolymorphism");

		internal static string Polymorphism_DerivedTypeIsNotSupported => GetResourceString("Polymorphism_DerivedTypeIsNotSupported");

		internal static string Polymorphism_DerivedTypeIsAlreadySpecified => GetResourceString("Polymorphism_DerivedTypeIsAlreadySpecified");

		internal static string Polymorphism_TypeDicriminatorIdIsAlreadySpecified => GetResourceString("Polymorphism_TypeDicriminatorIdIsAlreadySpecified");

		internal static string Polymorphism_InvalidCustomTypeDiscriminatorPropertyName => GetResourceString("Polymorphism_InvalidCustomTypeDiscriminatorPropertyName");

		internal static string Polymorphism_ConfigurationDoesNotSpecifyDerivedTypes => GetResourceString("Polymorphism_ConfigurationDoesNotSpecifyDerivedTypes");

		internal static string Polymorphism_UnrecognizedTypeDiscriminator => GetResourceString("Polymorphism_UnrecognizedTypeDiscriminator");

		internal static string Polymorphism_RuntimeTypeNotSupported => GetResourceString("Polymorphism_RuntimeTypeNotSupported");

		internal static string Polymorphism_RuntimeTypeDiamondAmbiguity => GetResourceString("Polymorphism_RuntimeTypeDiamondAmbiguity");

		internal static string InvalidJsonTypeInfoOperationForKind => GetResourceString("InvalidJsonTypeInfoOperationForKind");

		internal static string CreateObjectConverterNotCompatible => GetResourceString("CreateObjectConverterNotCompatible");

		internal static string CombineOneOfResolversIsNull => GetResourceString("CombineOneOfResolversIsNull");

		internal static string JsonPropertyInfoBoundToDifferentParent => GetResourceString("JsonPropertyInfoBoundToDifferentParent");

		internal static string JsonTypeInfoUsedButTypeInfoResolverNotSet => GetResourceString("JsonTypeInfoUsedButTypeInfoResolverNotSet");

		internal static string JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo => GetResourceString("JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo");

		internal static string JsonPropertyRequiredAndNotDeserializable => GetResourceString("JsonPropertyRequiredAndNotDeserializable");

		internal static string JsonPropertyRequiredAndExtensionData => GetResourceString("JsonPropertyRequiredAndExtensionData");

		internal static string JsonRequiredPropertiesMissing => GetResourceString("JsonRequiredPropertiesMissing");

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

		internal static string GetResourceString(string resourceKey)
		{
			if (UsingResourceKeys())
			{
				return resourceKey;
			}
			string result = null;
			try
			{
				result = ResourceManager.GetString(resourceKey);
			}
			catch (MissingManifestResourceException)
			{
			}
			return result;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		[CompilerGenerated]
		private readonly string <Syntax>k__BackingField;

		[CompilerGenerated]
		private readonly object[] <Arguments>k__BackingField;

		public StringSyntaxAttribute(string syntax)
		{
			<Syntax>k__BackingField = syntax;
			<Arguments>k__BackingField = Array.Empty<object>();
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		[CompilerGenerated]
		private readonly string <Message>k__BackingField;

		public RequiresDynamicCodeAttribute(string message)
		{
			<Message>k__BackingField = message;
		}
	}
}
namespace System.Text.Json
{
	internal sealed class PooledByteBufferWriter : IBufferWriter<byte>, IDisposable
	{
		private byte[] _rentedBuffer;

		private int _index;

		public ReadOnlyMemory<byte> WrittenMemory => _rentedBuffer.AsMemory(0, _index);

		public int Capacity => _rentedBuffer.Length;

		private PooledByteBufferWriter()
		{
		}

		public PooledByteBufferWriter(int initialCapacity)
		{
			_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialCapacity);
			_index = 0;
		}

		public void Clear()
		{
			ClearHelper();
		}

		public void ClearAndReturnBuffers()
		{
			ClearHelper();
			byte[] rentedBuffer = _rentedBuffer;
			_rentedBuffer = null;
			ArrayPool<byte>.Shared.Return(rentedBuffer);
		}

		private void ClearHelper()
		{
			_rentedBuffer.AsSpan(0, _index).Clear();
			_index = 0;
		}

		public void Dispose()
		{
			if (_rentedBuffer != null)
			{
				ClearHelper();
				byte[] rentedBuffer = _rentedBuffer;
				_rentedBuffer = null;
				ArrayPool<byte>.Shared.Return(rentedBuffer);
			}
		}

		public void InitializeEmptyInstance(int initialCapacity)
		{
			_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialCapacity);
			_index = 0;
		}

		public static PooledByteBufferWriter CreateEmptyInstanceForCaching()
		{
			return new PooledByteBufferWriter();
		}

		public void Advance(int count)
		{
			_index += count;
		}

		public Memory<byte> GetMemory(int sizeHint = 0)
		{
			CheckAndResizeBuffer(sizeHint);
			return _rentedBuffer.AsMemory(_index);
		}

		public Span<byte> GetSpan(int sizeHint = 0)
		{
			CheckAndResizeBuffer(sizeHint);
			return _rentedBuffer.AsSpan(_index);
		}

		internal ValueTask WriteToStreamAsync(Stream destination, CancellationToken cancellationToken)
		{
			return destination.WriteAsync(WrittenMemory, cancellationToken);
		}

		internal void WriteToStream(Stream destination)
		{
			destination.Write(WrittenMemory.Span);
		}

		private void CheckAndResizeBuffer(int sizeHint)
		{
			if (sizeHint == 0)
			{
				sizeHint = 256;
			}
			int num = _rentedBuffer.Length - _index;
			if (sizeHint <= num)
			{
				return;
			}
			int num2 = _rentedBuffer.Length;
			int num3 = Math.Max(sizeHint, num2);
			int num4 = num2 + num3;
			if ((uint)num4 > 2147483647u)
			{
				num4 = num2 + sizeHint;
				if ((uint)num4 > 2147483647u)
				{
					ThrowHelper.ThrowOutOfMemoryException_BufferMaximumSizeExceeded((uint)num4);
				}
			}
			byte[] rentedBuffer = _rentedBuffer;
			_rentedBuffer = ArrayPool<byte>.Shared.Rent(num4);
			Span<byte> span = rentedBuffer.AsSpan(0, _index);
			span.CopyTo(_rentedBuffer);
			span.Clear();
			ArrayPool<byte>.Shared.Return(rentedBuffer);
		}
	}
	internal static class ThrowHelper
	{
		[MethodImpl(MethodImplOptions.NoInlining)]
		[DoesNotReturn]
		public static void ThrowOutOfMemoryException_BufferMaximumSizeExceeded(uint capacity)
		{
			throw new OutOfMemoryException(System.SR.Format(System.SR.BufferMaximumSizeExceeded, capacity));
		}

		[DoesNotReturn]
		public static void ThrowArgumentNullException(string parameterName)
		{
			throw new ArgumentNullException(parameterName);
		}

		[DoesNotReturn]
		public static void ThrowArgumentOutOfRangeException_MaxDepthMustBePositive(string parameterName)
		{
			throw GetArgumentOutOfRangeException(parameterName, System.SR.MaxDepthMustBePositive);
		}

		private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(string parameterName, string message)
		{
			return new ArgumentOutOfRangeException(parameterName, message);
		}

		[DoesNotReturn]
		public static void ThrowArgumentOutOfRangeException_CommentEnumMustBeInRange(string parameterName)
		{
			throw GetArgumentOutOfRangeException(parameterName, System.SR.CommentHandlingMustBeValid);
		}

		[DoesNotReturn]
		public static void ThrowArgumentOutOfRangeException_ArrayIndexNegative(string paramName)
		{
			throw new ArgumentOutOfRangeException(paramName, System.SR.ArrayIndexNegative);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_ArrayTooSmall(string paramName)
		{
			throw new ArgumentException(System.SR.ArrayTooSmall, paramName);
		}

		private static ArgumentException GetArgumentException(string message)
		{
			return new ArgumentException(message);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException(string message)
		{
			throw GetArgumentException(message);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_DestinationTooShort()
		{
			throw GetArgumentException(System.SR.DestinationTooShort);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_PropertyNameTooLarge(int tokenLength)
		{
			throw GetArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, tokenLength));
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_ValueTooLarge(int tokenLength)
		{
			throw GetArgumentException(System.SR.Format(System.SR.ValueTooLarge, tokenLength));
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_ValueNotSupported()
		{
			throw GetArgumentException(System.SR.SpecialNumberValuesNotSupported);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NeedLargerSpan()
		{
			throw GetInvalidOperationException(System.SR.FailedToGetLargerSpan);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException(ReadOnlySpan<byte> propertyName, ReadOnlySpan<byte> value)
		{
			if (propertyName.Length > 166666666)
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.ValueTooLarge, value.Length));
			}
		}

		[DoesNotReturn]
		public static void ThrowArgumentException(ReadOnlySpan<byte> propertyName, ReadOnlySpan<char> value)
		{
			if (propertyName.Length > 166666666)
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.ValueTooLarge, value.Length));
			}
		}

		[DoesNotReturn]
		public static void ThrowArgumentException(ReadOnlySpan<char> propertyName, ReadOnlySpan<byte> value)
		{
			if (propertyName.Length > 166666666)
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.ValueTooLarge, value.Length));
			}
		}

		[DoesNotReturn]
		public static void ThrowArgumentException(ReadOnlySpan<char> propertyName, ReadOnlySpan<char> value)
		{
			if (propertyName.Length > 166666666)
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.ValueTooLarge, value.Length));
			}
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationOrArgumentException(ReadOnlySpan<byte> propertyName, int currentDepth, int maxDepth)
		{
			currentDepth &= 0x7FFFFFFF;
			if (currentDepth >= maxDepth)
			{
				ThrowInvalidOperationException(System.SR.Format(System.SR.DepthTooLarge, currentDepth, maxDepth));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException(int currentDepth, int maxDepth)
		{
			currentDepth &= 0x7FFFFFFF;
			ThrowInvalidOperationException(System.SR.Format(System.SR.DepthTooLarge, currentDepth, maxDepth));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException(string message)
		{
			throw GetInvalidOperationException(message);
		}

		private static InvalidOperationException GetInvalidOperationException(string message)
		{
			return new InvalidOperationException(message)
			{
				Source = "System.Text.Json.Rethrowable"
			};
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationOrArgumentException(ReadOnlySpan<char> propertyName, int currentDepth, int maxDepth)
		{
			currentDepth &= 0x7FFFFFFF;
			if (currentDepth >= maxDepth)
			{
				ThrowInvalidOperationException(System.SR.Format(System.SR.DepthTooLarge, currentDepth, maxDepth));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
		}

		public static InvalidOperationException GetInvalidOperationException_ExpectedArray(JsonTokenType tokenType)
		{
			return GetInvalidOperationException("array", tokenType);
		}

		public static InvalidOperationException GetInvalidOperationException_ExpectedObject(JsonTokenType tokenType)
		{
			return GetInvalidOperationException("object", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedNumber(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException("number", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedBoolean(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException("boolean", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException("string", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedStringComparison(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException(tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedComment(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException("comment", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_CannotSkipOnPartial()
		{
			throw GetInvalidOperationException(System.SR.CannotSkip);
		}

		private static InvalidOperationException GetInvalidOperationException(string message, JsonTokenType tokenType)
		{
			return GetInvalidOperationException(System.SR.Format(System.SR.InvalidCast, tokenType, message));
		}

		private static InvalidOperationException GetInvalidOperationException(JsonTokenType tokenType)
		{
			return GetInvalidOperationException(System.SR.Format(System.SR.InvalidComparison, tokenType));
		}

		[DoesNotReturn]
		internal static void ThrowJsonElementWrongTypeException(JsonTokenType expectedType, JsonTokenType actualType)
		{
			throw GetJsonElementWrongTypeException(expectedType.ToValueKind(), actualType.ToValueKind());
		}

		internal static InvalidOperationException GetJsonElementWrongTypeException(JsonValueKind expectedType, JsonValueKind actualType)
		{
			return GetInvalidOperationException(System.SR.Format(System.SR.JsonElementHasWrongType, expectedType, actualType));
		}

		internal static InvalidOperationException GetJsonElementWrongTypeException(string expectedTypeName, JsonValueKind actualType)
		{
			return GetInvalidOperationException(System.SR.Format(System.SR.JsonElementHasWrongType, expectedTypeName, actualType));
		}

		[DoesNotReturn]
		public static void ThrowJsonReaderException(ref Utf8JsonReader json, ExceptionResource resource, byte nextByte = 0, ReadOnlySpan<byte> bytes = default(ReadOnlySpan<byte>))
		{
			throw GetJsonReaderException(ref json, resource, nextByte, bytes);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static JsonException GetJsonReaderException(ref Utf8JsonReader json, ExceptionResource resource, byte nextByte, ReadOnlySpan<byte> bytes)
		{
			string resourceString = GetResourceString(ref json, resource, nextByte, JsonHelpers.Utf8GetString(bytes));
			long lineNumber = json.CurrentState._lineNumber;
			long bytePositionInLine = json.CurrentState._bytePositionInLine;
			resourceString += $" LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}.";
			return new JsonReaderException(resourceString, lineNumber, bytePositionInLine);
		}

		private static bool IsPrintable(byte value)
		{
			if (value >= 32)
			{
				return value < 127;
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static string GetPrintableString(byte value)
		{
			if (!IsPrintable(value))
			{
				return $"0x{value:X2}";
			}
			char c = (char)value;
			return c.ToString();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static string GetResourceString(ref Utf8JsonReader json, ExceptionResource resource, byte nextByte, string characters)
		{
			string printableString = GetPrintableString(nextByte);
			string result = "";
			switch (resource)
			{
			case ExceptionResource.ArrayDepthTooLarge:
				result = System.SR.Format(System.SR.ArrayDepthTooLarge, json.CurrentState.Options.MaxDepth);
				break;
			case ExceptionResource.MismatchedObjectArray:
				result = System.SR.Format(System.SR.MismatchedObjectArray, printableString);
				break;
			case ExceptionResource.TrailingCommaNotAllowedBeforeArrayEnd:
				result = System.SR.TrailingCommaNotAllowedBeforeArrayEnd;
				break;
			case ExceptionResource.TrailingCommaNotAllowedBeforeObjectEnd:
				result = System.SR.TrailingCommaNotAllowedBeforeObjectEnd;
				break;
			case ExceptionResource.EndOfStringNotFound:
				result = System.SR.EndOfStringNotFound;
				break;
			case ExceptionResource.RequiredDigitNotFoundAfterSign:
				result = System.SR.Format(System.SR.RequiredDigitNotFoundAfterSign, printableString);
				break;
			case ExceptionResource.RequiredDigitNotFoundAfterDecimal:
				result = System.SR.Format(System.SR.RequiredDigitNotFoundAfterDecimal, printableString);
				break;
			case ExceptionResource.RequiredDigitNotFoundEndOfData:
				result = System.SR.RequiredDigitNotFoundEndOfData;
				break;
			case ExceptionResource.ExpectedEndAfterSingleJson:
				result = System.SR.Format(System.SR.ExpectedEndAfterSingleJson, printableString);
				break;
			case ExceptionResource.ExpectedEndOfDigitNotFound:
				result = System.SR.Format(System.SR.ExpectedEndOfDigitNotFound, printableString);
				break;
			case ExceptionResource.ExpectedNextDigitEValueNotFound:
				result = System.SR.Format(System.SR.ExpectedNextDigitEValueNotFound, printableString);
				break;
			case ExceptionResource.ExpectedSeparatorAfterPropertyNameNotFound:
				result = System.SR.Format(System.SR.ExpectedSeparatorAfterPropertyNameNotFound, printableString);
				break;
			case ExceptionResource.ExpectedStartOfPropertyNotFound:
				result = System.SR.Format(System.SR.ExpectedStartOfPropertyNotFound, printableString);
				break;
			case ExceptionResource.ExpectedStartOfPropertyOrValueNotFound:
				result = System.SR.ExpectedStartOfPropertyOrValueNotFound;
				break;
			case ExceptionResource.ExpectedStartOfPropertyOrValueAfterComment:
				result = System.SR.Format(System.SR.ExpectedStartOfPropertyOrValueAfterComment, printableString);
				break;
			case ExceptionResource.ExpectedStartOfValueNotFound:
				result = System.SR.Format(System.SR.ExpectedStartOfValueNotFound, printableString);
				break;
			case ExceptionResource.ExpectedValueAfterPropertyNameNotFound:
				result = System.SR.ExpectedValueAfterPropertyNameNotFound;
				break;
			case ExceptionResource.FoundInvalidCharacter:
				result = System.SR.Format(System.SR.FoundInvalidCharacter, printableString);
				break;
			case ExceptionResource.InvalidEndOfJsonNonPrimitive:
				result = System.SR.Format(System.SR.InvalidEndOfJsonNonPrimitive, json.TokenType);
				break;
			case ExceptionResource.ObjectDepthTooLarge:
				result = System.SR.Format(System.SR.ObjectDepthTooLarge, json.CurrentState.Options.MaxDepth);
				break;
			case ExceptionResource.ExpectedFalse:
				result = System.SR.Format(System.SR.ExpectedFalse, characters);
				break;
			case ExceptionResource.ExpectedNull:
				result = System.SR.Format(System.SR.ExpectedNull, characters);
				break;
			case ExceptionResource.ExpectedTrue:
				result = System.SR.Format(System.SR.ExpectedTrue, characters);
				break;
			case ExceptionResource.InvalidCharacterWithinString:
				result = System.SR.Format(System.SR.InvalidCharacterWithinString, printableString);
				break;
			case ExceptionResource.InvalidCharacterAfterEscapeWithinString:
				result = System.SR.Format(System.SR.InvalidCharacterAfterEscapeWithinString, printableString);
				break;
			case ExceptionResource.InvalidHexCharacterWithinString:
				result = System.SR.Format(System.SR.InvalidHexCharacterWithinString, printableString);
				break;
			case ExceptionResource.EndOfCommentNotFound:
				result = System.SR.EndOfCommentNotFound;
				break;
			case ExceptionResource.ZeroDepthAtEnd:
				result = System.SR.Format(System.SR.ZeroDepthAtEnd);
				break;
			case ExceptionResource.ExpectedJsonTokens:
				result = System.SR.ExpectedJsonTokens;
				break;
			case ExceptionResource.NotEnoughData:
				result = System.SR.NotEnoughData;
				break;
			case ExceptionResource.ExpectedOneCompleteToken:
				result = System.SR.ExpectedOneCompleteToken;
				break;
			case ExceptionResource.InvalidCharacterAtStartOfComment:
				result = System.SR.Format(System.SR.InvalidCharacterAtStartOfComment, printableString);
				break;
			case ExceptionResource.UnexpectedEndOfDataWhileReadingComment:
				result = System.SR.Format(System.SR.UnexpectedEndOfDataWhileReadingComment);
				break;
			case ExceptionResource.UnexpectedEndOfLineSeparator:
				result = System.SR.Format(System.SR.UnexpectedEndOfLineSeparator);
				break;
			case ExceptionResource.InvalidLeadingZeroInNumber:
				result = System.SR.Format(System.SR.InvalidLeadingZeroInNumber, printableString);
				break;
			}
			return result;
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException(ExceptionResource resource, int currentDepth, int maxDepth, byte token, JsonTokenType tokenType)
		{
			throw GetInvalidOperationException(resource, currentDepth, maxDepth, token, tokenType);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_InvalidCommentValue()
		{
			throw new ArgumentException(System.SR.CannotWriteCommentWithEmbeddedDelimiter);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_InvalidUTF8(ReadOnlySpan<byte> value)
		{
			StringBuilder stringBuilder = new StringBuilder();
			int num = Math.Min(value.Length, 10);
			for (int i = 0; i < num; i++)
			{
				byte value2 = value[i];
				if (IsPrintable(value2))
				{
					stringBuilder.Append((char)value2);
					continue;
				}
				StringBuilder stringBuilder2 = stringBuilder;
				StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(2, 1, stringBuilder2);
				handler.AppendLiteral("0x");
				handler.AppendFormatted(value2, "X2");
				stringBuilder2.Append(ref handler);
			}
			if (num < value.Length)
			{
				stringBuilder.Append("...");
			}
			throw new ArgumentException(System.SR.Format(System.SR.CannotEncodeInvalidUTF8, stringBuilder));
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_InvalidUTF16(int charAsInt)
		{
			throw new ArgumentException(System.SR.Format(System.SR.CannotEncodeInvalidUTF16, $"0x{charAsInt:X2}"));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ReadInvalidUTF16(int charAsInt)
		{
			throw GetInvalidOperationException(System.SR.Format(System.SR.CannotReadInvalidUTF16, $"0x{charAsInt:X2}"));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ReadIncompleteUTF16()
		{
			throw GetInvalidOperationException(System.SR.CannotReadIncompleteUTF16);
		}

		public static InvalidOperationException GetInvalidOperationException_ReadInvalidUTF8(DecoderFallbackException innerException)
		{
			return GetInvalidOperationException(System.SR.CannotTranscodeInvalidUtf8, innerException);
		}

		public static ArgumentException GetArgumentException_ReadInvalidUTF16(EncoderFallbackException innerException)
		{
			return new ArgumentException(System.SR.CannotTranscodeInvalidUtf16, innerException);
		}

		public static InvalidOperationException GetInvalidOperationException(string message, Exception innerException)
		{
			InvalidOperationException ex = new InvalidOperationException(message, innerException);
			ex.Source = "System.Text.Json.Rethrowable";
			return ex;
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static InvalidOperationException GetInvalidOperationException(ExceptionResource resource, int currentDepth, int maxDepth, byte token, JsonTokenType tokenType)
		{
			string resourceString = GetResourceString(resource, currentDepth, maxDepth, token, tokenType);
			InvalidOperationException invalidOperationException = GetInvalidOperationException(resourceString);
			invalidOperationException.Source = "System.Text.Json.Rethrowable";
			return invalidOperationException;
		}

		[DoesNotReturn]
		public static void ThrowOutOfMemoryException(uint capacity)
		{
			throw new OutOfMemoryException(System.SR.Format(System.SR.BufferMaximumSizeExceeded, capacity));
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static string GetResourceString(ExceptionResource resource, int currentDepth, int maxDepth, byte token, JsonTokenType tokenType)
		{
			string result = "";
			switch (resource)
			{
			case ExceptionResource.MismatchedObjectArray:
				result = ((tokenType == JsonTokenType.PropertyName) ? System.SR.Format(System.SR.CannotWriteEndAfterProperty, (char)token) : System.SR.Format(System.SR.MismatchedObjectArray, (char)token));
				break;
			case ExceptionResource.DepthTooLarge:
				result = System.SR.Format(System.SR.DepthTooLarge, currentDepth & 0x7FFFFFFF, maxDepth);
				break;
			case ExceptionResource.CannotStartObjectArrayWithoutProperty:
				result = System.SR.Format(System.SR.CannotStartObjectArrayWithoutProperty, tokenType);
				break;
			case ExceptionResource.CannotStartObjectArrayAfterPrimitiveOrClose:
				result = System.SR.Format(System.SR.CannotStartObjectArrayAfterPrimitiveOrClose, tokenType);
				break;
			case ExceptionResource.CannotWriteValueWithinObject:
				result = System.SR.Format(System.SR.CannotWriteValueWithinObject, tokenType);
				break;
			case ExceptionResource.CannotWritePropertyWithinArray:
				result = ((tokenType == JsonTokenType.PropertyName) ? System.SR.Format(System.SR.CannotWritePropertyAfterProperty) : System.SR.Format(System.SR.CannotWritePropertyWithinArray, tokenType));
				break;
			case ExceptionResource.CannotWriteValueAfterPrimitiveOrClose:
				result = System.SR.Format(System.SR.CannotWriteValueAfterPrimitiveOrClose, tokenType);
				break;
			}
			return result;
		}

		[DoesNotReturn]
		public static void ThrowFormatException()
		{
			throw new FormatException
			{
				Source = "System.Text.Json.Rethrowable"
			};
		}

		public static void ThrowFormatException(NumericType numericType)
		{
			string message = "";
			switch (numericType)
			{
			case NumericType.Byte:
				message = System.SR.FormatByte;
				break;
			case NumericType.SByte:
				message = System.SR.FormatSByte;
				break;
			case NumericType.Int16:
				message = System.SR.FormatInt16;
				break;
			case NumericType.Int32:
				message = System.SR.FormatInt32;
				break;
			case NumericType.Int64:
				message = System.SR.FormatInt64;
				break;
			case NumericType.UInt16:
				message = System.SR.FormatUInt16;
				break;
			case NumericType.UInt32:
				message = System.SR.FormatUInt32;
				break;
			case NumericType.UInt64:
				message = System.SR.FormatUInt64;
				break;
			case NumericType.Single:
				message = System.SR.FormatSingle;
				break;
			case NumericType.Double:
				message = System.SR.FormatDouble;
				break;
			case NumericType.Decimal:
				message = System.SR.FormatDecimal;
				break;
			}
			throw new FormatException(message)
			{
				Source = "System.Text.Json.Rethrowable"
			};
		}

		[DoesNotReturn]
		public static void ThrowFormatException(DataType dataType)
		{
			string message = "";
			switch (dataType)
			{
			case DataType.Boolean:
			case DataType.DateOnly:
			case DataType.DateTime:
			case DataType.DateTimeOffset:
			case DataType.TimeOnly:
			case DataType.TimeSpan:
			case DataType.Guid:
			case DataType.Version:
				message = System.SR.Format(System.SR.UnsupportedFormat, dataType);
				break;
			case DataType.Base64String:
				message = System.SR.CannotDecodeInvalidBase64;
				break;
			}
			throw new FormatException(message)
			{
				Source = "System.Text.Json.Rethrowable"
			};
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedChar(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException("char", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowObjectDisposedException_Utf8JsonWriter()
		{
			throw new ObjectDisposedException("Utf8JsonWriter");
		}

		[DoesNotReturn]
		public static void ThrowObjectDisposedException_JsonDocument()
		{
			throw new ObjectDisposedException("JsonDocument");
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_NodeValueNotAllowed(string paramName)
		{
			throw new ArgumentException(System.SR.NodeValueNotAllowed, paramName);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_DuplicateKey(string paramName, string propertyName)
		{
			throw new ArgumentException(System.SR.Format(System.SR.NodeDuplicateKey, propertyName), paramName);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NodeAlreadyHasParent()
		{
			throw new InvalidOperationException(System.SR.NodeAlreadyHasParent);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NodeCycleDetected()
		{
			throw new InvalidOperationException(System.SR.NodeCycleDetected);
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_CollectionIsReadOnly()
		{
			throw GetNotSupportedException_CollectionIsReadOnly();
		}

		public static NotSupportedException GetNotSupportedException_CollectionIsReadOnly()
		{
			return new NotSupportedException(System.SR.CollectionIsReadOnly);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_DeserializeWrongType(Type type, object value)
		{
			throw new ArgumentException(System.SR.Format(System.SR.DeserializeWrongType, type, value.GetType()));
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_SerializerDoesNotSupportComments(string paramName)
		{
			throw new ArgumentException(System.SR.JsonSerializerDoesNotSupportComments, paramName);
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_SerializationNotSupported(Type propertyType)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.SerializationNotSupportedType, propertyType));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_TypeRequiresAsyncSerialization(Type propertyType)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.TypeRequiresAsyncSerialization, propertyType));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_ConstructorMaxOf64Parameters(Type type)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.ConstructorMaxOf64Parameters, type));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_DictionaryKeyTypeNotSupported(Type keyType, JsonConverter converter)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.DictionaryKeyTypeNotSupported, keyType, converter.GetType()));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)
		{
			throw new JsonException(System.SR.Format(System.SR.DeserializeUnableToConvertValue, propertyType))
			{
				AppendPathInformation = true
			};
		}

		[DoesNotReturn]
		public static void ThrowInvalidCastException_DeserializeUnableToAssignValue(Type typeOfValue, Type declaredType)
		{
			throw new InvalidCastException(System.SR.Format(System.SR.DeserializeUnableToAssignValue, typeOfValue, declaredType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_DeserializeUnableToAssignNull(Type declaredType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.DeserializeUnableToAssignNull, declaredType));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_SerializationConverterRead(JsonConverter converter)
		{
			throw new JsonException(System.SR.Format(System.SR.SerializationConverterRead, converter))
			{
				AppendPathInformation = true
			};
		}

		[DoesNotReturn]
		public static void ThrowJsonException_SerializationConverterWrite(JsonConverter converter)
		{
			throw new JsonException(System.SR.Format(System.SR.SerializationConverterWrite, converter))
			{
				AppendPathInformation = true
			};
		}

		[DoesNotReturn]
		public static void ThrowJsonException_SerializerCycleDetected(int maxDepth)
		{
			throw new JsonException(System.SR.Format(System.SR.SerializerCycleDetected, maxDepth))
			{
				AppendPathInformation = true
			};
		}

		[DoesNotReturn]
		public static void ThrowJsonException(string message = null)
		{
			throw new JsonException(message)
			{
				AppendPathInformation = true
			};
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_CannotSerializeInvalidType(string paramName, Type typeToConvert, Type declaringType, string propertyName)
		{
			if (declaringType == null)
			{
				throw new ArgumentException(System.SR.Format(System.SR.CannotSerializeInvalidType, typeToConvert), paramName);
			}
			throw new ArgumentException(System.SR.Format(System.SR.CannotSerializeInvalidMember, typeToConvert, propertyName, declaringType), paramName);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_CannotSerializeInvalidType(Type typeToConvert, Type declaringType, MemberInfo memberInfo)
		{
			if (declaringType == null)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.CannotSerializeInvalidType, typeToConvert));
			}
			throw new InvalidOperationException(System.SR.Format(System.SR.CannotSerializeInvalidMember, typeToConvert, memberInfo.Name, declaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationConverterNotCompatible(Type converterType, Type type)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationConverterNotCompatible, converterType, type));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ResolverTypeNotCompatible(Type requestedType, Type actualType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.ResolverTypeNotCompatible, actualType, requestedType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ResolverTypeInfoOptionsNotCompatible()
		{
			throw new InvalidOperationException(System.SR.ResolverTypeInfoOptionsNotCompatible);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_JsonTypeInfoUsedButTypeInfoResolverNotSet()
		{
			throw new InvalidOperationException(System.SR.JsonTypeInfoUsedButTypeInfoResolverNotSet);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationConverterOnAttributeInvalid(Type classType, MemberInfo memberInfo)
		{
			string text = classType.ToString();
			if (memberInfo != null)
			{
				text = text + "." + memberInfo.Name;
			}
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationConverterOnAttributeInvalid, text));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(Type classTypeAttributeIsOn, MemberInfo memberInfo, Type typeToConvert)
		{
			string text = classTypeAttributeIsOn.ToString();
			if (memberInfo != null)
			{
				text = text + "." + memberInfo.Name;
			}
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationConverterOnAttributeNotCompatible, text, typeToConvert));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializerOptionsImmutable(JsonSerializerContext context)
		{
			string message = ((context == null) ? System.SR.SerializerOptionsImmutable : System.SR.SerializerContextOptionsImmutable);
			throw new InvalidOperationException(message);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_TypeInfoResolverImmutable()
		{
			throw new InvalidOperationException(System.SR.TypeInfoResolverImmutable);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_TypeInfoImmutable()
		{
			throw new InvalidOperationException(System.SR.TypeInfoImmutable);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_PropertyInfoImmutable()
		{
			throw new InvalidOperationException(System.SR.PropertyInfoImmutable);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializerPropertyNameConflict(Type type, string propertyName)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializerPropertyNameConflict, type, propertyName));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializerPropertyNameNull(JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializerPropertyNameNull, jsonPropertyInfo.DeclaringType, jsonPropertyInfo.MemberName));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_JsonPropertyRequiredAndNotDeserializable(JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.JsonPropertyRequiredAndNotDeserializable, jsonPropertyInfo.Name, jsonPropertyInfo.DeclaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_JsonPropertyRequiredAndExtensionData(JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.JsonPropertyRequiredAndExtensionData, jsonPropertyInfo.Name, jsonPropertyInfo.DeclaringType));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_JsonRequiredPropertyMissing(JsonTypeInfo parent, BitArray requiredPropertiesSet)
		{
			StringBuilder stringBuilder = new StringBuilder();
			bool flag = true;
			for (int i = 0; i < parent.PropertyCache.List.Count; i++)
			{
				JsonPropertyInfo value = parent.PropertyCache.List[i].Value;
				if (value.IsRequired && !requiredPropertiesSet[value.RequiredPropertyIndex])
				{
					if (!flag)
					{
						stringBuilder.Append(CultureInfo.CurrentUICulture.TextInfo.ListSeparator);
						stringBuilder.Append(' ');
					}
					stringBuilder.Append(value.Name);
					flag = false;
					if (stringBuilder.Length >= 50)
					{
						break;
					}
				}
			}
			throw new JsonException(System.SR.Format(System.SR.JsonRequiredPropertiesMissing, parent.Type, stringBuilder.ToString()));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NamingPolicyReturnNull(JsonNamingPolicy namingPolicy)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.NamingPolicyReturnNull, namingPolicy));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsNull(Type converterType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializerConverterFactoryReturnsNull, converterType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsJsonConverterFactorty(Type converterType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializerConverterFactoryReturnsJsonConverterFactory, converterType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_MultiplePropertiesBindToConstructorParameters(Type parentType, string parameterName, string firstMatchName, string secondMatchName)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.MultipleMembersBindWithConstructorParameter, firstMatchName, secondMatchName, parentType, parameterName));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(Type parentType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.ConstructorParamIncompleteBinding, parentType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExtensionDataCannotBindToCtorParam(string propertyName, JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.ExtensionDataCannotBindToCtorParam, propertyName, jsonPropertyInfo.DeclaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_JsonIncludeOnNonPublicInvalid(string memberName, Type declaringType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.JsonIncludeOnNonPublicInvalid, memberName, declaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_IgnoreConditionOnValueTypeInvalid(string clrPropertyName, Type propertyDeclaringType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.IgnoreConditionOnValueTypeInvalid, clrPropertyName, propertyDeclaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NumberHandlingOnPropertyInvalid(JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.NumberHandlingOnPropertyInvalid, jsonPropertyInfo.MemberName, jsonPropertyInfo.DeclaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ConverterCanConvertMultipleTypes(Type runtimePropertyType, JsonConverter jsonConverter)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.ConverterCanConvertMultipleTypes, jsonConverter.GetType(), jsonConverter.TypeToConvert, runtimePropertyType));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_ObjectWithParameterizedCtorRefMetadataNotSupported(ReadOnlySpan<byte> propertyName, ref Utf8JsonReader reader, scoped ref ReadStack state)
		{
			JsonTypeInfo topJsonTypeInfoWithParameterizedConstructor = state.GetTopJsonTypeInfoWithParameterizedConstructor();
			state.Current.JsonPropertyName = propertyName.ToArray();
			NotSupportedException ex = new NotSupportedException(System.SR.Format(System.SR.ObjectWithParameterizedCtorRefMetadataNotSupported, topJsonTypeInfoWithParameterizedConstructor.Type));
			ThrowNotSupportedException(ref state, in reader, ex);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_JsonTypeInfoOperationNotPossibleForKind(JsonTypeInfoKind kind)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.InvalidJsonTypeInfoOperationForKind, kind));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_CreateObjectConverterNotCompatible(Type type)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.CreateObjectConverterNotCompatible, type));
		}

		[DoesNotReturn]
		public static void ReThrowWithPath(scoped ref ReadStack state, JsonReaderException ex)
		{
			string text = state.JsonPath();
			string message = ex.Message;
			int num = message.AsSpan().LastIndexOf(" LineNumber: ");
			message = ((num < 0) ? (message + " Path: " + text + ".") : $"{message.Substring(0, num)} Path: {text} |{message.Substring(num)}");
			throw new JsonException(message, text, ex.LineNumber, ex.BytePositionInLine, ex);
		}

		[DoesNotReturn]
		public static void ReThrowWithPath(scoped ref ReadStack state, in Utf8JsonReader reader, Exception ex)
		{
			JsonException ex2 = new JsonException(null, ex);
			AddJsonExceptionInformation(ref state, in reader, ex2);
			throw ex2;
		}

		public static void AddJsonExceptionInformation(scoped ref ReadStack state, in Utf8JsonReader reader, JsonException ex)
		{
			long lineNumber = reader.CurrentState._lineNumber;
			ex.LineNumber = lineNumber;
			long bytePositionInLine = reader.CurrentState._bytePositionInLine;
			ex.BytePositionInLine = bytePositionInLine;
			string value = (ex.Path = state.JsonPath());
			string text2 = ex._message;
			if (string.IsNullOrEmpty(text2))
			{
				Type p = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
				text2 = System.SR.Format(System.SR.DeserializeUnableToConvertValue, p);
				ex.AppendPathInformation = true;
			}
			if (ex.AppendPathInformation)
			{
				text2 += $" Path: {value} | LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}.";
				ex.SetMessage(text2);
			}
		}

		[DoesNotReturn]
		public static void ReThrowWithPath(ref WriteStack state, Exception ex)
		{
			JsonException ex2 = new JsonException(null, ex);
			AddJsonExceptionInformation(ref state, ex2);
			throw ex2;
		}

		public static void AddJsonExceptionInformation(ref WriteStack state, JsonException ex)
		{
			string text2 = (ex.Path = state.PropertyPath());
			string text3 = ex._message;
			if (string.IsNullOrEmpty(text3))
			{
				text3 = System.SR.Format(System.SR.SerializeUnableToSerialize);
				ex.AppendPathInformation = true;
			}
			if (ex.AppendPathInformation)
			{
				text3 = text3 + " Path: " + text2 + ".";
				ex.SetMessage(text3);
			}
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationDuplicateAttribute(Type attribute, MemberInfo memberInfo)
		{
			string p = ((memberInfo is Type type) ? type.ToString() : $"{memberInfo.DeclaringType}.{memberInfo.Name}");
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationDuplicateAttribute, attribute, p));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(Type classType, Type attribute)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationDuplicateTypeAttribute, classType, attribute));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute<TAttribute>(Type classType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationDuplicateTypeAttribute, classType, typeof(TAttribute)));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationDataExtensionPropertyInvalid(JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationDataExtensionPropertyInvalid, jsonPropertyInfo.PropertyType, jsonPropertyInfo.MemberName));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty()
		{
			throw new InvalidOperationException(System.SR.NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty);
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException(scoped ref ReadStack state, in Utf8JsonReader reader, NotSupportedException ex)
		{
			string text = ex.Message;
			Type type = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
			if (!text.Contains(type.ToString()))
			{
				if (text.Length > 0)
				{
					text += " ";
				}
				text += System.SR.Format(System.SR.SerializationNotSupportedParentType, type);
			}
			long lineNumber = reader.CurrentState._lineNumber;
			long bytePositionInLine = reader.CurrentState._bytePositionInLine;
			text += $" Path: {state.JsonPath()} | LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}.";
			throw new NotSupportedException(text, ex);
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException(ref WriteStack state, NotSupportedException ex)
		{
			string text = ex.Message;
			Type type = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
			if (!text.Contains(type.ToString()))
			{
				if (text.Length > 0)
				{
					text += " ";
				}
				text += System.SR.Format(System.SR.SerializationNotSupportedParentType, type);
			}
			text = text + " Path: " + state.PropertyPath() + ".";
			throw new NotSupportedException(text, ex);
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_DeserializeNoConstructor(Type type, ref Utf8JsonReader reader, scoped ref ReadStack state)
		{
			string message = ((!type.IsInterface) ? System.SR.Format(System.SR.DeserializeNoConstructor, "JsonConstructorAttribute", type) : System.SR.Format(System.SR.DeserializePolymorphicInterface, type));
			ThrowNotSupportedException(ref state, in reader, new NotSupportedException(message));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_CannotPopulateCollection(Type type, ref Utf8JsonReader reader, scoped ref ReadStack state)
		{
			ThrowNotSupportedException(ref state, in reader, new NotSupportedException(System.SR.Format(System.SR.CannotPopulateCollection, type)));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataValuesInvalidToken(JsonTokenType tokenType)
		{
			ThrowJsonException(System.SR.Format(System.SR.MetadataInvalidTokenAfterValues, tokenType));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataReferenceNotFound(string id)
		{
			ThrowJsonException(System.SR.Format(System.SR.MetadataReferenceNotFound, id));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataValueWasNotString(JsonTokenType tokenType)
		{
			ThrowJsonException(System.SR.Format(System.SR.MetadataValueWasNotString, tokenType));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataValueWasNotString(JsonValueKind valueKind)
		{
			ThrowJsonException(System.SR.Format(System.SR.MetadataValueWasNotString, valueKind));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties(ReadOnlySpan<byte> propertyName, scoped ref ReadStack state)
		{
			state.Current.JsonPropertyName = propertyName.ToArray();
			ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties();
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataUnexpectedProperty(ReadOnlySpan<byte> propertyName, scoped ref ReadStack state)
		{
			state.Current.JsonPropertyName = propertyName.ToArray();
			ThrowJsonException(System.SR.Format(System.SR.MetadataUnexpectedProperty));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties()
		{
			ThrowJsonException(System.SR.MetadataReferenceCannotContainOtherProperties);
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataIdIsNotFirstProperty(ReadOnlySpan<byte> propertyName, scoped ref ReadStack state)
		{
			state.Current.JsonPropertyName = propertyName.ToArray();
			ThrowJsonException(System.SR.MetadataIdIsNotFirstProperty);
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataStandaloneValuesProperty(scoped ref ReadStack state, ReadOnlySpan<byte> propertyName)
		{
			state.Current.JsonPropertyName = propertyName.ToArray();
			ThrowJsonException(System.SR.MetadataStandaloneValuesProperty);
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataInvalidPropertyWithLeadingDollarSign(ReadOnlySpan<byte> propertyName, scoped ref ReadStack state, in Utf8JsonReader reader)
		{
			if (state.Current.IsProcessingDictionary())
			{
				state.Current.JsonPropertyNameAsString = reader.GetString();
			}
			else
			{
				state.Current.JsonPropertyName = propertyName.ToArray();
			}
			ThrowJsonException(System.SR.MetadataInvalidPropertyWithLeadingDollarSign);
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataDuplicateIdFound(string id)
		{
			ThrowJsonException(System.SR.Format(System.SR.MetadataDuplicateIdFound, id));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataDuplicateTypeProperty()
		{
			ThrowJsonException(System.SR.MetadataDuplicateTypeProperty);
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataInvalidReferenceToValueType(Type propertyType)
		{
			ThrowJsonException(System.SR.Format(System.SR.MetadataInvalidReferenceToValueType, propertyType));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataInvalidPropertyInArrayMetadata(scoped ref ReadStack state, Type propertyType, in Utf8JsonReader reader)
		{
			ref ReadStackFrame current = ref state.Current;
			byte[] jsonPropertyName;
			if (!reader.HasValueSequence)
			{
				jsonPropertyName = reader.ValueSpan.ToArray();
			}
			else
			{
				ReadOnlySequence<byte> sequence = reader.ValueSequence;
				jsonPropertyName = BuffersExtensions.ToArray(in sequence);
			}
			current.JsonPropertyName = jsonPropertyName;
			string @string = reader.GetString();
			ThrowJsonException(System.SR.Format(System.SR.MetadataPreservedArrayFailed, System.SR.Format(System.SR.MetadataInvalidPropertyInArrayMetadata, @string), System.SR.Format(System.SR.DeserializeUnableToConvertValue, propertyType)));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataPreservedArrayValuesNotFound(scoped ref ReadStack state, Type propertyType)
		{
			state.Current.JsonPropertyName = null;
			ThrowJsonException(System.SR.Format(System.SR.MetadataPreservedArrayFailed, System.SR.MetadataStandaloneValuesProperty, System.SR.Format(System.SR.DeserializeUnableToConvertValue, propertyType)));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_MetadataCannotParsePreservedObjectIntoImmutable(Type propertyType)
		{
			ThrowJsonException(System.SR.Format(System.SR.MetadataCannotParsePreservedObjectToImmutable, propertyType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_MetadataReferenceOfTypeCannotBeAssignedToType(string referenceId, Type currentType, Type typeToConvert)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.MetadataReferenceOfTypeCannotBeAssignedToType, referenceId, currentType, typeToConvert));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_JsonPropertyInfoIsBoundToDifferentJsonTypeInfo(JsonPropertyInfo propertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.JsonPropertyInfoBoundToDifferentParent, propertyInfo.Name, propertyInfo.ParentTypeInfo.Type.FullName));
		}

		[DoesNotReturn]
		internal static void ThrowUnexpectedMetadataException(ReadOnlySpan<byte> propertyName, ref Utf8JsonReader reader, scoped ref ReadStack state)
		{
			if (JsonSerializer.GetMetadataPropertyName(propertyName, state.Current.BaseJsonTypeInfo.PolymorphicTypeResolver) != 0)
			{
				ThrowJsonException_MetadataUnexpectedProperty(propertyName, ref state);
			}
			else
			{
				ThrowJsonException_MetadataInvalidPropertyWithLeadingDollarSign(propertyName, ref state, in reader);
			}
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver resolver)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.NoMetadataForType, type, resolver?.GetType().FullName ?? "<null>"));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_ConstructorContainsNullParameterNames(Type declaringType)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.ConstructorContainsNullParameterNames, declaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NoMetadataForType(Type type, IJsonTypeInfoResolver resolver)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.NoMetadataForType, type, resolver?.GetType().FullName ?? "<null>"));
		}

		public static Exception GetInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver resolver, Type type)
		{
			return new InvalidOperationException(System.SR.Format(System.SR.NoMetadataForTypeProperties, resolver?.GetType().FullName ?? "<null>", type));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver resolver, Type type)
		{
			throw GetInvalidOperationException_NoMetadataForTypeProperties(resolver, type);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NoMetadataForTypeCtorParams(IJsonTypeInfoResolver resolver, Type type)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.NoMetadataForTypeCtorParams, resolver?.GetType().FullName ?? "<null>", type));
		}

		[DoesNotReturn]
		public static void ThrowMissingMemberException_MissingFSharpCoreMember(string missingFsharpCoreMember)
		{
			throw new MissingMemberException(System.SR.Format(System.SR.MissingFSharpCoreMember, missingFsharpCoreMember));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_BaseConverterDoesNotSupportMetadata(Type derivedType)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedType));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_DerivedConverterDoesNotSupportMetadata(Type derivedType)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedType));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_RuntimeTypeNotSupported(Type baseType, Type runtimeType)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.Polymorphism_RuntimeTypeNotSupported, runtimeType, baseType));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_RuntimeTypeDiamondAmbiguity(Type baseType, Type runtimeType, Type derivedType1, Type derivedType2)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.Polymorphism_RuntimeTypeDiamondAmbiguity, runtimeType, derivedType1, derivedType2, baseType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_TypeDoesNotSupportPolymorphism(Type baseType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.Polymorphism_TypeDoesNotSupportPolymorphism, baseType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_DerivedTypeNotSupported(Type baseType, Type derivedType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.Polymorphism_DerivedTypeIsNotSupported, derivedType, baseType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_DerivedTypeIsAlreadySpecified(Type baseType, Type derivedType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.Polymorphism_DerivedTypeIsAlreadySpecified, baseType, derivedType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_TypeDicriminatorIdIsAlreadySpecified(Type baseType, object typeDiscriminator)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.Polymorphism_TypeDicriminatorIdIsAlreadySpecified, baseType, typeDiscriminator));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_InvalidCustomTypeDiscriminatorPropertyName()
		{
			throw new InvalidOperationException(System.SR.Polymorphism_InvalidCustomTypeDiscriminatorPropertyName);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_PolymorphicTypeConfigurationDoesNotSpecifyDerivedTypes(Type baseType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.Polymorphism_ConfigurationDoesNotSpecifyDerivedTypes, baseType));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_UnrecognizedTypeDiscriminator(object typeDiscriminator)
		{
			ThrowJsonException(System.SR.Format(System.SR.Polymorphism_UnrecognizedTypeDiscriminator, typeDiscriminator));
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo(string parameterName)
		{
			throw new ArgumentException(System.SR.JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo, parameterName);
		}
	}
	internal sealed class JsonCamelCaseNamingPolicy : JsonNamingPolicy
	{
		public override string ConvertName(string name)
		{
			if (string.IsNullOrEmpty(name) || !char.IsUpper(name[0]))
			{
				return name;
			}
			return string.Create(name.Length, name, delegate(Span<char> chars, string name)
			{
				name.CopyTo(chars);
				FixCasing(chars);
			});
		}

		private static void FixCasing(Span<char> chars)
		{
			for (int i = 0; i < chars.Length && (i != 1 || char.IsUpper(chars[i])); i++)
			{
				bool flag = i + 1 < chars.Length;
				if (i > 0 && flag && !char.IsUpper(chars[i + 1]))
				{
					if (chars[i + 1] == ' ')
					{
						chars[i] = char.ToLowerInvariant(chars[i]);
					}
					break;
				}
				chars[i] = char.ToLowerInvariant(chars[i]);
			}
		}
	}
	public abstract class JsonNamingPolicy
	{
		public static JsonNamingPolicy CamelCase { get; } = new JsonCamelCaseNamingPolicy();


		public abstract string ConvertName(string name);
	}
	internal static class JsonConstants
	{
		public static ReadOnlySpan<byte> Utf8Bom => "\ufeff"u8;

		public static ReadOnlySpan<byte> TrueValue => "true"u8;

		public static ReadOnlySpan<byte> FalseValue => "false"u8;

		public static ReadOnlySpan<byte> NullValue => "null"u8;

		public static ReadOnlySpan<byte> NaNValue => "NaN"u8;

		public static ReadOnlySpan<byte> PositiveInfinityValue => "Infinity"u8;

		public static ReadOnlySpan<byte> NegativeInfinityValue => "-Infinity"u8;

		public static ReadOnlySpan<byte> Delimiters => ",}] \n\r\t/"u8;

		public static ReadOnlySpan<byte> EscapableChars => "\"nrt/ubf"u8;
	}
	internal static class JsonHelpers
	{
		[StructLayout(LayoutKind.Auto)]
		private struct DateTimeParseData
		{
			public int Year;

			public int Month;

			public int Day;

			public bool IsCalendarDateOnly;

			public int Hour;

			public int Minute;

			public int Second;

			public int Fraction;

			public int OffsetHours;

			public int OffsetMinutes;

			public byte OffsetToken;

			public bool OffsetNegative => OffsetToken == 45;
		}

		private static readonly int[] s_daysToMonth365 = new int[13]
		{
			0, 31, 59, 90, 120, 151, 181, 212, 243, 273,
			304, 334, 365
		};

		private static readonly int[] s_daysToMonth366 = new int[13]
		{
			0, 31, 60, 91, 121, 152, 182, 213, 244, 274,
			305, 335, 366
		};

		public static bool TryAdd<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, in TKey key, in TValue value)
		{
			return dictionary.TryAdd(key, value);
		}

		internal static void StableSortByKey<T, TKey>(this List<T> items, Func<T, TKey> keySelector) where TKey : unmanaged, IComparable<TKey>
		{
			Span<T> items2 = CollectionsMarshal.AsSpan(items);
			Span<(TKey, int)> span = ((items2.Length > 32) ? ((Span<(TKey, int)>)new(TKey, int)[items2.Length]) : stackalloc(TKey, int)[32].Slice(0, items2.Length));
			Span<(TKey, int)> keys = span;
			for (int i = 0; i < keys.Length; i++)
			{
				keys[i] = (keySelector(items2[i]), i);
			}
			keys.Sort(items2);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static ReadOnlySpan<byte> GetSpan(this scoped ref Utf8JsonReader reader)
		{
			if (!reader.HasValueSequence)
			{
				return reader.ValueSpan;
			}
			ReadOnlySequence<byte> sequence = reader.ValueSequence;
			return BuffersExtensions.ToArray(in sequence);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsInRangeInclusive(uint value, uint lowerBound, uint upperBound)
		{
			return value - lowerBound <= upperBound - lowerBound;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsInRangeInclusive(int value, int lowerBound, int upperBound)
		{
			return (uint)(value - lowerBound) <= (uint)(upperBound - lowerBound);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsInRangeInclusive(long value, long lowerBound, long upperBound)
		{
			return (ulong)(value - lowerBound) <= (ulong)(upperBound - lowerBound);
		}

		public static bool IsDigit(byte value)
		{
			return (uint)(value - 48) <= 9u;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ReadWithVerify(this ref Utf8JsonReader reader)
		{
			bool flag = reader.Read();
		}

		public static string Utf8GetString(ReadOnlySpan<byte> bytes)
		{
			return Encoding.UTF8.GetString(bytes);
		}

		public static Dictionary<TKey, TValue> CreateDictionaryFromCollection<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>> collection, IEqualityComparer<TKey> comparer)
		{
			return new Dictionary<TKey, TValue>(collection, comparer);
		}

		public static bool IsFinite(double value)
		{
			return double.IsFinite(value);
		}

		public static bool IsFinite(float value)
		{
			return float.IsFinite(value);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ValidateInt32MaxArrayLength(uint length)
		{
			if (length > 2146435071)
			{
				ThrowHelper.ThrowOutOfMemoryException(length);
			}
		}

		public static bool AllBitsEqual(this BitArray bitArray, bool value)
		{
			for (int i = 0; i < bitArray.Count; i++)
			{
				if (bitArray[i] != value)
				{
					return false;
				}
			}
			return true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsValidDateTimeOffsetParseLength(int length)
		{
			return IsInRangeInclusive(length, 10, 252);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsValidUnescapedDateTimeOffsetParseLength(int length)
		{
			return IsInRangeInclusive(length, 10, 42);
		}

		public static bool TryParseAsISO(ReadOnlySpan<byte> source, out DateTime value)
		{
			if (!TryParseDateTimeOffset(source, out var parseData))
			{
				value = default(DateTime);
				return false;
			}
			if (parseData.OffsetToken == 90)
			{
				return TryCreateDateTime(parseData, DateTimeKind.Utc, out value);
			}
			if (parseData.OffsetToken == 43 || parseData.OffsetToken == 45)
			{
				if (!TryCreateDateTimeOffset(ref parseData, out var value2))
				{
					value = default(DateTime);
					return false;
				}
				value = value2.LocalDateTime;
				return true;
			}
			return TryCreateDateTime(parseData, DateTimeKind.Unspecified, out value);
		}

		public static bool TryParseAsISO(ReadOnlySpan<byte> source, out DateTimeOffset value)
		{
			if (!TryParseDateTimeOffset(source, out var parseData))
			{
				value = default(DateTimeOffset);
				return false;
			}
			if (parseData.OffsetToken == 90 || parseData.OffsetToken == 43 || parseData.OffsetToken == 45)
			{
				return TryCreateDateTimeOffset(ref parseData, out value);
			}
			return TryCreateDateTimeOffsetInterpretingDataAsLocalTime(parseData, out value);
		}

		public static bool TryParseAsIso(ReadOnlySpan<byte> source, out DateOnly value)
		{
			if (TryParseDateTimeOffset(source, out var parseData) && parseData.IsCalendarDateOnly && TryCreateDateTime(parseData, DateTimeKind.Unspecified, out var value2))
			{
				value = DateOnly.FromDateTime(value2);
				return true;
			}
			value = default(DateOnly);
			return false;
		}

		private static bool TryParseDateTimeOffset(ReadOnlySpan<byte> source, out DateTimeParseData parseData)
		{
			parseData = default(DateTimeParseData);
			uint num = (uint)(source[0] - 48);
			uint num2 = (uint)(source[1] - 48);
			uint num3 = (uint)(source[2] - 48);
			uint num4 = (uint)(source[3] - 48);
			if (num > 9 || num2 > 9 || num3 > 9 || num4 > 9)
			{
				return false;
			}
			parseData.Year = (int)(num * 1000 + num2 * 100 + num3 * 10 + num4);
			if (source[4] != 45 || !TryGetNextTwoDigits(source.Slice(5, 2), ref parseData.Month) || source[7] != 45 || !TryGetNextTwoDigits(source.Slice(8, 2), ref parseData.Day))
			{
				return false;
			}
			if (source.Length == 10)
			{
				parseData.IsCalendarDateOnly = true;
				return true;
			}
			if (source.Length < 16)
			{
				return false;
			}
			if (source[10] != 84 || source[13] != 58 || !TryGetNextTwoDigits(source.Slice(11, 2), ref parseData.Hour) || !TryGetNextTwoDigits(source.Slice(14, 2), ref parseData.Minute))
			{
				return false;
			}
			if (source.Length == 16)
			{
				return true;
			}
			byte b = source[16];
			int num5 = 17;
			switch (b)
			{
			case 90:
				parseData.OffsetToken = 90;
				return num5 == source.Length;
			case 43:
			case 45:
				parseData.OffsetToken = b;
				return ParseOffset(ref parseData, source.Slice(num5));
			default:
				return false;
			case 58:
				if (source.Length < 19 || !TryGetNextTwoDigits(source.Slice(17, 2), ref parseData.Second))
				{
					return false;
				}
				if (source.Length == 19)
				{
					return true;
				}
				b = source[19];
				num5 = 20;
				switch (b)
				{
				case 90:
					parseData.OffsetToken = 90;
					return num5 == source.Length;
				case 43:
				case 45:
					parseData.OffsetToken = b;
					return ParseOffset(ref parseData, source.Slice(num5));
				default:
					return false;
				case 46:
				{
					if (source.Length < 21)
					{
						return false;
					}
					int i = 0;
					for (int num6 = Math.Min(num5 + 16, source.Length); num5 < num6; num5++)
					{
						if (!IsDigit(b = source[num5]))
						{
							break;
						}
						if (i < 7)
						{
							parseData.Fraction = parseData.Fraction * 10 + (b - 48);
							i++;
						}
					}
					if (parseData.Fraction != 0)
					{
						for (; i < 7; i++)
						{
							parseData.Fraction *= 10;
						}
					}
					if (num5 == source.Length)
					{
						return true;
					}
					b = source[num5++];
					switch (b)
					{
					case 90:
						parseData.OffsetToken = 90;
						return num5 == source.Length;
					case 43:
					case 45:
						parseData.OffsetToken = b;
						return ParseOffset(ref parseData, source.Slice(num5));
					default:
						return false;
					}
				}
				}
			}
			static bool ParseOffset(ref DateTimeParseData parseData, ReadOnlySpan<byte> offsetData)
			{
				if (offsetData.Length < 2 || !TryGetNextTwoDigits(offsetData.Slice(0, 2), ref parseData.OffsetHours))
				{
					return false;
				}
				if (offsetData.Length == 2)
				{
					return true;
				}
				if (offsetData.Length != 5 || offsetData[2] != 58 || !TryGetNextTwoDigits(offsetData.Slice(3), ref parseData.OffsetMinutes))
				{
					return false;
				}
				return true;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static bool TryGetNextTwoDigits(ReadOnlySpan<byte> source, ref int value)
		{
			uint num = (uint)(source[0] - 48);
			uint num2 = (uint)(source[1] - 48);
			if (num > 9 || num2 > 9)
			{
				value = 0;
				return false;
			}
			value = (int)(num * 10 + num2);
			return true;
		}

		private static bool TryCreateDateTimeOffset(DateTime dateTime, ref DateTimeParseData parseData, out DateTimeOffset value)
		{
			if ((uint)parseData.OffsetHours > 14u)
			{
				value = default(DateTimeOffset);
				return false;
			}
			if ((uint)parseData.OffsetMinutes > 59u)
			{
				value = default(DateTimeOffset);
				return false;
			}
			if (parseData.OffsetHours == 14 && parseData.OffsetMinutes != 0)
			{
				value = default(DateTimeOffset);
				return false;
			}
			long num = ((long)parseData.OffsetHours * 3600L + (long)parseData.OffsetMinutes * 60L) * 10000000;
			if (parseData.OffsetNegative)
			{
				num = -num;
			}
			try
			{
				value = new DateTimeOffset(dateTime.Ticks, new TimeSpan(num));
			}
			catch (ArgumentOutOfRangeException)
			{
				value = default(DateTimeOffset);
				return false;
			}
			return true;
		}

		private static bool TryCreateDateTimeOffset(ref DateTimeParseData parseData, out DateTimeOffset value)
		{
			if (!TryCreateDateTime(parseData, DateTimeKind.Unspecified, out var value2))
			{
				value = default(DateTimeOffset);
				return false;
			}
			if (!TryCreateDateTimeOffset(value2, ref parseData, out value))
			{
				value = default(DateTimeOffset);
				return false;
			}
			return true;
		}

		private static bool TryCreateDateTimeOffsetInterpretingDataAsLocalTime(DateTimeParseData parseData, out DateTimeOffset value)
		{
			if (!TryCreateDateTime(parseData, DateTimeKind.Local, out var value2))
			{
				value = default(DateTimeOffset);
				return false;
			}
			try
			{
				value = new DateTimeOffset(value2);
			}
			catch (ArgumentOutOfRangeException)
			{
				value = default(DateTimeOffset);
				return false;
			}
			return true;
		}

		private static bool TryCreateDateTime(DateTimeParseData parseData, DateTimeKind kind, out DateTime value)
		{
			if (parseData.Year == 0)
			{
				value = default(DateTime);
				return false;
			}
			if ((uint)(parseData.Month - 1) >= 12u)
			{
				value = default(DateTime);
				return false;
			}
			uint num = (uint)(parseData.Day - 1);
			if (num >= 28 && num >= DateTime.DaysInMonth(parseData.Year, parseData.Month))
			{
				value = default(DateTime);
				return false;
			}
			if ((uint)parseData.Hour > 23u)
			{
				value = default(DateTime);
				return false;
			}
			if ((uint)parseData.Minute > 59u)
			{
				value = default(DateTime);
				return false;
			}
			if ((uint)parseData.Second > 59u)
			{
				value = default(DateTime);
				return false;
			}
			int[] array = (DateTime.IsLeapYear(parseData.Year) ? s_daysToMonth366 : s_daysToMonth365);
			int num2 = parseData.Year - 1;
			int num3 = num2 * 365 + num2 / 4 - num2 / 100 + num2 / 400 + array[parseData.Month - 1] + parseData.Day - 1;
			long num4 = num3 * 864000000000L;
			int num5 = parseData.Hour * 3600 + parseData.Minute * 60 + parseData.Second;
			num4 += (long)num5 * 10000000L;
			num4 += parseData.Fraction;
			value = new DateTime(num4, kind);
			return true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static byte[] GetEscapedPropertyNameSection(ReadOnlySpan<byte> utf8Value, JavaScriptEncoder encoder)
		{
			int num = JsonWriterHelper.NeedsEscaping(utf8Value, encoder);
			if (num != -1)
			{
				return GetEscapedPropertyNameSection(utf8Value, num, encoder);
			}
			return GetPropertyNameSection(utf8Value);
		}

		public static byte[] EscapeValue(ReadOnlySpan<byte> utf8Value, int firstEscapeIndexVal, JavaScriptEncoder encoder)
		{
			byte[] array = null;
			int maxEscapedLength = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal);
			Span<byte> span = ((maxEscapedLength > 256) ? ((Span<byte>)(array = ArrayPool<byte>.Shared.Rent(maxEscapedLength))) : stackalloc byte[256]);
			Span<byte> destination = span;
			JsonWriterHelper.EscapeString(utf8Value, destination, firstEscapeIndexVal, encoder, out var written);
			byte[] result = destination.Slice(0, written).ToArray();
			if (array != null)
			{
				ArrayPool<byte>.Shared.Return(array);
			}
			return result;
		}

		private static byte[] GetEscapedPropertyNameSection(ReadOnlySpan<byte> utf8Value, int firstEscapeIndexVal, JavaScriptEncoder encoder)
		{
			byte[] array = null;
			int maxEscapedLength = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal);
			Span<byte> span = ((maxEscapedLength > 256) ? ((Span<byte>)(array = ArrayPool<byte>.Shared.Rent(maxEscapedLength))) : stackalloc byte[256]);
			Span<byte> destination = span;
			JsonWriterHelper.EscapeString(utf8Value, destination, firstEscapeIndexVal, encoder, out var written);
			byte[] propertyNameSection = GetPropertyNameSection(destination.Slice(0, written));
			if (array != null)
			{
				ArrayPool<byte>.Shared.Return(array);
			}
			return propertyNameSection;
		}

		private static byte[] GetPropertyNameSection(ReadOnlySpan<byte> utf8Value)
		{
			int length = utf8Value.Length;
			byte[] array = new byte[length + 3];
			array[0] = 34;
			utf8Value.CopyTo(array.AsSpan(1, length));
			array[++length] = 34;
			array[++length] = 58;
			return array;
		}
	}
	internal static class AppContextSwitchHelper
	{
		private static readonly bool s_isSourceGenReflectionFallbackEnabled = AppContext.TryGetSwitch("System.Text.Json.Serialization.EnableSourceGenReflectionFallback", out var isEnabled) && isEnabled;

		public static bool IsSourceGenReflectionFallbackEnabled => s_isSourceGenReflectionFallbackEnabled;
	}
	internal struct BitStack
	{
		private int[] _array;

		private ulong _allocationFreeContainer;

		private int _currentDepth;

		public int CurrentDepth => _currentDepth;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void PushTrue()
		{
			if (_currentDepth < 64)
			{
				_allocationFreeContainer = (_allocationFreeContainer << 1) | 1;
			}
			else
			{
				PushToArray(value: true);
			}
			_currentDepth++;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void PushFalse()
		{
			if (_currentDepth < 64)
			{
				_allocationFreeContainer <<= 1;
			}
			else
			{
				PushToArray(value: false);
			}
			_currentDepth++;
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void PushToArray(bool value)
		{
			if (_array == null)
			{
				_array = new int[2];
			}
			int number = _currentDepth - 64;
			int remainder;
			int num = Div32Rem(number, out remainder);
			if (num >= _array.Length)
			{
				DoubleArray(num);
			}
			int num2 = _array[num];
			num2 = ((!value) ? (num2 & ~(1 << remainder)) : (num2 | (1 << remainder)));
			_array[num] = num2;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool Pop()
		{
			_currentDepth--;
			if (_currentDepth < 64)
			{
				_allocationFreeContainer >>= 1;
				return (_allocationFreeContainer & 1) != 0;
			}
			if (_currentDepth == 64)
			{
				return (_allocationFreeContainer & 1) != 0;
			}
			return PopFromArray();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private bool PopFromArray()
		{
			

VirtualizingWrapPanel.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("S. Bäumlisbergerr")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("© S. Bäumlisberger")]
[assembly: AssemblyDescription("Implementation of a VirtualizingWrapPanel for WPF running .NET Framework or .NET Core. The panel supports horizontal and vertical orientation, caching, container recycling and grouping. The package also contains a GridView and GridDetailsView control based on the VirtualizingWrapPanel. In addition a simple VirtualizingItemsControl is included. Samples, API-Documentation and Source Code are available on the project site.")]
[assembly: AssemblyFileVersion("1.5.7.0")]
[assembly: AssemblyInformationalVersion("1.5.7")]
[assembly: AssemblyProduct("VirtualizingWrapPanel")]
[assembly: AssemblyTitle("VirtualizingWrapPanel")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/sbaeumlisberger/VirtualizingWrapPanel")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: AssemblyVersion("1.5.7.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace WpfToolkit.Controls
{
	public class GridDetailsView : GridView, IComponentConnector, IStyleConnector
	{
		public static readonly DependencyProperty ExpandedItemTemplateProperty = DependencyProperty.Register("ExpandedItemTemplate", typeof(DataTemplate), typeof(GridDetailsView), (PropertyMetadata)new FrameworkPropertyMetadata((PropertyChangedCallback)null));

		public static readonly DependencyProperty ExpandedItemProperty = DependencyProperty.Register("ExpandedItem", typeof(object), typeof(GridDetailsView), (PropertyMetadata)new FrameworkPropertyMetadata((PropertyChangedCallback)null));

		private FrameworkElement? expandedItemContainerRoot;

		private bool animateExpansion;

		private bool animateCloseExpansion;

		internal GridDetailsView uc;

		private bool _contentLoaded;

		public DataTemplate? ExpandedItemTemplate
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (DataTemplate)((DependencyObject)this).GetValue(ExpandedItemTemplateProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(ExpandedItemTemplateProperty, (object)value);
			}
		}

		public object? ExpandedItem
		{
			get
			{
				return ((DependencyObject)this).GetValue(ExpandedItemProperty);
			}
			private set
			{
				((DependencyObject)this).SetValue(ExpandedItemProperty, value);
			}
		}

		private double DesiredContainerSize
		{
			get
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Invalid comparison between Unknown and I4
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				if (expandedItemContainerRoot == null)
				{
					throw new NullReferenceException("expandedItemContainerRoot is null");
				}
				Size desiredSize;
				if ((int)base.Orientation == 1)
				{
					desiredSize = ((UIElement)expandedItemContainerRoot).DesiredSize;
					return ((Size)(ref desiredSize)).Height;
				}
				desiredSize = ((UIElement)expandedItemContainerRoot).DesiredSize;
				return ((Size)(ref desiredSize)).Width;
			}
		}

		private double MaxContainerSize
		{
			get
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Invalid comparison between Unknown and I4
				if (expandedItemContainerRoot == null)
				{
					throw new NullReferenceException("expandedItemContainerRoot is null");
				}
				if ((int)base.Orientation == 1)
				{
					return expandedItemContainerRoot.MaxHeight;
				}
				return expandedItemContainerRoot.MaxWidth;
			}
			set
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Invalid comparison between Unknown and I4
				if (expandedItemContainerRoot == null)
				{
					throw new NullReferenceException("expandedItemContainerRoot is null");
				}
				if ((int)base.Orientation == 1)
				{
					expandedItemContainerRoot.MaxHeight = value;
				}
				else
				{
					expandedItemContainerRoot.MaxWidth = value;
				}
			}
		}

		public GridDetailsView()
		{
			InitializeComponent();
		}

		protected override DependencyObject GetContainerForItemOverride()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_001e: Expected O, but got Unknown
			FrameworkElement val = (FrameworkElement)((ListView)this).GetContainerForItemOverride();
			((UIElement)val).PreviewMouseDown += new MouseButtonEventHandler(Container_PreviewMouseDown);
			return (DependencyObject)val;
		}

		private async void Container_PreviewMouseDown(object sender, MouseButtonEventArgs args)
		{
			if ((int)((MouseEventArgs)args).LeftButton != 1)
			{
				return;
			}
			object dataContext = ((FrameworkElement)sender).DataContext;
			if (dataContext != ExpandedItem)
			{
				ExpandedItem = dataContext;
				return;
			}
			animateExpansion = false;
			animateCloseExpansion = true;
			if (MaxContainerSize == double.PositiveInfinity)
			{
				MaxContainerSize = DesiredContainerSize;
			}
			double sourceHeight = MaxContainerSize;
			for (int i = 20; i >= 0; i--)
			{
				if (!animateCloseExpansion)
				{
					return;
				}
				MaxContainerSize = sourceHeight / 20.0 * (double)i;
				if (i != 0)
				{
					await Task.Delay(15);
				}
			}
			expandedItemContainerRoot = null;
			ExpandedItem = null;
			animateCloseExpansion = false;
		}

		private async void ExpandedItemContainerRoot_Loaded(object sender, RoutedEventArgs args)
		{
			animateCloseExpansion = false;
			if (expandedItemContainerRoot == null)
			{
				expandedItemContainerRoot = (FrameworkElement)sender;
				MaxContainerSize = 0.0;
				double targetHeight = DesiredContainerSize;
				animateExpansion = true;
				for (int i = 0; i <= 20; i++)
				{
					if (!animateExpansion)
					{
						return;
					}
					MaxContainerSize = targetHeight / 20.0 * (double)i;
					if (i != 20)
					{
						await Task.Delay(15);
					}
				}
				MaxContainerSize = double.PositiveInfinity;
				animateExpansion = false;
			}
			else
			{
				expandedItemContainerRoot = (FrameworkElement)sender;
				MaxContainerSize = double.PositiveInfinity;
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("PresentationBuildTasks", "6.0.1.0")]
		public void InitializeComponent()
		{
			if (!_contentLoaded)
			{
				_contentLoaded = true;
				Uri uri = new Uri("/VirtualizingWrapPanel;component/griddetailsview.xaml", UriKind.Relative);
				Application.LoadComponent((object)this, uri);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("PresentationBuildTasks", "6.0.1.0")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void IComponentConnector.Connect(int connectionId, object target)
		{
			if (connectionId == 1)
			{
				uc = (GridDetailsView)target;
			}
			else
			{
				_contentLoaded = true;
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("PresentationBuildTasks", "6.0.1.0")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		void IStyleConnector.Connect(int connectionId, object target)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (connectionId == 2)
			{
				((FrameworkElement)(StackPanel)target).Loaded += new RoutedEventHandler(ExpandedItemContainerRoot_Loaded);
			}
		}
	}
	public class GridView : ListView
	{
		public static readonly DependencyProperty OrientationProperty;

		public static readonly DependencyProperty SpacingModeProperty;

		public static readonly DependencyProperty StretchItemsProperty;

		public Orientation Orientation
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return (Orientation)((DependencyObject)this).GetValue(OrientationProperty);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((DependencyObject)this).SetValue(OrientationProperty, (object)value);
			}
		}

		public SpacingMode SpacingMode
		{
			get
			{
				return (SpacingMode)((DependencyObject)this).GetValue(SpacingModeProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(SpacingModeProperty, (object)value);
			}
		}

		public bool StretchItems
		{
			get
			{
				return (bool)((DependencyObject)this).GetValue(StretchItemsProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(StretchItemsProperty, (object)value);
			}
		}

		static GridView()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_0159: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(GridView), (PropertyMetadata)new FrameworkPropertyMetadata((object)(Orientation)1));
			SpacingModeProperty = DependencyProperty.Register("SpacingMode", typeof(SpacingMode), typeof(GridView), (PropertyMetadata)new FrameworkPropertyMetadata((object)SpacingMode.Uniform));
			StretchItemsProperty = DependencyProperty.Register("StretchItems", typeof(bool), typeof(GridView), (PropertyMetadata)new FrameworkPropertyMetadata((object)false));
			DependencyProperty itemContainerStyleProperty = ItemsControl.ItemContainerStyleProperty;
			Type typeFromHandle = typeof(GridView);
			Style val = new Style();
			((Collection<SetterBase>)(object)val.Setters).Add((SetterBase)new Setter
			{
				Property = FrameworkElement.MarginProperty,
				Value = (object)new Thickness(0.0)
			});
			((Collection<SetterBase>)(object)val.Setters).Add((SetterBase)new Setter
			{
				Property = Control.PaddingProperty,
				Value = (object)new Thickness(4.0)
			});
			((Collection<SetterBase>)(object)val.Setters).Add((SetterBase)new Setter
			{
				Property = Control.HorizontalContentAlignmentProperty,
				Value = (object)(HorizontalAlignment)3
			});
			((Collection<SetterBase>)(object)val.Setters).Add((SetterBase)new Setter
			{
				Property = Control.VerticalContentAlignmentProperty,
				Value = (object)(VerticalAlignment)3
			});
			itemContainerStyleProperty.OverrideMetadata(typeFromHandle, (PropertyMetadata)new FrameworkPropertyMetadata((object)val));
		}

		public GridView()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			FrameworkElementFactory val = new FrameworkElementFactory(typeof(VirtualizingWrapPanel));
			val.SetBinding(VirtualizingWrapPanel.OrientationProperty, (BindingBase)new Binding
			{
				Source = this,
				Path = new PropertyPath("Orientation", Array.Empty<object>()),
				Mode = (BindingMode)1
			});
			val.SetBinding(VirtualizingWrapPanel.SpacingModeProperty, (BindingBase)new Binding
			{
				Source = this,
				Path = new PropertyPath("SpacingMode", Array.Empty<object>()),
				Mode = (BindingMode)1
			});
			val.SetBinding(VirtualizingWrapPanel.StretchItemsProperty, (BindingBase)new Binding
			{
				Source = this,
				Path = new PropertyPath("StretchItems", Array.Empty<object>()),
				Mode = (BindingMode)1
			});
			((ItemsControl)this).ItemsPanel = new ItemsPanelTemplate(val);
			VirtualizingPanel.SetCacheLengthUnit((DependencyObject)(object)this, (VirtualizationCacheLengthUnit)2);
			VirtualizingPanel.SetCacheLength((DependencyObject)(object)this, new VirtualizationCacheLength(1.0));
			VirtualizingPanel.SetIsVirtualizingWhenGrouping((DependencyObject)(object)this, true);
		}
	}
	public struct ItemRange
	{
		public int StartIndex { get; }

		public int EndIndex { get; }

		public ItemRange(int startIndex, int endIndex)
		{
			this = default(ItemRange);
			StartIndex = startIndex;
			EndIndex = endIndex;
		}

		public bool Contains(int itemIndex)
		{
			if (itemIndex >= StartIndex)
			{
				return itemIndex <= EndIndex;
			}
			return false;
		}
	}
	public enum ScrollDirection
	{
		Vertical,
		Horizontal
	}
	public enum SpacingMode
	{
		None,
		Uniform,
		BetweenItemsOnly,
		StartAndEndOnly
	}
	public class VirtualizingItemsControl : ItemsControl
	{
		public VirtualizingItemsControl()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			((ItemsControl)this).ItemsPanel = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(VirtualizingStackPanel)));
			string text = "\r\n            <ControlTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>\r\n                <Border\r\n                    BorderThickness='{TemplateBinding Border.BorderThickness}'\r\n                    Padding='{TemplateBinding Control.Padding}'\r\n                    BorderBrush='{TemplateBinding Border.BorderBrush}'\r\n                    Background='{TemplateBinding Panel.Background}'\r\n                    SnapsToDevicePixels='True'>\r\n                    <ScrollViewer\r\n                        Padding='{TemplateBinding Control.Padding}'\r\n                        Focusable='False'>\r\n                        <ItemsPresenter\r\n                            SnapsToDevicePixels='{TemplateBinding UIElement.SnapsToDevicePixels}'/>\r\n                    </ScrollViewer>\r\n                </Border>\r\n            </ControlTemplate>";
			((Control)this).Template = (ControlTemplate)XamlReader.Parse(text);
			ScrollViewer.SetCanContentScroll((DependencyObject)(object)this, true);
			ScrollViewer.SetVerticalScrollBarVisibility((DependencyObject)(object)this, (ScrollBarVisibility)1);
			ScrollViewer.SetHorizontalScrollBarVisibility((DependencyObject)(object)this, (ScrollBarVisibility)1);
			VirtualizingPanel.SetCacheLengthUnit((DependencyObject)(object)this, (VirtualizationCacheLengthUnit)2);
			VirtualizingPanel.SetCacheLength((DependencyObject)(object)this, new VirtualizationCacheLength(1.0));
			VirtualizingPanel.SetIsVirtualizingWhenGrouping((DependencyObject)(object)this, true);
		}
	}
	public abstract class VirtualizingPanelBase : VirtualizingPanel, IScrollInfo
	{
		public static readonly DependencyProperty ScrollLineDeltaProperty = DependencyProperty.Register("ScrollLineDelta", typeof(double), typeof(VirtualizingPanelBase), (PropertyMetadata)new FrameworkPropertyMetadata((object)16.0));

		public static readonly DependencyProperty MouseWheelDeltaProperty = DependencyProperty.Register("MouseWheelDelta", typeof(double), typeof(VirtualizingPanelBase), (PropertyMetadata)new FrameworkPropertyMetadata((object)48.0));

		public static readonly DependencyProperty ScrollLineDeltaItemProperty = DependencyProperty.Register("ScrollLineDeltaItem", typeof(int), typeof(VirtualizingPanelBase), (PropertyMetadata)new FrameworkPropertyMetadata((object)1));

		public static readonly DependencyProperty MouseWheelDeltaItemProperty = DependencyProperty.Register("MouseWheelDeltaItem", typeof(int), typeof(VirtualizingPanelBase), (PropertyMetadata)new FrameworkPropertyMetadata((object)3));

		private DependencyObject? _itemsOwner;

		private IRecyclingItemContainerGenerator? _itemContainerGenerator;

		private Visibility previousVerticalScrollBarVisibility = (Visibility)2;

		private Visibility previousHorizontalScrollBarVisibility = (Visibility)2;

		public ScrollViewer? ScrollOwner { get; set; }

		public bool CanVerticallyScroll { get; set; }

		public bool CanHorizontallyScroll { get; set; }

		protected override bool CanHierarchicallyScrollAndVirtualizeCore => true;

		public double ScrollLineDelta
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(ScrollLineDeltaProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(ScrollLineDeltaProperty, (object)value);
			}
		}

		public double MouseWheelDelta
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(MouseWheelDeltaProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(MouseWheelDeltaProperty, (object)value);
			}
		}

		public double ScrollLineDeltaItem
		{
			get
			{
				return (int)((DependencyObject)this).GetValue(ScrollLineDeltaItemProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(ScrollLineDeltaItemProperty, (object)value);
			}
		}

		public int MouseWheelDeltaItem
		{
			get
			{
				return (int)((DependencyObject)this).GetValue(MouseWheelDeltaItemProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(MouseWheelDeltaItemProperty, (object)value);
			}
		}

		protected ScrollUnit ScrollUnit => VirtualizingPanel.GetScrollUnit((DependencyObject)(object)ItemsControl);

		protected ScrollDirection MouseWheelScrollDirection { get; set; }

		protected bool IsVirtualizing => VirtualizingPanel.GetIsVirtualizing((DependencyObject)(object)ItemsControl);

		protected VirtualizationMode VirtualizationMode => VirtualizingPanel.GetVirtualizationMode((DependencyObject)(object)ItemsControl);

		protected bool IsRecycling => (int)VirtualizationMode == 1;

		protected VirtualizationCacheLength CacheLength { get; private set; }

		protected VirtualizationCacheLengthUnit CacheLengthUnit { get; private set; }

		protected ItemsControl ItemsControl => ItemsControl.GetItemsOwner((DependencyObject)(object)this);

		protected DependencyObject ItemsOwner
		{
			get
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Expected O, but got Unknown
				if (_itemsOwner == null)
				{
					MethodInfo method = typeof(ItemsControl).GetMethod("GetItemsOwnerInternal", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[1] { typeof(DependencyObject) }, null);
					_itemsOwner = (DependencyObject)method.Invoke(null, new object[1] { this });
				}
				return _itemsOwner;
			}
		}

		protected ReadOnlyCollection<object?> Items => ((ItemContainerGenerator)ItemContainerGenerator).Items;

		protected IRecyclingItemContainerGenerator ItemContainerGenerator
		{
			get
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Expected O, but got Unknown
				if (_itemContainerGenerator == null)
				{
					_ = ((Panel)this).InternalChildren;
					_itemContainerGenerator = (IRecyclingItemContainerGenerator)((VirtualizingPanel)this).ItemContainerGenerator;
				}
				return _itemContainerGenerator;
			}
		}

		public double ExtentWidth
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				Size extent = Extent;
				return ((Size)(ref extent)).Width;
			}
		}

		public double ExtentHeight
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				Size extent = Extent;
				return ((Size)(ref extent)).Height;
			}
		}

		protected Size Extent { get; private set; } = new Size(0.0, 0.0);


		public double HorizontalOffset
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				Point offset = Offset;
				return ((Point)(ref offset)).X;
			}
		}

		public double VerticalOffset
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				Point offset = Offset;
				return ((Point)(ref offset)).Y;
			}
		}

		protected Size Viewport { get; private set; } = new Size(0.0, 0.0);


		public double ViewportWidth
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				Size viewport = Viewport;
				return ((Size)(ref viewport)).Width;
			}
		}

		public double ViewportHeight
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				Size viewport = Viewport;
				return ((Size)(ref viewport)).Height;
			}
		}

		protected Point Offset { get; private set; } = new Point(0.0, 0.0);


		protected ItemRange ItemRange { get; set; }

		protected virtual void UpdateScrollInfo(Size availableSize, Size extent)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			if (extent != Extent)
			{
				Extent = extent;
				flag = true;
			}
			if (availableSize != Viewport)
			{
				Viewport = availableSize;
				flag = true;
			}
			Point offset;
			if (ViewportHeight != 0.0 && VerticalOffset != 0.0 && VerticalOffset + ViewportHeight + 1.0 >= ExtentHeight)
			{
				offset = Offset;
				Offset = new Point(((Point)(ref offset)).X, ((Size)(ref extent)).Height - ((Size)(ref availableSize)).Height);
				flag = true;
			}
			if (ViewportWidth != 0.0 && HorizontalOffset != 0.0 && HorizontalOffset + ViewportWidth + 1.0 >= ExtentWidth)
			{
				double num = ((Size)(ref extent)).Width - ((Size)(ref availableSize)).Width;
				offset = Offset;
				Offset = new Point(num, ((Point)(ref offset)).Y);
				flag = true;
			}
			if (flag)
			{
				ScrollViewer? scrollOwner = ScrollOwner;
				if (scrollOwner != null)
				{
					scrollOwner.InvalidateScrollInfo();
				}
			}
		}

		public virtual Rect MakeVisible(Visual visual, Rect rectangle)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			Point val = visual.TransformToAncestor((Visual)(object)this).Transform(Offset);
			double num = 0.0;
			double num2 = 0.0;
			double x = ((Point)(ref val)).X;
			Point offset = Offset;
			Size viewport;
			if (x < ((Point)(ref offset)).X)
			{
				offset = Offset;
				num = 0.0 - (((Point)(ref offset)).X - ((Point)(ref val)).X);
			}
			else
			{
				double num3 = ((Point)(ref val)).X + ((Rect)(ref rectangle)).Width;
				offset = Offset;
				double x2 = ((Point)(ref offset)).X;
				viewport = Viewport;
				if (num3 > x2 + ((Size)(ref viewport)).Width)
				{
					double num4 = ((Point)(ref val)).X + ((Rect)(ref rectangle)).Width;
					offset = Offset;
					double x3 = ((Point)(ref offset)).X;
					viewport = Viewport;
					double val2 = num4 - (x3 + ((Size)(ref viewport)).Width);
					double x4 = ((Point)(ref val)).X;
					offset = Offset;
					double val3 = x4 - ((Point)(ref offset)).X;
					num = Math.Min(val2, val3);
				}
			}
			double y = ((Point)(ref val)).Y;
			offset = Offset;
			if (y < ((Point)(ref offset)).Y)
			{
				offset = Offset;
				num2 = 0.0 - (((Point)(ref offset)).Y - ((Point)(ref val)).Y);
			}
			else
			{
				double num5 = ((Point)(ref val)).Y + ((Rect)(ref rectangle)).Height;
				offset = Offset;
				double y2 = ((Point)(ref offset)).Y;
				viewport = Viewport;
				if (num5 > y2 + ((Size)(ref viewport)).Height)
				{
					double num6 = ((Point)(ref val)).Y + ((Rect)(ref rectangle)).Height;
					offset = Offset;
					double y3 = ((Point)(ref offset)).Y;
					viewport = Viewport;
					double val4 = num6 - (y3 + ((Size)(ref viewport)).Height);
					double y4 = ((Point)(ref val)).Y;
					offset = Offset;
					double val5 = y4 - ((Point)(ref offset)).Y;
					num2 = Math.Min(val4, val5);
				}
			}
			offset = Offset;
			SetHorizontalOffset(((Point)(ref offset)).X + num);
			offset = Offset;
			SetVerticalOffset(((Point)(ref offset)).Y + num2);
			double width = ((Rect)(ref rectangle)).Width;
			viewport = Viewport;
			double num7 = Math.Min(width, ((Size)(ref viewport)).Width);
			double height = ((Rect)(ref rectangle)).Height;
			viewport = Viewport;
			double num8 = Math.Min(height, ((Size)(ref viewport)).Height);
			return new Rect(num, num2, num7, num8);
		}

		protected override void OnItemsChanged(object sender, ItemsChangedEventArgs args)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			GeneratorPosition val;
			switch (args.Action)
			{
			case NotifyCollectionChangedAction.Remove:
			case NotifyCollectionChangedAction.Replace:
				val = args.Position;
				((VirtualizingPanel)this).RemoveInternalChildRange(((GeneratorPosition)(ref val)).Index, args.ItemUICount);
				break;
			case NotifyCollectionChangedAction.Move:
				val = args.OldPosition;
				((VirtualizingPanel)this).RemoveInternalChildRange(((GeneratorPosition)(ref val)).Index, args.ItemUICount);
				break;
			}
		}

		protected int GetItemIndexFromChildIndex(int childIndex)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			GeneratorPosition generatorPositionFromChildIndex = GetGeneratorPositionFromChildIndex(childIndex);
			return ((IItemContainerGenerator)ItemContainerGenerator).IndexFromGeneratorPosition(generatorPositionFromChildIndex);
		}

		protected virtual GeneratorPosition GetGeneratorPositionFromChildIndex(int childIndex)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return new GeneratorPosition(childIndex, 0);
		}

		protected override Size MeasureOverride(Size availableSize)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Invalid comparison between Unknown and I4
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			if (ScrollOwner != null)
			{
				bool flag = (int)ScrollOwner.VerticalScrollBarVisibility == 1 && (int)ScrollOwner.ComputedVerticalScrollBarVisibility != 0 && ScrollOwner.ComputedVerticalScrollBarVisibility != previousVerticalScrollBarVisibility;
				bool flag2 = (int)ScrollOwner.HorizontalScrollBarVisibility == 1 && (int)ScrollOwner.ComputedHorizontalScrollBarVisibility != 0 && ScrollOwner.ComputedHorizontalScrollBarVisibility != previousHorizontalScrollBarVisibility;
				previousVerticalScrollBarVisibility = ScrollOwner.ComputedVerticalScrollBarVisibility;
				previousHorizontalScrollBarVisibility = ScrollOwner.ComputedHorizontalScrollBarVisibility;
				if ((!((UIElement)ScrollOwner).IsMeasureValid && flag) || flag2)
				{
					return availableSize;
				}
			}
			DependencyObject itemsOwner = ItemsOwner;
			IHierarchicalVirtualizationAndScrollInfo val = (IHierarchicalVirtualizationAndScrollInfo)(object)((itemsOwner is IHierarchicalVirtualizationAndScrollInfo) ? itemsOwner : null);
			Size extent;
			Size val2 = default(Size);
			if (val != null)
			{
				HierarchicalVirtualizationConstraints constraints = val.Constraints;
				Rect viewport = ((HierarchicalVirtualizationConstraints)(ref constraints)).Viewport;
				Size size = ((Rect)(ref viewport)).Size;
				HierarchicalVirtualizationHeaderDesiredSizes headerDesiredSizes = val.HeaderDesiredSizes;
				Size pixelSize = ((HierarchicalVirtualizationHeaderDesiredSizes)(ref headerDesiredSizes)).PixelSize;
				double num = Math.Max(((Size)(ref size)).Width - 5.0, 0.0);
				double num2 = Math.Max(((Size)(ref size)).Height - ((Size)(ref pixelSize)).Height, 0.0);
				((Size)(ref availableSize))..ctor(num, num2);
				extent = CalculateExtent(availableSize);
				((Size)(ref val2))..ctor(((Size)(ref extent)).Width, ((Size)(ref extent)).Height);
				Extent = extent;
				constraints = val.Constraints;
				viewport = ((HierarchicalVirtualizationConstraints)(ref constraints)).Viewport;
				Offset = ((Rect)(ref viewport)).Location;
				constraints = val.Constraints;
				viewport = ((HierarchicalVirtualizationConstraints)(ref constraints)).Viewport;
				Viewport = ((Rect)(ref viewport)).Size;
				constraints = val.Constraints;
				CacheLength = ((HierarchicalVirtualizationConstraints)(ref constraints)).CacheLength;
				constraints = val.Constraints;
				CacheLengthUnit = ((HierarchicalVirtualizationConstraints)(ref constraints)).CacheLengthUnit;
			}
			else
			{
				extent = CalculateExtent(availableSize);
				double num3 = Math.Min(((Size)(ref availableSize)).Width, ((Size)(ref extent)).Width);
				double num4 = Math.Min(((Size)(ref availableSize)).Height, ((Size)(ref extent)).Height);
				((Size)(ref val2))..ctor(num3, num4);
				UpdateScrollInfo(val2, extent);
				CacheLength = VirtualizingPanel.GetCacheLength(ItemsOwner);
				CacheLengthUnit = VirtualizingPanel.GetCacheLengthUnit(ItemsOwner);
			}
			ItemRange = UpdateItemRange();
			RealizeItems();
			VirtualizeItems();
			return val2;
		}

		protected virtual void RealizeItems()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			GeneratorPosition val = ((IItemContainerGenerator)ItemContainerGenerator).GeneratorPositionFromIndex(ItemRange.StartIndex);
			int num = ((((GeneratorPosition)(ref val)).Offset == 0) ? ((GeneratorPosition)(ref val)).Index : (((GeneratorPosition)(ref val)).Index + 1));
			using (((IItemContainerGenerator)ItemContainerGenerator).StartAt(val, (GeneratorDirection)0, true))
			{
				int num2 = ItemRange.StartIndex;
				bool flag = default(bool);
				while (num2 <= ItemRange.EndIndex)
				{
					UIElement val2 = (UIElement)((IItemContainerGenerator)ItemContainerGenerator).GenerateNext(ref flag);
					if (flag || !((Panel)this).InternalChildren.Contains(val2))
					{
						if (num >= ((Panel)this).InternalChildren.Count)
						{
							((VirtualizingPanel)this).AddInternalChild(val2);
						}
						else
						{
							((VirtualizingPanel)this).InsertInternalChild(num, val2);
						}
						((IItemContainerGenerator)ItemContainerGenerator).PrepareItemContainer((DependencyObject)(object)val2);
						val2.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
					}
					IHierarchicalVirtualizationAndScrollInfo val3 = (IHierarchicalVirtualizationAndScrollInfo)(object)((val2 is IHierarchicalVirtualizationAndScrollInfo) ? val2 : null);
					if (val3 != null)
					{
						val3.Constraints = new HierarchicalVirtualizationConstraints(new VirtualizationCacheLength(0.0), (VirtualizationCacheLengthUnit)1, new Rect(0.0, 0.0, ViewportWidth, ViewportHeight));
						val2.Measure(new Size(ViewportWidth, ViewportHeight));
					}
					num2++;
					num++;
				}
			}
		}

		protected virtual void VirtualizeItems()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			for (int num = ((Panel)this).InternalChildren.Count - 1; num >= 0; num--)
			{
				GeneratorPosition generatorPositionFromChildIndex = GetGeneratorPositionFromChildIndex(num);
				int num2 = ((IItemContainerGenerator)ItemContainerGenerator).IndexFromGeneratorPosition(generatorPositionFromChildIndex);
				if (num2 != -1 && !ItemRange.Contains(num2))
				{
					if ((int)VirtualizationMode == 1)
					{
						ItemContainerGenerator.Recycle(generatorPositionFromChildIndex, 1);
					}
					else
					{
						((IItemContainerGenerator)ItemContainerGenerator).Remove(generatorPositionFromChildIndex, 1);
					}
					((VirtualizingPanel)this).RemoveInternalChildRange(num, 1);
				}
			}
		}

		protected abstract Size CalculateExtent(Size availableSize);

		protected abstract ItemRange UpdateItemRange();

		public void SetVerticalOffset(double offset)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			if (!(offset < 0.0))
			{
				Size val = Viewport;
				double height = ((Size)(ref val)).Height;
				val = Extent;
				if (!(height >= ((Size)(ref val)).Height))
				{
					double num = offset;
					val = Viewport;
					double num2 = num + ((Size)(ref val)).Height;
					val = Extent;
					if (num2 >= ((Size)(ref val)).Height)
					{
						val = Extent;
						double height2 = ((Size)(ref val)).Height;
						val = Viewport;
						offset = height2 - ((Size)(ref val)).Height;
					}
					goto IL_0076;
				}
			}
			offset = 0.0;
			goto IL_0076;
			IL_0076:
			Point offset2 = Offset;
			Offset = new Point(((Point)(ref offset2)).X, offset);
			ScrollViewer? scrollOwner = ScrollOwner;
			if (scrollOwner != null)
			{
				scrollOwner.InvalidateScrollInfo();
			}
			((UIElement)this).InvalidateMeasure();
		}

		public void SetHorizontalOffset(double offset)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			if (!(offset < 0.0))
			{
				Size val = Viewport;
				double width = ((Size)(ref val)).Width;
				val = Extent;
				if (!(width >= ((Size)(ref val)).Width))
				{
					double num = offset;
					val = Viewport;
					double num2 = num + ((Size)(ref val)).Width;
					val = Extent;
					if (num2 >= ((Size)(ref val)).Width)
					{
						val = Extent;
						double width2 = ((Size)(ref val)).Width;
						val = Viewport;
						offset = width2 - ((Size)(ref val)).Width;
					}
					goto IL_0076;
				}
			}
			offset = 0.0;
			goto IL_0076;
			IL_0076:
			double num3 = offset;
			Point offset2 = Offset;
			Offset = new Point(num3, ((Point)(ref offset2)).Y);
			ScrollViewer? scrollOwner = ScrollOwner;
			if (scrollOwner != null)
			{
				scrollOwner.InvalidateScrollInfo();
			}
			((UIElement)this).InvalidateMeasure();
		}

		protected void ScrollVertical(double amount)
		{
			SetVerticalOffset(VerticalOffset + amount);
		}

		protected void ScrollHorizontal(double amount)
		{
			SetHorizontalOffset(HorizontalOffset + amount);
		}

		public void LineUp()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ScrollVertical(((int)ScrollUnit == 0) ? (0.0 - ScrollLineDelta) : GetLineUpScrollAmount());
		}

		public void LineDown()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ScrollVertical(((int)ScrollUnit == 0) ? ScrollLineDelta : GetLineDownScrollAmount());
		}

		public void LineLeft()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ScrollHorizontal(((int)ScrollUnit == 0) ? (0.0 - ScrollLineDelta) : GetLineLeftScrollAmount());
		}

		public void LineRight()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ScrollHorizontal(((int)ScrollUnit == 0) ? ScrollLineDelta : GetLineRightScrollAmount());
		}

		public void MouseWheelUp()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (MouseWheelScrollDirection == ScrollDirection.Vertical)
			{
				ScrollVertical(((int)ScrollUnit == 0) ? (0.0 - MouseWheelDelta) : GetMouseWheelUpScrollAmount());
			}
			else
			{
				MouseWheelLeft();
			}
		}

		public void MouseWheelDown()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (MouseWheelScrollDirection == ScrollDirection.Vertical)
			{
				ScrollVertical(((int)ScrollUnit == 0) ? MouseWheelDelta : GetMouseWheelDownScrollAmount());
			}
			else
			{
				MouseWheelRight();
			}
		}

		public void MouseWheelLeft()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ScrollHorizontal(((int)ScrollUnit == 0) ? (0.0 - MouseWheelDelta) : GetMouseWheelLeftScrollAmount());
		}

		public void MouseWheelRight()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ScrollHorizontal(((int)ScrollUnit == 0) ? MouseWheelDelta : GetMouseWheelRightScrollAmount());
		}

		public void PageUp()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ScrollVertical(((int)ScrollUnit == 0) ? (0.0 - ViewportHeight) : GetPageUpScrollAmount());
		}

		public void PageDown()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ScrollVertical(((int)ScrollUnit == 0) ? ViewportHeight : GetPageDownScrollAmount());
		}

		public void PageLeft()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ScrollHorizontal(((int)ScrollUnit == 0) ? (0.0 - ViewportHeight) : GetPageLeftScrollAmount());
		}

		public void PageRight()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ScrollHorizontal(((int)ScrollUnit == 0) ? ViewportHeight : GetPageRightScrollAmount());
		}

		protected abstract double GetLineUpScrollAmount();

		protected abstract double GetLineDownScrollAmount();

		protected abstract double GetLineLeftScrollAmount();

		protected abstract double GetLineRightScrollAmount();

		protected abstract double GetMouseWheelUpScrollAmount();

		protected abstract double GetMouseWheelDownScrollAmount();

		protected abstract double GetMouseWheelLeftScrollAmount();

		protected abstract double GetMouseWheelRightScrollAmount();

		protected abstract double GetPageUpScrollAmount();

		protected abstract double GetPageDownScrollAmount();

		protected abstract double GetPageLeftScrollAmount();

		protected abstract double GetPageRightScrollAmount();
	}
	public class VirtualizingWrapPanel : VirtualizingPanelBase
	{
		[Obsolete("Use SpacingMode")]
		public static readonly DependencyProperty IsSpacingEnabledProperty = DependencyProperty.Register("IsSpacingEnabled", typeof(bool), typeof(VirtualizingWrapPanel), (PropertyMetadata)new FrameworkPropertyMetadata((object)true, (FrameworkPropertyMetadataOptions)1));

		public static readonly DependencyProperty SpacingModeProperty = DependencyProperty.Register("SpacingMode", typeof(SpacingMode), typeof(VirtualizingWrapPanel), (PropertyMetadata)new FrameworkPropertyMetadata((object)SpacingMode.Uniform, (FrameworkPropertyMetadataOptions)1));

		public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(VirtualizingWrapPanel), (PropertyMetadata)new FrameworkPropertyMetadata((object)(Orientation)1, (FrameworkPropertyMetadataOptions)1, (PropertyChangedCallback)delegate(DependencyObject obj, DependencyPropertyChangedEventArgs args)
		{
			((VirtualizingWrapPanel)(object)obj).Orientation_Changed();
		}));

		public static readonly DependencyProperty ItemSizeProperty = DependencyProperty.Register("ItemSize", typeof(Size), typeof(VirtualizingWrapPanel), (PropertyMetadata)new FrameworkPropertyMetadata((object)Size.Empty, (FrameworkPropertyMetadataOptions)1));

		public static readonly DependencyProperty StretchItemsProperty = DependencyProperty.Register("StretchItems", typeof(bool), typeof(VirtualizingWrapPanel), (PropertyMetadata)new FrameworkPropertyMetadata((object)false, (FrameworkPropertyMetadataOptions)2));

		protected Size childSize;

		protected int rowCount;

		protected int itemsPerRowCount;

		[Obsolete("Use IsSpacingEnabled")]
		public bool SpacingEnabled
		{
			get
			{
				return IsSpacingEnabled;
			}
			set
			{
				IsSpacingEnabled = value;
			}
		}

		[Obsolete("Use SpacingMode")]
		public bool IsSpacingEnabled
		{
			get
			{
				return (bool)((DependencyObject)this).GetValue(IsSpacingEnabledProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(IsSpacingEnabledProperty, (object)value);
			}
		}

		[Obsolete("Use ItemSize")]
		public Size ChildrenSize
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return ItemSize;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				ItemSize = value;
			}
		}

		public SpacingMode SpacingMode
		{
			get
			{
				return (SpacingMode)((DependencyObject)this).GetValue(SpacingModeProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(SpacingModeProperty, (object)value);
			}
		}

		public Orientation Orientation
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return (Orientation)((DependencyObject)this).GetValue(OrientationProperty);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((DependencyObject)this).SetValue(OrientationProperty, (object)value);
			}
		}

		public Size ItemSize
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return (Size)((DependencyObject)this).GetValue(ItemSizeProperty);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((DependencyObject)this).SetValue(ItemSizeProperty, (object)value);
			}
		}

		public bool StretchItems
		{
			get
			{
				return (bool)((DependencyObject)this).GetValue(StretchItemsProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(StretchItemsProperty, (object)value);
			}
		}

		private void Orientation_Changed()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			base.MouseWheelScrollDirection = (((int)Orientation != 1) ? ScrollDirection.Horizontal : ScrollDirection.Vertical);
		}

		protected override Size MeasureOverride(Size availableSize)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			UpdateChildSize(availableSize);
			return base.MeasureOverride(availableSize);
		}

		private void UpdateChildSize(Size availableSize)
		{
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Invalid comparison between Unknown and I4
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			DependencyObject itemsOwner = base.ItemsOwner;
			IHierarchicalVirtualizationAndScrollInfo val = (IHierarchicalVirtualizationAndScrollInfo)(object)((itemsOwner is IHierarchicalVirtualizationAndScrollInfo) ? itemsOwner : null);
			if (val != null && VirtualizingPanel.GetIsVirtualizingWhenGrouping((DependencyObject)(object)base.ItemsControl))
			{
				HierarchicalVirtualizationConstraints constraints;
				Rect viewport;
				Size size;
				Thickness margin;
				if ((int)Orientation == 1)
				{
					constraints = val.Constraints;
					viewport = ((HierarchicalVirtualizationConstraints)(ref constraints)).Viewport;
					size = ((Rect)(ref viewport)).Size;
					((Size)(ref availableSize)).Width = ((Size)(ref size)).Width;
					double width = ((Size)(ref availableSize)).Width;
					margin = ((FrameworkElement)this).Margin;
					double left = ((Thickness)(ref margin)).Left;
					margin = ((FrameworkElement)this).Margin;
					((Size)(ref availableSize)).Width = Math.Max(width - (left + ((Thickness)(ref margin)).Right), 0.0);
				}
				else
				{
					constraints = val.Constraints;
					viewport = ((HierarchicalVirtualizationConstraints)(ref constraints)).Viewport;
					size = ((Rect)(ref viewport)).Size;
					((Size)(ref availableSize)).Height = ((Size)(ref size)).Height;
					double height = ((Size)(ref availableSize)).Height;
					margin = ((FrameworkElement)this).Margin;
					double top = ((Thickness)(ref margin)).Top;
					margin = ((FrameworkElement)this).Margin;
					((Size)(ref availableSize)).Height = Math.Max(height - (top + ((Thickness)(ref margin)).Bottom), 0.0);
				}
			}
			if (ItemSize != Size.Empty)
			{
				childSize = ItemSize;
			}
			else if (((Panel)this).InternalChildren.Count != 0)
			{
				childSize = ((Panel)this).InternalChildren[0].DesiredSize;
			}
			else
			{
				childSize = CalculateChildSize(availableSize);
			}
			if (double.IsInfinity(GetWidth(availableSize)))
			{
				itemsPerRowCount = base.Items.Count;
			}
			else
			{
				itemsPerRowCount = Math.Max(1, (int)Math.Floor(GetWidth(availableSize) / GetWidth(childSize)));
			}
			rowCount = (int)Math.Ceiling((double)base.Items.Count / (double)itemsPerRowCount);
		}

		private Size CalculateChildSize(Size availableSize)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			if (base.Items.Count == 0)
			{
				return new Size(0.0, 0.0);
			}
			GeneratorPosition val = ((IItemContainerGenerator)base.ItemContainerGenerator).GeneratorPositionFromIndex(0);
			using (((IItemContainerGenerator)base.ItemContainerGenerator).StartAt(val, (GeneratorDirection)0, true))
			{
				UIElement val2 = (UIElement)((IItemContainerGenerator)base.ItemContainerGenerator).GenerateNext();
				((VirtualizingPanel)this).AddInternalChild(val2);
				((IItemContainerGenerator)base.ItemContainerGenerator).PrepareItemContainer((DependencyObject)(object)val2);
				val2.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
				return val2.DesiredSize;
			}
		}

		protected override Size CalculateExtent(Size availableSize)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			double num = ((IsSpacingEnabled && SpacingMode != 0 && !double.IsInfinity(GetWidth(availableSize))) ? GetWidth(availableSize) : (GetWidth(childSize) * (double)itemsPerRowCount));
			if (base.ItemsOwner is IHierarchicalVirtualizationAndScrollInfo)
			{
				Thickness margin;
				if ((int)Orientation == 1)
				{
					double num2 = num;
					margin = ((FrameworkElement)this).Margin;
					double left = ((Thickness)(ref margin)).Left;
					margin = ((FrameworkElement)this).Margin;
					num = Math.Max(num2 - (left + ((Thickness)(ref margin)).Right), 0.0);
				}
				else
				{
					double num3 = num;
					margin = ((FrameworkElement)this).Margin;
					double top = ((Thickness)(ref margin)).Top;
					margin = ((FrameworkElement)this).Margin;
					num = Math.Max(num3 - (top + ((Thickness)(ref margin)).Bottom), 0.0);
				}
			}
			double height = GetHeight(childSize) * (double)rowCount;
			return CreateSize(num, height);
		}

		protected void CalculateSpacing(Size finalSize, out double innerSpacing, out double outerSpacing)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Size size = CalculateChildArrangeSize(finalSize);
			double width = GetWidth(finalSize);
			double num = Math.Min(GetWidth(size) * (double)itemsPerRowCount, width);
			double num2 = width - num;
			switch (IsSpacingEnabled ? SpacingMode : SpacingMode.None)
			{
			case SpacingMode.Uniform:
				innerSpacing = (outerSpacing = num2 / (double)(itemsPerRowCount + 1));
				break;
			case SpacingMode.BetweenItemsOnly:
				innerSpacing = num2 / (double)Math.Max(itemsPerRowCount - 1, 1);
				outerSpacing = 0.0;
				break;
			case SpacingMode.StartAndEndOnly:
				innerSpacing = 0.0;
				outerSpacing = num2 / 2.0;
				break;
			default:
				innerSpacing = 0.0;
				outerSpacing = 0.0;
				break;
			}
		}

		protected override Size ArrangeOverride(Size finalSize)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			double x = GetX(base.Offset);
			double num = GetY(base.Offset);
			if (base.ItemsOwner is IHierarchicalVirtualizationAndScrollInfo)
			{
				num = 0.0;
			}
			Size size = CalculateChildArrangeSize(finalSize);
			CalculateSpacing(finalSize, out var innerSpacing, out var outerSpacing);
			for (int i = 0; i < ((Panel)this).InternalChildren.Count; i++)
			{
				UIElement val = ((Panel)this).InternalChildren[i];
				int itemIndexFromChildIndex = GetItemIndexFromChildIndex(i);
				int num2 = itemIndexFromChildIndex % itemsPerRowCount;
				int num3 = itemIndexFromChildIndex / itemsPerRowCount;
				double num4 = outerSpacing + (double)num2 * (GetWidth(size) + innerSpacing);
				double num5 = (double)num3 * GetHeight(size);
				if (GetHeight(finalSize) == 0.0)
				{
					val.Arrange(new Rect(0.0, 0.0, 0.0, 0.0));
				}
				else
				{
					val.Arrange(CreateRect(num4 - x, num5 - num, ((Size)(ref size)).Width, ((Size)(ref size)).Height));
				}
			}
			return finalSize;
		}

		protected Size CalculateChildArrangeSize(Size finalSize)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (StretchItems)
			{
				if ((int)Orientation == 1)
				{
					double val = ReadItemContainerStyle(FrameworkElement.MaxWidthProperty, double.PositiveInfinity);
					return new Size(Math.Min(((Size)(ref finalSize)).Width / (double)itemsPerRowCount, val), ((Size)(ref childSize)).Height);
				}
				double val2 = ReadItemContainerStyle(FrameworkElement.MaxHeightProperty, double.PositiveInfinity);
				double num = Math.Min(((Size)(ref finalSize)).Height / (double)itemsPerRowCount, val2);
				return new Size(((Size)(ref childSize)).Width, num);
			}
			return childSize;
		}

		private T ReadItemContainerStyle<T>(DependencyProperty property, T fallbackValue) where T : notnull
		{
			DependencyProperty property2 = property;
			Style itemContainerStyle = base.ItemsControl.ItemContainerStyle;
			object obj;
			if (itemContainerStyle == null)
			{
				obj = null;
			}
			else
			{
				Setter? obj2 = ((IEnumerable)itemContainerStyle.Setters).OfType<Setter>().FirstOrDefault((Func<Setter, bool>)((Setter setter) => setter.Property == property2));
				obj = ((obj2 != null) ? obj2.Value : null);
			}
			if (obj == null)
			{
				obj = fallbackValue;
			}
			return (T)obj;
		}

		protected override ItemRange UpdateItemRange()
		{
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Invalid comparison between Unknown and I4
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Invalid comparison between Unknown and I4
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Invalid comparison between Unknown and I4
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Invalid comparison between Unknown and I4
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			if (!base.IsVirtualizing)
			{
				return new ItemRange(0, base.Items.Count - 1);
			}
			DependencyObject itemsOwner = base.ItemsOwner;
			IHierarchicalVirtualizationAndScrollInfo val = (IHierarchicalVirtualizationAndScrollInfo)(object)((itemsOwner is IHierarchicalVirtualizationAndScrollInfo) ? itemsOwner : null);
			int num5;
			int num6;
			VirtualizationCacheLength cacheLength;
			if (val != null)
			{
				if (!VirtualizingPanel.GetIsVirtualizingWhenGrouping((DependencyObject)(object)base.ItemsControl))
				{
					return new ItemRange(0, base.Items.Count - 1);
				}
				Point val2 = base.Offset;
				double x = ((Point)(ref val2)).X;
				HierarchicalVirtualizationConstraints constraints = val.Constraints;
				Rect viewport = ((HierarchicalVirtualizationConstraints)(ref constraints)).Viewport;
				val2 = ((Rect)(ref viewport)).Location;
				Point point = default(Point);
				((Point)(ref point))..ctor(x, ((Point)(ref val2)).Y);
				int num;
				double num2;
				if ((int)base.ScrollUnit == 1)
				{
					num = ((GetY(point) >= 1.0) ? ((int)GetY(point) - 1) : 0);
					num2 = (double)num * GetHeight(childSize);
				}
				else
				{
					double y = GetY(point);
					HierarchicalVirtualizationHeaderDesiredSizes headerDesiredSizes = val.HeaderDesiredSizes;
					num2 = Math.Min(Math.Max(y - GetHeight(((HierarchicalVirtualizationHeaderDesiredSizes)(ref headerDesiredSizes)).PixelSize), 0.0), GetHeight(base.Extent));
					num = GetRowIndex(num2);
				}
				double num3 = Math.Min(GetHeight(base.Viewport), Math.Max(GetHeight(base.Extent) - num2, 0.0));
				int num4 = (int)Math.Ceiling((num2 + num3) / GetHeight(childSize)) - (int)Math.Floor(num2 / GetHeight(childSize));
				num5 = num * itemsPerRowCount;
				num6 = Math.Min((num + num4) * itemsPerRowCount - 1, base.Items.Count - 1);
				if ((int)base.CacheLengthUnit == 0)
				{
					cacheLength = base.CacheLength;
					double num7 = Math.Min(((VirtualizationCacheLength)(ref cacheLength)).CacheBeforeViewport, num2);
					cacheLength = base.CacheLength;
					double num8 = Math.Min(((VirtualizationCacheLength)(ref cacheLength)).CacheAfterViewport, GetHeight(base.Extent) - num3 - num2);
					int num9 = (int)(num7 / GetHeight(childSize));
					int num10 = (int)Math.Ceiling((num2 + num3 + num8) / GetHeight(childSize)) - (int)Math.Ceiling((num2 + num3) / GetHeight(childSize));
					num5 = Math.Max(num5 - num9 * itemsPerRowCount, 0);
					num6 = Math.Min(num6 + num10 * itemsPerRowCount, base.Items.Count - 1);
				}
				else if ((int)base.CacheLengthUnit == 1)
				{
					int num11 = num5;
					cacheLength = base.CacheLength;
					num5 = Math.Max(num11 - (int)((VirtualizationCacheLength)(ref cacheLength)).CacheBeforeViewport, 0);
					int num12 = num6;
					cacheLength = base.CacheLength;
					num6 = Math.Min(num12 + (int)((VirtualizationCacheLength)(ref cacheLength)).CacheAfterViewport, base.Items.Count - 1);
				}
			}
			else
			{
				double num13 = GetY(base.Offset);
				double num14 = GetY(base.Offset) + GetHeight(base.Viewport);
				if ((int)base.CacheLengthUnit == 0)
				{
					double num15 = num13;
					cacheLength = base.CacheLength;
					num13 = Math.Max(num15 - ((VirtualizationCacheLength)(ref cacheLength)).CacheBeforeViewport, 0.0);
					double num16 = num14;
					cacheLength = base.CacheLength;
					num14 = Math.Min(num16 + ((VirtualizationCacheLength)(ref cacheLength)).CacheAfterViewport, GetHeight(base.Extent));
				}
				num5 = GetRowIndex(num13) * itemsPerRowCount;
				num6 = Math.Min(GetRowIndex(num14) * itemsPerRowCount + (itemsPerRowCount - 1), base.Items.Count - 1);
				if ((int)base.CacheLengthUnit == 2)
				{
					int num17 = num6 - num5 + 1;
					int num18 = num5;
					cacheLength = base.CacheLength;
					num5 = Math.Max(num18 - (int)((VirtualizationCacheLength)(ref cacheLength)).CacheBeforeViewport * num17, 0);
					int num19 = num6;
					cacheLength = base.CacheLength;
					num6 = Math.Min(num19 + (int)((VirtualizationCacheLength)(ref cacheLength)).CacheAfterViewport * num17, base.Items.Count - 1);
				}
				else if ((int)base.CacheLengthUnit == 1)
				{
					int num20 = num5;
					cacheLength = base.CacheLength;
					num5 = Math.Max(num20 - (int)((VirtualizationCacheLength)(ref cacheLength)).CacheBeforeViewport, 0);
					int num21 = num6;
					cacheLength = base.CacheLength;
					num6 = Math.Min(num21 + (int)((VirtualizationCacheLength)(ref cacheLength)).CacheAfterViewport, base.Items.Count - 1);
				}
			}
			return new ItemRange(num5, num6);
		}

		private int GetRowIndex(double location)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			int val = (int)Math.Floor(location / GetHeight(childSize));
			int val2 = (int)Math.Ceiling((double)base.Items.Count / (double)itemsPerRowCount);
			return Math.Max(Math.Min(val, val2), 0);
		}

		protected override void BringIndexIntoView(int index)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (index < 0 || index >= base.Items.Count)
			{
				throw new ArgumentOutOfRangeException("index", "The argument index must be >= 0 and < the number of items.");
			}
			if (itemsPerRowCount == 0)
			{
				throw new InvalidOperationException();
			}
			double num = (double)(index / itemsPerRowCount) * GetHeight(childSize);
			if ((int)Orientation == 0)
			{
				SetHorizontalOffset(num);
			}
			else
			{
				SetVerticalOffset(num);
			}
		}

		protected override double GetLineUpScrollAmount()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			double val = ((Size)(ref childSize)).Height * base.ScrollLineDeltaItem;
			Size viewport = base.Viewport;
			return 0.0 - Math.Min(val, ((Size)(ref viewport)).Height);
		}

		protected override double GetLineDownScrollAmount()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			double val = ((Size)(ref childSize)).Height * base.ScrollLineDeltaItem;
			Size viewport = base.Viewport;
			return Math.Min(val, ((Size)(ref viewport)).Height);
		}

		protected override double GetLineLeftScrollAmount()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			double val = ((Size)(ref childSize)).Width * base.ScrollLineDeltaItem;
			Size viewport = base.Viewport;
			return 0.0 - Math.Min(val, ((Size)(ref viewport)).Width);
		}

		protected override double GetLineRightScrollAmount()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			double val = ((Size)(ref childSize)).Width * base.ScrollLineDeltaItem;
			Size viewport = base.Viewport;
			return Math.Min(val, ((Size)(ref viewport)).Width);
		}

		protected override double GetMouseWheelUpScrollAmount()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			double val = ((Size)(ref childSize)).Height * (double)base.MouseWheelDeltaItem;
			Size viewport = base.Viewport;
			return 0.0 - Math.Min(val, ((Size)(ref viewport)).Height);
		}

		protected override double GetMouseWheelDownScrollAmount()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			double val = ((Size)(ref childSize)).Height * (double)base.MouseWheelDeltaItem;
			Size viewport = base.Viewport;
			return Math.Min(val, ((Size)(ref viewport)).Height);
		}

		protected override double GetMouseWheelLeftScrollAmount()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			double val = ((Size)(ref childSize)).Width * (double)base.MouseWheelDeltaItem;
			Size viewport = base.Viewport;
			return 0.0 - Math.Min(val, ((Size)(ref viewport)).Width);
		}

		protected override double GetMouseWheelRightScrollAmount()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			double val = ((Size)(ref childSize)).Width * (double)base.MouseWheelDeltaItem;
			Size viewport = base.Viewport;
			return Math.Min(val, ((Size)(ref viewport)).Width);
		}

		protected override double GetPageUpScrollAmount()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Size viewport = base.Viewport;
			return 0.0 - ((Size)(ref viewport)).Height;
		}

		protected override double GetPageDownScrollAmount()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Size viewport = base.Viewport;
			return ((Size)(ref viewport)).Height;
		}

		protected override double GetPageLeftScrollAmount()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Size viewport = base.Viewport;
			return 0.0 - ((Size)(ref viewport)).Width;
		}

		protected override double GetPageRightScrollAmount()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Size viewport = base.Viewport;
			return ((Size)(ref viewport)).Width;
		}

		protected double GetX(Point point)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)Orientation != 1)
			{
				return ((Point)(ref point)).Y;
			}
			return ((Point)(ref point)).X;
		}

		protected double GetY(Point point)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)Orientation != 1)
			{
				return ((Point)(ref point)).X;
			}
			return ((Point)(ref point)).Y;
		}

		protected double GetWidth(Size size)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)Orientation != 1)
			{
				return ((Size)(ref size)).Height;
			}
			return ((Size)(ref size)).Width;
		}

		protected double GetHeight(Size size)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)Orientation != 1)
			{
				return ((Size)(ref size)).Width;
			}
			return ((Size)(ref size)).Height;
		}

		protected Size CreateSize(double width, double height)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if ((int)Orientation != 1)
			{
				return new Size(height, width);
			}
			return new Size(width, height);
		}

		protected Rect CreateRect(double x, double y, double width, double height)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if ((int)Orientation != 1)
			{
				return new Rect(y, x, width, height);
			}
			return new Rect(x, y, width, height);
		}
	}
	public class VirtualizingWrapPanelWithItemExpansion : VirtualizingWrapPanel
	{
		public static readonly DependencyProperty ExpandedItemTemplateProperty = DependencyProperty.Register("ExpandedItemTemplate", typeof(DataTemplate), typeof(VirtualizingWrapPanelWithItemExpansion), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)1));

		public static readonly DependencyProperty ExpandedItemProperty = DependencyProperty.Register("ExpandedItem", typeof(object), typeof(VirtualizingWrapPanelWithItemExpansion), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)1, (PropertyChangedCallback)delegate(DependencyObject o, DependencyPropertyChangedEventArgs a)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((VirtualizingWrapPanelWithItemExpansion)(object)o).ExpandedItemPropertyChanged(a);
		}));

		private FrameworkElement? expandedItemChild;

		private int itemIndexFollwingExpansion;

		public DataTemplate? ExpandedItemTemplate
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (DataTemplate)((DependencyObject)this).GetValue(ExpandedItemTemplateProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(ExpandedItemTemplateProperty, (object)value);
			}
		}

		public object? ExpandedItem
		{
			get
			{
				return ((DependencyObject)this).GetValue(ExpandedItemProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(ExpandedItemProperty, value);
			}
		}

		private int ExpandedItemIndex => base.Items.IndexOf(ExpandedItem);

		private void ExpandedItemPropertyChanged(DependencyPropertyChangedEventArgs args)
		{
			if (((DependencyPropertyChangedEventArgs)(ref args)).OldValue != null)
			{
				int num = ((Panel)this).InternalChildren.IndexOf((UIElement)(object)expandedItemChild);
				if (num != -1)
				{
					expandedItemChild = null;
					((VirtualizingPanel)this).RemoveInternalChildRange(num, 1);
				}
			}
		}

		protected override Size CalculateExtent(Size availableSize)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Size result = base.CalculateExtent(availableSize);
			if (expandedItemChild != null)
			{
				Size desiredSize;
				if ((int)base.Orientation == 1)
				{
					double height = ((Size)(ref result)).Height;
					desiredSize = ((UIElement)expandedItemChild).DesiredSize;
					((Size)(ref result)).Height = height + ((Size)(ref desiredSize)).Height;
				}
				else
				{
					double width = ((Size)(ref result)).Width;
					desiredSize = ((UIElement)expandedItemChild).DesiredSize;
					((Size)(ref result)).Width = width + ((Size)(ref desiredSize)).Width;
				}
			}
			return result;
		}

		protected override Size ArrangeOverride(Size finalSize)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Invalid comparison between Unknown and I4
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			double num = 0.0;
			Size size = CalculateChildArrangeSize(finalSize);
			CalculateSpacing(finalSize, out var innerSpacing, out var outerSpacing);
			for (int i = 0; i < ((Panel)this).InternalChildren.Count; i++)
			{
				UIElement val = ((Panel)this).InternalChildren[i];
				if (val == expandedItemChild)
				{
					int num2 = ExpandedItemIndex / itemsPerRowCount + 1;
					double num3 = outerSpacing;
					double num4 = (double)num2 * GetHeight(size);
					double num5 = GetWidth(finalSize) - 2.0 * outerSpacing;
					double height = GetHeight(((UIElement)expandedItemChild).DesiredSize);
					if (!base.IsSpacingEnabled || base.SpacingMode == SpacingMode.None)
					{
						num5 = (double)itemsPerRowCount * GetWidth(size);
					}
					if ((int)base.Orientation == 1)
					{
						((UIElement)expandedItemChild).Arrange(CreateRect(num3 - GetX(base.Offset), num4 - GetY(base.Offset), num5, height));
					}
					else
					{
						((UIElement)expandedItemChild).Arrange(CreateRect(num3 - GetX(base.Offset), num4 - GetY(base.Offset), height, num5));
					}
					num = height;
				}
				else
				{
					int itemIndexFromChildIndex = GetItemIndexFromChildIndex(i);
					int num6 = itemIndexFromChildIndex % itemsPerRowCount;
					int num7 = itemIndexFromChildIndex / itemsPerRowCount;
					double num8 = outerSpacing + (double)num6 * (GetWidth(size) + innerSpacing);
					double num9 = (double)num7 * GetHeight(size) + num;
					val.Arrange(CreateRect(num8 - GetX(base.Offset), num9 - GetY(base.Offset), ((Size)(ref size)).Width, ((Size)(ref size)).Height));
				}
			}
			return finalSize;
		}

		protected override void RealizeItems()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			GeneratorPosition val = ((IItemContainerGenerator)base.ItemContainerGenerator).GeneratorPositionFromIndex(base.ItemRange.StartIndex);
			int num = ((((GeneratorPosition)(ref val)).Offset == 0) ? ((GeneratorPosition)(ref val)).Index : (((GeneratorPosition)(ref val)).Index + 1));
			int num2 = base.Items.IndexOf(ExpandedItem);
			int val2 = ((num2 != -1) ? ((num2 / itemsPerRowCount + 1) * itemsPerRowCount - 1) : (-1));
			val2 = Math.Min(val2, base.Items.Count - 1);
			if (val2 != itemIndexFollwingExpansion && expandedItemChild != null)
			{
				((VirtualizingPanel)this).RemoveInternalChildRange(((Panel)this).InternalChildren.IndexOf((UIElement)(object)expandedItemChild), 1);
				expandedItemChild = null;
			}
			using (((IItemContainerGenerator)base.ItemContainerGenerator).StartAt(val, (GeneratorDirection)0, true))
			{
				int num3 = base.ItemRange.StartIndex;
				bool flag = default(bool);
				while (num3 <= base.ItemRange.EndIndex)
				{
					FrameworkElement val3 = (FrameworkElement)((IItemContainerGenerator)base.ItemContainerGenerator).GenerateNext(ref flag);
					if (flag || !((Panel)this).InternalChildren.Contains((UIElement)(object)val3))
					{
						if (num >= ((Panel)this).InternalChildren.Count)
						{
							((VirtualizingPanel)this).AddInternalChild((UIElement)(object)val3);
						}
						else
						{
							((VirtualizingPanel)this).InsertInternalChild(num, (UIElement)(object)val3);
						}
						((IItemContainerGenerator)base.ItemContainerGenerator).PrepareItemContainer((DependencyObject)(object)val3);
						if (base.ItemSize == Size.Empty)
						{
							((UIElement)val3).Measure(CreateSize(GetWidth(base.Viewport), double.MaxValue));
						}
						else
						{
							((UIElement)val3).Measure(base.ItemSize);
						}
					}
					if (num3 == val2 && ExpandedItemTemplate != null)
					{
						if (expandedItemChild == null)
						{
							expandedItemChild = (FrameworkElement)((FrameworkTemplate)ExpandedItemTemplate).LoadContent();
							expandedItemChild.DataContext = base.Items[num2];
							((UIElement)expandedItemChild).Measure(CreateSize(GetWidth(base.Viewport), double.MaxValue));
						}
						if (!((Panel)this).InternalChildren.Contains((UIElement)(object)expandedItemChild))
						{
							num++;
							if (num >= ((Panel)this).InternalChildren.Count)
							{
								((VirtualizingPanel)this).AddInternalChild((UIElement)(object)expandedItemChild);
							}
							else
							{
								((VirtualizingPanel)this).InsertInternalChild(num, (UIElement)(object)expandedItemChild);
							}
						}
					}
					num3++;
					num++;
				}
				itemIndexFollwingExpansion = val2;
			}
		}

		protected override void OnClearChildren()
		{
			((VirtualizingPanel)this).OnClearChildren();
			expandedItemChild = null;
		}

		protected override GeneratorPosition GetGeneratorPositionFromChildIndex(int childIndex)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			int num = ((Panel)this).InternalChildren.IndexOf

WatsonWebsocket.dll

Decompiled 5 months ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Net.WebSockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Joel Christner")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("(c)2023 Joel Christner")]
[assembly: AssemblyDescription("WatsonWebsocket is the EASIEST and FASTEST way to build client and server applications that rely on messaging using websockets.  It's.  Really.  Easy.")]
[assembly: AssemblyFileVersion("4.0.9.0")]
[assembly: AssemblyInformationalVersion("4.0.9")]
[assembly: AssemblyProduct("WatsonWebsocket")]
[assembly: AssemblyTitle("WatsonWebsocket")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/jchristn/WatsonWebsocket")]
[assembly: AssemblyVersion("4.0.9.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace WatsonWebsocket
{
	public class ClientMetadata
	{
		internal HttpListenerContext HttpContext;

		internal WebSocket Ws;

		internal WebSocketContext WsContext;

		internal readonly CancellationTokenSource TokenSource;

		internal readonly SemaphoreSlim SendLock = new SemaphoreSlim(1);

		public Guid Guid { get; } = Guid.NewGuid();


		public string IpPort => Ip + ":" + Port;

		public string Ip { get; }

		public int Port { get; }

		public string Name { get; set; }

		public object Metadata { get; set; }

		public ClientMetadata(HttpListenerContext httpContext, WebSocket ws, WebSocketContext wsContext, CancellationTokenSource tokenSource)
		{
			HttpContext = httpContext ?? throw new ArgumentNullException("httpContext");
			Ws = ws ?? throw new ArgumentNullException("ws");
			WsContext = wsContext ?? throw new ArgumentNullException("wsContext");
			TokenSource = tokenSource ?? throw new ArgumentNullException("tokenSource");
			Ip = HttpContext.Request.RemoteEndPoint.Address.ToString();
			Port = HttpContext.Request.RemoteEndPoint.Port;
		}

		public override string ToString()
		{
			string text = "[";
			text = text + Guid.ToString() + "|" + IpPort;
			if (!string.IsNullOrEmpty(Name))
			{
				text = text + "|" + Name;
			}
			return text + "]";
		}
	}
	public class ConnectionEventArgs : EventArgs
	{
		public ClientMetadata Client { get; }

		public HttpListenerRequest HttpRequest { get; }

		internal ConnectionEventArgs(ClientMetadata client, HttpListenerRequest http)
		{
			Client = client;
			HttpRequest = http;
		}
	}
	public class DisconnectionEventArgs : EventArgs
	{
		public ClientMetadata Client { get; }

		internal DisconnectionEventArgs(ClientMetadata client)
		{
			Client = client;
		}
	}
	public class MessageReceivedEventArgs : EventArgs
	{
		public WebSocketMessageType MessageType = WebSocketMessageType.Binary;

		public ClientMetadata Client { get; }

		public ArraySegment<byte> Data { get; }

		internal MessageReceivedEventArgs(ClientMetadata client, ArraySegment<byte> data, WebSocketMessageType messageType)
		{
			Client = client;
			Data = data;
			MessageType = messageType;
		}
	}
	public class Statistics
	{
		private DateTime _StartTime = DateTime.Now.ToUniversalTime();

		private long _ReceivedBytes;

		private long _ReceivedMessages;

		private long _SentBytes;

		private long _SentMessages;

		public DateTime StartTime => _StartTime;

		public TimeSpan UpTime => DateTime.Now.ToUniversalTime() - _StartTime;

		public long ReceivedBytes => _ReceivedBytes;

		public long ReceivedMessages => _ReceivedMessages;

		public int ReceivedMessageSizeAverage
		{
			get
			{
				if (_ReceivedBytes > 0 && _ReceivedMessages > 0)
				{
					return (int)(_ReceivedBytes / _ReceivedMessages);
				}
				return 0;
			}
		}

		public long SentBytes => _SentBytes;

		public long SentMessages => _SentMessages;

		public decimal SentMessageSizeAverage
		{
			get
			{
				if (_SentBytes > 0 && _SentMessages > 0)
				{
					return (int)(_SentBytes / _SentMessages);
				}
				return 0m;
			}
		}

		public override string ToString()
		{
			return "--- Statistics ---" + Environment.NewLine + "    Started     : " + _StartTime.ToString() + Environment.NewLine + "    Uptime      : " + UpTime.ToString() + Environment.NewLine + "    Received    : " + Environment.NewLine + "       Bytes    : " + ReceivedBytes + Environment.NewLine + "       Messages : " + ReceivedMessages + Environment.NewLine + "       Average  : " + ReceivedMessageSizeAverage + " bytes" + Environment.NewLine + "    Sent        : " + Environment.NewLine + "       Bytes    : " + SentBytes + Environment.NewLine + "       Messages : " + SentMessages + Environment.NewLine + "       Average  : " + SentMessageSizeAverage + " bytes" + Environment.NewLine;
		}

		public void Reset()
		{
			_ReceivedBytes = 0L;
			_ReceivedMessages = 0L;
			_SentBytes = 0L;
			_SentMessages = 0L;
		}

		internal void IncrementReceivedMessages()
		{
			_ReceivedMessages = Interlocked.Increment(ref _ReceivedMessages);
		}

		internal void IncrementSentMessages()
		{
			_SentMessages = Interlocked.Increment(ref _SentMessages);
		}

		internal void AddReceivedBytes(long bytes)
		{
			_ReceivedBytes = Interlocked.Add(ref _ReceivedBytes, bytes);
		}

		internal void AddSentBytes(long bytes)
		{
			_SentBytes = Interlocked.Add(ref _SentBytes, bytes);
		}
	}
	public class WatsonWsClient : IDisposable
	{
		public Action<string> Logger;

		private string _Header = "[WatsonWsClient] ";

		private bool _AcceptInvalidCertificates = true;

		private Uri _ServerUri;

		private string _ServerIp;

		private int _ServerPort;

		private string _ServerIpPort;

		private string _Url;

		private int _KeepAliveIntervalSeconds = 30;

		private ClientWebSocket _ClientWs;

		private CookieContainer _Cookies = new CookieContainer();

		private Action<ClientWebSocketOptions> _PreConfigureOptions;

		private readonly SemaphoreSlim _SendLock = new SemaphoreSlim(1);

		private readonly SemaphoreSlim _AwaitingSyncResposeLock = new SemaphoreSlim(1);

		private CancellationTokenSource _TokenSource = new CancellationTokenSource();

		private CancellationToken _Token;

		private Statistics _Stats = new Statistics();

		private readonly bool _IsBrowser = RuntimeInformation.RuntimeIdentifier == "browser-wasm";

		public bool AcceptInvalidCertificates
		{
			get
			{
				return _AcceptInvalidCertificates;
			}
			set
			{
				_AcceptInvalidCertificates = value;
			}
		}

		public bool Connected
		{
			get
			{
				if (_ClientWs != null && _ClientWs.State == WebSocketState.Open)
				{
					return true;
				}
				return false;
			}
		}

		public bool EnableStatistics { get; set; } = true;


		[UnsupportedOSPlatform("browser")]
		public int KeepAliveInterval
		{
			get
			{
				if (_IsBrowser)
				{
					throw new PlatformNotSupportedException();
				}
				return _KeepAliveIntervalSeconds;
			}
			set
			{
				if (_IsBrowser)
				{
					throw new PlatformNotSupportedException();
				}
				if (value < 1)
				{
					throw new ArgumentException("ConnectTimeoutSeconds must be greater than zero.");
				}
				_KeepAliveIntervalSeconds = value;
			}
		}

		public Statistics Stats => _Stats;

		public event EventHandler<MessageReceivedEventArgs> MessageReceived;

		public event EventHandler ServerConnected;

		public event EventHandler ServerDisconnected;

		private event EventHandler<MessageReceivedEventArgs> _AwaitingSyncResponseEvent;

		public WatsonWsClient(string serverIp, int serverPort, bool ssl)
		{
			if (string.IsNullOrEmpty(serverIp))
			{
				throw new ArgumentNullException("serverIp");
			}
			if (serverPort < 1)
			{
				throw new ArgumentOutOfRangeException("serverPort");
			}
			_ServerIp = serverIp;
			_ServerPort = serverPort;
			_ServerIpPort = serverIp + ":" + serverPort;
			if (ssl)
			{
				_Url = "wss://" + _ServerIp + ":" + _ServerPort;
			}
			else
			{
				_Url = "ws://" + _ServerIp + ":" + _ServerPort;
			}
			_ServerUri = new Uri(_Url);
			_Token = _TokenSource.Token;
			_ClientWs = new ClientWebSocket();
		}

		public WatsonWsClient(Uri uri)
		{
			_ServerUri = uri;
			_ServerIp = uri.Host;
			_ServerPort = uri.Port;
			_ServerIpPort = uri.Host + ":" + uri.Port;
			_Token = _TokenSource.Token;
			_ClientWs = new ClientWebSocket();
		}

		public void Dispose()
		{
			Dispose(disposing: true);
			GC.SuppressFinalize(this);
		}

		[UnsupportedOSPlatform("browser")]
		public WatsonWsClient ConfigureOptions(Action<ClientWebSocketOptions> options)
		{
			if (_IsBrowser)
			{
				throw new PlatformNotSupportedException();
			}
			if (!Connected)
			{
				_PreConfigureOptions = options;
			}
			return this;
		}

		[UnsupportedOSPlatform("browser")]
		public void AddCookie(Cookie cookie)
		{
			if (_IsBrowser)
			{
				throw new PlatformNotSupportedException();
			}
			_Cookies.Add(cookie);
		}

		public void Start()
		{
			_Stats = new Statistics();
			if (_AcceptInvalidCertificates)
			{
				SetInvalidCertificateAcceptance();
			}
			if (!_IsBrowser)
			{
				_ClientWs.Options.Cookies = _Cookies;
				_ClientWs.Options.KeepAliveInterval = TimeSpan.FromSeconds(_KeepAliveIntervalSeconds);
				if (_PreConfigureOptions != null)
				{
					_PreConfigureOptions(_ClientWs.Options);
				}
			}
			_ClientWs.ConnectAsync(_ServerUri, _Token).ContinueWith(AfterConnect).Wait();
		}

		public Task StartAsync()
		{
			_Stats = new Statistics();
			if (_AcceptInvalidCertificates)
			{
				SetInvalidCertificateAcceptance();
			}
			if (!_IsBrowser)
			{
				_ClientWs.Options.Cookies = _Cookies;
				_ClientWs.Options.KeepAliveInterval = TimeSpan.FromSeconds(_KeepAliveIntervalSeconds);
				if (_PreConfigureOptions != null)
				{
					_PreConfigureOptions(_ClientWs.Options);
				}
			}
			return _ClientWs.ConnectAsync(_ServerUri, _Token).ContinueWith(AfterConnect);
		}

		public bool StartWithTimeout(int timeout = 30, CancellationToken token = default(CancellationToken))
		{
			if (timeout < 1)
			{
				throw new ArgumentException("Timeout must be greater than zero seconds.");
			}
			_Stats = new Statistics();
			if (_AcceptInvalidCertificates)
			{
				SetInvalidCertificateAcceptance();
			}
			Stopwatch stopwatch = new Stopwatch();
			TimeSpan timeSpan = TimeSpan.FromSeconds(timeout);
			stopwatch.Start();
			try
			{
				while (stopwatch.Elapsed < timeSpan && !token.IsCancellationRequested)
				{
					_ClientWs = new ClientWebSocket();
					if (!_IsBrowser)
					{
						_ClientWs.Options.Cookies = _Cookies;
						_ClientWs.Options.KeepAliveInterval = TimeSpan.FromSeconds(_KeepAliveIntervalSeconds);
						if (_PreConfigureOptions != null)
						{
							_PreConfigureOptions(_ClientWs.Options);
						}
					}
					try
					{
						_ClientWs.ConnectAsync(_ServerUri, token).ContinueWith(AfterConnect).Wait();
					}
					catch (TaskCanceledException)
					{
						return false;
					}
					catch (OperationCanceledException)
					{
						return false;
					}
					catch (WebSocketException)
					{
					}
					Task.Delay(100).Wait();
					if (_ClientWs.State == WebSocketState.Open)
					{
						return true;
					}
				}
			}
			catch (TaskCanceledException)
			{
			}
			catch (OperationCanceledException)
			{
			}
			return false;
		}

		public async Task<bool> StartWithTimeoutAsync(int timeout = 30, CancellationToken token = default(CancellationToken))
		{
			if (timeout < 1)
			{
				throw new ArgumentException("Timeout must be greater than zero seconds.");
			}
			_Stats = new Statistics();
			if (_AcceptInvalidCertificates)
			{
				SetInvalidCertificateAcceptance();
			}
			Stopwatch sw = new Stopwatch();
			TimeSpan timeOut = TimeSpan.FromSeconds(timeout);
			sw.Start();
			try
			{
				while (sw.Elapsed < timeOut && !token.IsCancellationRequested)
				{
					_ClientWs = new ClientWebSocket();
					if (!_IsBrowser)
					{
						_ClientWs.Options.Cookies = _Cookies;
						_ClientWs.Options.KeepAliveInterval = TimeSpan.FromSeconds(_KeepAliveIntervalSeconds);
						if (_PreConfigureOptions != null)
						{
							_PreConfigureOptions(_ClientWs.Options);
						}
					}
					try
					{
						await _ClientWs.ConnectAsync(_ServerUri, token).ContinueWith(AfterConnect);
					}
					catch (TaskCanceledException)
					{
						return false;
					}
					catch (OperationCanceledException)
					{
						return false;
					}
					catch (WebSocketException)
					{
					}
					await Task.Delay(100);
					if (_ClientWs.State == WebSocketState.Open)
					{
						return true;
					}
				}
			}
			catch (TaskCanceledException)
			{
			}
			catch (OperationCanceledException)
			{
			}
			return false;
		}

		public void Stop()
		{
			Stop(WebSocketCloseStatus.NormalClosure, _ClientWs.CloseStatusDescription);
		}

		public async Task StopAsync()
		{
			await StopAsync(WebSocketCloseStatus.NormalClosure, _ClientWs.CloseStatusDescription);
		}

		public void Stop(WebSocketCloseStatus closeCode, string reason)
		{
			_ClientWs.CloseOutputAsync(closeCode, reason, _Token).Wait();
		}

		public async Task StopAsync(WebSocketCloseStatus closeCode, string reason)
		{
			await _ClientWs.CloseOutputAsync(closeCode, reason, _Token).ConfigureAwait(continueOnCapturedContext: false);
		}

		public async Task<bool> SendAsync(string data, WebSocketMessageType msgType = WebSocketMessageType.Text, CancellationToken token = default(CancellationToken))
		{
			if (string.IsNullOrEmpty(data))
			{
				throw new ArgumentNullException("data");
			}
			return await MessageWriteAsync(new ArraySegment<byte>(Encoding.UTF8.GetBytes(data)), msgType, token);
		}

		public async Task<bool> SendAsync(byte[] data, WebSocketMessageType msgType = WebSocketMessageType.Binary, CancellationToken token = default(CancellationToken))
		{
			return await MessageWriteAsync(new ArraySegment<byte>(data), msgType, token);
		}

		public async Task<bool> SendAsync(ArraySegment<byte> data, WebSocketMessageType msgType = WebSocketMessageType.Binary, CancellationToken token = default(CancellationToken))
		{
			if (data.Array == null || data.Count < 1)
			{
				throw new ArgumentNullException("data");
			}
			return await MessageWriteAsync(data, msgType, token);
		}

		public async Task<string> SendAndWaitAsync(string data, int timeout = 30, CancellationToken token = default(CancellationToken))
		{
			if (string.IsNullOrEmpty(data))
			{
				throw new ArgumentNullException("data");
			}
			if (timeout < 1)
			{
				throw new ArgumentException("Timeout must be greater than zero seconds.", "data");
			}
			string result = null;
			ManualResetEvent receivedEvent = new ManualResetEvent(initialState: false);
			await _AwaitingSyncResposeLock.WaitAsync(_Token);
			await Task.Run(async delegate
			{
				_AwaitingSyncResponseEvent += delegate(object? s, MessageReceivedEventArgs e)
				{
					result = Encoding.UTF8.GetString(e.Data.Array, 0, e.Data.Count);
					receivedEvent.Set();
				};
				await MessageWriteAsync(new ArraySegment<byte>(Encoding.UTF8.GetBytes(data)), WebSocketMessageType.Text, token);
				receivedEvent.WaitOne(TimeSpan.FromSeconds(timeout));
				this._AwaitingSyncResponseEvent = null;
				_AwaitingSyncResposeLock.Release();
			});
			return result;
		}

		public async Task<ArraySegment<byte>> SendAndWaitAsync(byte[] data, int timeout = 30, CancellationToken token = default(CancellationToken))
		{
			return await SendAndWaitAsync(new ArraySegment<byte>(data), timeout, token);
		}

		public async Task<ArraySegment<byte>> SendAndWaitAsync(ArraySegment<byte> data, int timeout = 30, CancellationToken token = default(CancellationToken))
		{
			if (data.Array == null || data.Count < 1)
			{
				throw new ArgumentNullException("data");
			}
			if (timeout < 1)
			{
				throw new ArgumentException("Timeout must be zero or greater.", "data");
			}
			ArraySegment<byte> result = default(ArraySegment<byte>);
			ManualResetEvent receivedEvent = new ManualResetEvent(initialState: false);
			await _AwaitingSyncResposeLock.WaitAsync(_Token);
			await Task.Run(async delegate
			{
				_AwaitingSyncResponseEvent += delegate(object? s, MessageReceivedEventArgs e)
				{
					result = e.Data;
					receivedEvent.Set();
				};
				await MessageWriteAsync(data, WebSocketMessageType.Binary, token);
				receivedEvent.WaitOne(TimeSpan.FromSeconds(timeout));
				this._AwaitingSyncResponseEvent = null;
				_AwaitingSyncResposeLock.Release();
			});
			return result;
		}

		protected virtual void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (_ClientWs != null && _ClientWs.State == WebSocketState.Open)
				{
					Stop();
					_ClientWs.Dispose();
				}
				_TokenSource.Cancel();
				Logger?.Invoke(_Header + "dispose complete");
			}
		}

		private void SetInvalidCertificateAcceptance()
		{
			if (_ClientWs.State == WebSocketState.Open)
			{
				ClientWebSocketOptions options = _ClientWs.Options;
				options.RemoteCertificateValidationCallback = (RemoteCertificateValidationCallback)Delegate.Combine(options.RemoteCertificateValidationCallback, (RemoteCertificateValidationCallback)((object message, X509Certificate? certificate, X509Chain? chain, SslPolicyErrors sslPolicyErrors) => true));
			}
		}

		private void AfterConnect(Task task)
		{
			if (!task.IsCompleted || _ClientWs.State != WebSocketState.Open)
			{
				return;
			}
			Task.Run(delegate
			{
				Task.Run(() => DataReceiver(), _Token);
				this.ServerConnected?.Invoke(this, EventArgs.Empty);
			}, _Token);
		}

		private async Task DataReceiver()
		{
			byte[] buffer = new byte[65536];
			try
			{
				while (!_Token.IsCancellationRequested)
				{
					MessageReceivedEventArgs messageReceivedEventArgs = await MessageReadAsync(buffer);
					if (messageReceivedEventArgs == null)
					{
						continue;
					}
					if (EnableStatistics)
					{
						_Stats.IncrementReceivedMessages();
						_Stats.AddReceivedBytes(messageReceivedEventArgs.Data.Count);
					}
					if (messageReceivedEventArgs.MessageType != WebSocketMessageType.Close)
					{
						if (this._AwaitingSyncResponseEvent != null)
						{
							this._AwaitingSyncResponseEvent?.Invoke(this, messageReceivedEventArgs);
						}
						else
						{
							this.MessageReceived?.Invoke(this, messageReceivedEventArgs);
						}
					}
				}
			}
			catch (OperationCanceledException)
			{
				Logger?.Invoke(_Header + "data receiver canceled");
			}
			catch (WebSocketException)
			{
				Logger?.Invoke(_Header + "websocket disconnected");
			}
			catch (Exception ex3)
			{
				Logger?.Invoke(_Header + "exception: " + Environment.NewLine + ex3.ToString());
			}
			this.ServerDisconnected?.Invoke(this, EventArgs.Empty);
		}

		private async Task<MessageReceivedEventArgs> MessageReadAsync(byte[] buffer)
		{
			if (_ClientWs == null)
			{
				return null;
			}
			ArraySegment<byte> data = default(ArraySegment<byte>);
			WebSocketReceiveResult result = null;
			using (MemoryStream dataMs = new MemoryStream())
			{
				buffer = new byte[buffer.Length];
				ArraySegment<byte> bufferSegment = new ArraySegment<byte>(buffer);
				if (_ClientWs.State == WebSocketState.CloseReceived || _ClientWs.State == WebSocketState.Closed)
				{
					throw new WebSocketException("Websocket close received");
				}
				while (_ClientWs.State == WebSocketState.Open)
				{
					result = await _ClientWs.ReceiveAsync(bufferSegment, _Token);
					if (result.Count > 0)
					{
						await dataMs.WriteAsync(buffer, 0, result.Count);
					}
					if (result.EndOfMessage)
					{
						data = new ArraySegment<byte>(dataMs.GetBuffer(), 0, (int)dataMs.Length);
						break;
					}
				}
			}
			return new MessageReceivedEventArgs(null, data, result.MessageType);
		}

		private async Task<bool> MessageWriteAsync(ArraySegment<byte> data, WebSocketMessageType msgType, CancellationToken token)
		{
			bool disconnectDetected = false;
			using (CancellationTokenSource.CreateLinkedTokenSource(_Token, token))
			{
				_ = 1;
				try
				{
					if (_ClientWs == null || _ClientWs.State != WebSocketState.Open)
					{
						Logger?.Invoke(_Header + "not connected");
						disconnectDetected = true;
						return false;
					}
					await _SendLock.WaitAsync(_Token).ConfigureAwait(continueOnCapturedContext: false);
					try
					{
						await _ClientWs.SendAsync(data, msgType, endOfMessage: true, token).ConfigureAwait(continueOnCapturedContext: false);
					}
					catch
					{
					}
					finally
					{
						_SendLock.Release();
					}
					if (EnableStatistics)
					{
						_Stats.IncrementSentMessages();
						_Stats.AddSentBytes(data.Count);
					}
					return true;
				}
				catch (TaskCanceledException)
				{
					if (_Token.IsCancellationRequested)
					{
						Logger?.Invoke(_Header + "canceled");
						disconnectDetected = true;
					}
					else if (token.IsCancellationRequested)
					{
						Logger?.Invoke(_Header + "message send canceled");
					}
					return false;
				}
				catch (OperationCanceledException)
				{
					if (_Token.IsCancellationRequested)
					{
						Logger?.Invoke(_Header + "canceled");
						disconnectDetected = true;
					}
					else if (token.IsCancellationRequested)
					{
						Logger?.Invoke(_Header + "message send canceled");
					}
					return false;
				}
				catch (WebSocketException)
				{
					Logger?.Invoke(_Header + "websocket disconnected");
					disconnectDetected = true;
					return false;
				}
				catch (ObjectDisposedException)
				{
					Logger?.Invoke(_Header + "disposed");
					disconnectDetected = true;
					return false;
				}
				catch (SocketException)
				{
					Logger?.Invoke(_Header + "socket disconnected");
					disconnectDetected = true;
					return false;
				}
				catch (InvalidOperationException)
				{
					Logger?.Invoke(_Header + "disconnected due to invalid operation");
					disconnectDetected = true;
					return false;
				}
				catch (IOException)
				{
					Logger?.Invoke(_Header + "IO disconnected");
					disconnectDetected = true;
					return false;
				}
				catch (Exception ex8)
				{
					Logger?.Invoke(_Header + "exception: " + Environment.NewLine + ex8.ToString());
					disconnectDetected = true;
					return false;
				}
				finally
				{
					if (disconnectDetected)
					{
						Dispose();
						this.ServerDisconnected?.Invoke(this, EventArgs.Empty);
					}
				}
			}
		}
	}
	public class WatsonWsServer : IDisposable
	{
		public List<string> PermittedIpAddresses = new List<string>();

		public Action<string> Logger;

		public Action<HttpListenerContext> HttpHandler;

		private string _Header = "[WatsonWsServer] ";

		private bool _AcceptInvalidCertificates = true;

		private List<string> _ListenerPrefixes = new List<string>();

		private HttpListener _Listener;

		private readonly object _PermittedIpsLock = new object();

		private ConcurrentDictionary<Guid, ClientMetadata> _Clients = new ConcurrentDictionary<Guid, ClientMetadata>();

		private CancellationTokenSource _TokenSource = new CancellationTokenSource();

		private CancellationToken _Token;

		private Task _AcceptConnectionsTask;

		private Statistics _Stats = new Statistics();

		public bool IsListening
		{
			get
			{
				if (_Listener != null)
				{
					return _Listener.IsListening;
				}
				return false;
			}
		}

		public bool EnableStatistics { get; set; } = true;


		public bool AcceptInvalidCertificates
		{
			get
			{
				return _AcceptInvalidCertificates;
			}
			set
			{
				_AcceptInvalidCertificates = value;
			}
		}

		public Statistics Stats => _Stats;

		public event EventHandler<ConnectionEventArgs> ClientConnected;

		public event EventHandler<DisconnectionEventArgs> ClientDisconnected;

		public event EventHandler ServerStopped;

		public event EventHandler<MessageReceivedEventArgs> MessageReceived;

		public WatsonWsServer(string hostname = "localhost", int port = 9000, bool ssl = false)
		{
			if (port < 0)
			{
				throw new ArgumentOutOfRangeException("port");
			}
			if (string.IsNullOrEmpty(hostname))
			{
				hostname = "localhost";
			}
			if (ssl)
			{
				_ListenerPrefixes.Add("https://" + hostname + ":" + port + "/");
			}
			else
			{
				_ListenerPrefixes.Add("http://" + hostname + ":" + port + "/");
			}
			_Listener = new HttpListener();
			foreach (string listenerPrefix in _ListenerPrefixes)
			{
				_Listener.Prefixes.Add(listenerPrefix);
			}
			_Token = _TokenSource.Token;
		}

		public WatsonWsServer(List<string> hostnames, int port, bool ssl = false)
		{
			if (port < 0)
			{
				throw new ArgumentOutOfRangeException("port");
			}
			if (hostnames == null)
			{
				throw new ArgumentNullException("hostnames");
			}
			if (hostnames.Count < 1)
			{
				throw new ArgumentException("At least one hostname must be supplied.");
			}
			foreach (string hostname in hostnames)
			{
				if (ssl)
				{
					_ListenerPrefixes.Add("https://" + hostname + ":" + port + "/");
				}
				else
				{
					_ListenerPrefixes.Add("http://" + hostname + ":" + port + "/");
				}
			}
			_Listener = new HttpListener();
			foreach (string listenerPrefix in _ListenerPrefixes)
			{
				_Listener.Prefixes.Add(listenerPrefix);
			}
			_Token = _TokenSource.Token;
		}

		public WatsonWsServer(Uri uri)
		{
			if (uri == null)
			{
				throw new ArgumentNullException("uri");
			}
			if (uri.Port < 0)
			{
				throw new ArgumentException("Port must be zero or greater.");
			}
			string host;
			if (!IPAddress.TryParse(uri.Host, out IPAddress _))
			{
				IPHostEntry hostEntry = Dns.GetHostEntry(uri.Host);
				if (hostEntry.AddressList.Length == 0)
				{
					throw new ArgumentException("Cannot resolve address to IP.");
				}
				host = hostEntry.AddressList.First().ToString();
			}
			else
			{
				host = uri.Host;
			}
			UriBuilder uriBuilder = new UriBuilder(uri)
			{
				Host = host
			};
			_ListenerPrefixes.Add(uriBuilder.ToString());
			_Listener = new HttpListener();
			foreach (string listenerPrefix in _ListenerPrefixes)
			{
				_Listener.Prefixes.Add(listenerPrefix);
			}
			_Token = _TokenSource.Token;
		}

		public void Dispose()
		{
			Dispose(disposing: true);
		}

		public void Start()
		{
			if (IsListening)
			{
				throw new InvalidOperationException("Watson websocket server is already running.");
			}
			_Stats = new Statistics();
			string text = _Header + "starting on:";
			foreach (string listenerPrefix in _ListenerPrefixes)
			{
				text = text + " " + listenerPrefix;
			}
			Logger?.Invoke(text);
			if (_AcceptInvalidCertificates)
			{
				SetInvalidCertificateAcceptance();
			}
			_TokenSource = new CancellationTokenSource();
			_Token = _TokenSource.Token;
			_Listener.Start();
			_AcceptConnectionsTask = Task.Run(() => AcceptConnections(_Token), _Token);
		}

		public Task StartAsync(CancellationToken token = default(CancellationToken))
		{
			if (IsListening)
			{
				throw new InvalidOperationException("Watson websocket server is already running.");
			}
			_Stats = new Statistics();
			string text = _Header + "starting on:";
			foreach (string listenerPrefix in _ListenerPrefixes)
			{
				text = text + " " + listenerPrefix;
			}
			Logger?.Invoke(text);
			if (_AcceptInvalidCertificates)
			{
				SetInvalidCertificateAcceptance();
			}
			_TokenSource = CancellationTokenSource.CreateLinkedTokenSource(token);
			_Token = token;
			_Listener.Start();
			_AcceptConnectionsTask = Task.Run(() => AcceptConnections(_Token), _Token);
			return Task.Delay(1);
		}

		public void Stop()
		{
			if (!IsListening)
			{
				throw new InvalidOperationException("Watson websocket server is not running.");
			}
			Logger?.Invoke(_Header + "stopping");
			_Listener.Stop();
		}

		public Task<bool> SendAsync(Guid guid, string data, WebSocketMessageType msgType = WebSocketMessageType.Text, CancellationToken token = default(CancellationToken))
		{
			if (string.IsNullOrEmpty(data))
			{
				data = "";
			}
			return SendAsync(guid, Encoding.UTF8.GetBytes(data), msgType, token);
		}

		public Task<bool> SendAsync(Guid guid, byte[] data, WebSocketMessageType msgType = WebSocketMessageType.Binary, CancellationToken token = default(CancellationToken))
		{
			if (data == null)
			{
				data = new byte[0];
			}
			return SendAsync(guid, new ArraySegment<byte>(data), msgType, token);
		}

		public Task<bool> SendAsync(Guid guid, ArraySegment<byte> data, WebSocketMessageType msgType = WebSocketMessageType.Binary, CancellationToken token = default(CancellationToken))
		{
			if (data.Array == null || data.Count < 1)
			{
				throw new ArgumentNullException("data");
			}
			if (!_Clients.TryGetValue(guid, out var value))
			{
				Logger?.Invoke(_Header + "unable to find client " + guid);
				return Task.FromResult(result: false);
			}
			Task<bool> result = MessageWriteAsync(value, data, msgType, token);
			value = null;
			return result;
		}

		public bool IsClientConnected(Guid guid)
		{
			return _Clients.Any((KeyValuePair<Guid, ClientMetadata> c) => c.Key.Equals(guid));
		}

		public IEnumerable<ClientMetadata> ListClients()
		{
			return _Clients.Values;
		}

		public void DisconnectClient(Guid guid)
		{
			if (_Clients.TryGetValue(guid, out var value))
			{
				lock (value)
				{
					value.Ws.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "", value.TokenSource.Token).Wait();
					value.TokenSource.Cancel();
					value.Ws.Dispose();
				}
			}
		}

		public TaskAwaiter GetAwaiter()
		{
			return _AcceptConnectionsTask.GetAwaiter();
		}

		protected virtual void Dispose(bool disposing)
		{
			if (!disposing)
			{
				return;
			}
			if (_Clients != null)
			{
				foreach (KeyValuePair<Guid, ClientMetadata> client in _Clients)
				{
					client.Value.Ws.CloseAsync(WebSocketCloseStatus.NormalClosure, "", client.Value.TokenSource.Token);
					client.Value.TokenSource.Cancel();
				}
			}
			if (_Listener != null)
			{
				if (_Listener.IsListening)
				{
					_Listener.Stop();
				}
				_Listener.Close();
			}
			_TokenSource.Cancel();
		}

		private void SetInvalidCertificateAcceptance()
		{
			ServicePointManager.ServerCertificateValidationCallback = (RemoteCertificateValidationCallback)Delegate.Combine(ServicePointManager.ServerCertificateValidationCallback, (RemoteCertificateValidationCallback)((object sender, X509Certificate? certificate, X509Chain? chain, SslPolicyErrors sslPolicyErrors) => true));
		}

		private async Task AcceptConnections(CancellationToken cancelToken)
		{
			bool exiting = false;
			while (!cancelToken.IsCancellationRequested)
			{
				try
				{
					if (!_Listener.IsListening)
					{
						Task.Delay(100).Wait();
						continue;
					}
					HttpListenerContext ctx = await _Listener.GetContextAsync().ConfigureAwait(continueOnCapturedContext: false);
					string text = ctx.Request.RemoteEndPoint.Address.ToString();
					string ipPort = text + ":" + ctx.Request.RemoteEndPoint.Port;
					lock (_PermittedIpsLock)
					{
						if (PermittedIpAddresses != null && PermittedIpAddresses.Count > 0 && !PermittedIpAddresses.Contains(text))
						{
							Logger?.Invoke(_Header + "rejecting " + ipPort + " (not permitted)");
							ctx.Response.StatusCode = 401;
							ctx.Response.Close();
							continue;
						}
					}
					if (ctx.Request.IsWebSocketRequest)
					{
						await Task.Run(delegate
						{
							Logger?.Invoke(_Header + "starting data receiver for " + ipPort);
							CancellationTokenSource tokenSource = new CancellationTokenSource();
							CancellationToken token = tokenSource.Token;
							Task.Run(async delegate
							{
								WebSocketContext webSocketContext = await ctx.AcceptWebSocketAsync(null);
								WebSocket webSocket = webSocketContext.WebSocket;
								ClientMetadata md = new ClientMetadata(ctx, webSocket, webSocketContext, tokenSource);
								_Clients.TryAdd(md.Guid, md);
								this.ClientConnected?.Invoke(this, new ConnectionEventArgs(md, ctx.Request));
								await Task.Run(() => DataReceiver(md), token);
							}, token);
						}, _Token).ConfigureAwait(continueOnCapturedContext: false);
					}
					else if (HttpHandler == null)
					{
						Logger?.Invoke(_Header + "non-websocket request rejected from " + ipPort);
						ctx.Response.StatusCode = 400;
						ctx.Response.Close();
					}
					else
					{
						Logger?.Invoke(_Header + "non-websocket request from " + ipPort + " HTTP-forwarded: " + ctx.Request.HttpMethod.ToString() + " " + ctx.Request.RawUrl);
						HttpHandler(ctx);
					}
				}
				catch (TaskCanceledException)
				{
					exiting = true;
					break;
				}
				catch (OperationCanceledException)
				{
					exiting = true;
					break;
				}
				catch (ObjectDisposedException)
				{
					exiting = true;
					break;
				}
				catch (HttpListenerException)
				{
					exiting = true;
					break;
				}
				catch (Exception ex5)
				{
					Logger?.Invoke(_Header + "listener exception:" + Environment.NewLine + ex5.ToString());
				}
				finally
				{
					if (exiting)
					{
						Logger?.Invoke(_Header + "listener stopped");
						this.ServerStopped?.Invoke(this, EventArgs.Empty);
					}
				}
			}
		}

		private async Task DataReceiver(ClientMetadata client)
		{
			string header = "[WatsonWsServer " + client.Guid.ToString() + "] ";
			Logger?.Invoke(header + "starting data receiver");
			byte[] buffer = new byte[65536];
			try
			{
				while (true)
				{
					MessageReceivedEventArgs msg = await MessageReadAsync(client, buffer).ConfigureAwait(continueOnCapturedContext: false);
					if (msg == null)
					{
						continue;
					}
					if (EnableStatistics)
					{
						_Stats.IncrementReceivedMessages();
						_Stats.AddReceivedBytes(msg.Data.Count);
					}
					if (msg.Data != null)
					{
						Task.Run(delegate
						{
							this.MessageReceived?.Invoke(this, msg);
						}, client.TokenSource.Token);
					}
					else
					{
						await Task.Delay(10).ConfigureAwait(continueOnCapturedContext: false);
					}
				}
			}
			catch (TaskCanceledException)
			{
			}
			catch (OperationCanceledException)
			{
			}
			catch (WebSocketException)
			{
			}
			catch (Exception ex4)
			{
				Logger?.Invoke(header + "exception: " + Environment.NewLine + ex4.ToString());
			}
			finally
			{
				_Clients.TryRemove(client.Guid, out var _);
				_ = client.IpPort;
				this.ClientDisconnected?.Invoke(this, new DisconnectionEventArgs(client));
				client.Ws.Dispose();
				Logger?.Invoke(header + "disconnected");
			}
		}

		private async Task<MessageReceivedEventArgs> MessageReadAsync(ClientMetadata client, byte[] buffer)
		{
			string header = "[WatsonWsServer " + client.Guid.ToString() + "] ";
			using MemoryStream ms = new MemoryStream();
			ArraySegment<byte> seg = new ArraySegment<byte>(buffer);
			WebSocketReceiveResult webSocketReceiveResult;
			do
			{
				webSocketReceiveResult = await client.Ws.ReceiveAsync(seg, client.TokenSource.Token).ConfigureAwait(continueOnCapturedContext: false);
				if (webSocketReceiveResult.CloseStatus.HasValue)
				{
					Logger?.Invoke(header + "close received");
					await client.Ws.CloseAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None);
					throw new WebSocketException("Websocket closed.");
				}
				if (client.Ws.State != WebSocketState.Open)
				{
					Logger?.Invoke(header + "websocket no longer open");
					throw new WebSocketException("Websocket closed.");
				}
				if (client.TokenSource.Token.IsCancellationRequested)
				{
					Logger?.Invoke(header + "cancel requested");
				}
				if (webSocketReceiveResult.Count > 0)
				{
					ms.Write(buffer, 0, webSocketReceiveResult.Count);
				}
			}
			while (!webSocketReceiveResult.EndOfMessage);
			return new MessageReceivedEventArgs(client, new ArraySegment<byte>(ms.GetBuffer(), 0, (int)ms.Length), webSocketReceiveResult.MessageType);
		}

		private async Task<bool> MessageWriteAsync(ClientMetadata md, ArraySegment<byte> data, WebSocketMessageType msgType, CancellationToken token)
		{
			string header = "[WatsonWsServer " + md.IpPort + "] ";
			using (CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(_Token, token, md.TokenSource.Token))
			{
				_ = 1;
				try
				{
					await md.SendLock.WaitAsync(md.TokenSource.Token).ConfigureAwait(continueOnCapturedContext: false);
					try
					{
						await md.Ws.SendAsync(data, msgType, endOfMessage: true, linkedCts.Token).ConfigureAwait(continueOnCapturedContext: false);
					}
					finally
					{
						md.SendLock.Release();
					}
					if (EnableStatistics)
					{
						_Stats.IncrementSentMessages();
						_Stats.AddSentBytes(data.Count);
					}
					return true;
				}
				catch (TaskCanceledException)
				{
					if (_Token.IsCancellationRequested)
					{
						Logger?.Invoke(header + "server canceled");
					}
					else if (token.IsCancellationRequested)
					{
						Logger?.Invoke(header + "message send canceled");
					}
					else if (md.TokenSource.Token.IsCancellationRequested)
					{
						Logger?.Invoke(header + "client canceled");
					}
				}
				catch (OperationCanceledException)
				{
					if (_Token.IsCancellationRequested)
					{
						Logger?.Invoke(header + "canceled");
					}
					else if (token.IsCancellationRequested)
					{
						Logger?.Invoke(header + "message send canceled");
					}
					else if (md.TokenSource.Token.IsCancellationRequested)
					{
						Logger?.Invoke(header + "client canceled");
					}
				}
				catch (ObjectDisposedException)
				{
					Logger?.Invoke(header + "disposed");
				}
				catch (WebSocketException)
				{
					Logger?.Invoke(header + "websocket disconnected");
				}
				catch (SocketException)
				{
					Logger?.Invoke(header + "socket disconnected");
				}
				catch (InvalidOperationException)
				{
					Logger?.Invoke(header + "disconnected due to invalid operation");
				}
				catch (IOException)
				{
					Logger?.Invoke(header + "IO disconnected");
				}
				catch (Exception ex8)
				{
					Logger?.Invoke(header + "exception: " + Environment.NewLine + ex8.ToString());
				}
				finally
				{
					md = null;
				}
			}
			return false;
		}
	}
}

ZoomControl.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: ThemeInfo(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ZoomControl")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+91a5dd6e2295d7b1047f4efc60a29b5ee578016a")]
[assembly: AssemblyProduct("ZoomControl")]
[assembly: AssemblyTitle("ZoomControl")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ZoomControl
{
	public class EqualityToBooleanConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return object.Equals(value, parameter);
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if ((bool)value)
			{
				return parameter;
			}
			return Binding.DoNothing;
		}
	}
	public class ZoomContentPresenter : ContentPresenter
	{
		public delegate void ContentSizeChangedHandler(object sender, Size newSize);

		private Size _contentSize;

		public Size ContentSize
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return _contentSize;
			}
			private set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				if (!(value == _contentSize))
				{
					_contentSize = value;
					this.ContentSizeChanged?.Invoke(this, _contentSize);
				}
			}
		}

		public event ContentSizeChangedHandler? ContentSizeChanged;

		protected override Size MeasureOverride(Size constraint)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			((ContentPresenter)this).MeasureOverride(new Size(double.PositiveInfinity, double.PositiveInfinity));
			double num = (double.IsInfinity(((Size)(ref constraint)).Width) ? 1000000000.0 : ((Size)(ref constraint)).Width);
			double num2 = (double.IsInfinity(((Size)(ref constraint)).Height) ? 1000000000.0 : ((Size)(ref constraint)).Height);
			return new Size(num, num2);
		}

		protected override Size ArrangeOverride(Size arrangeBounds)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			object content = ((ContentPresenter)this).Content;
			UIElement val = (UIElement)((content is UIElement) ? content : null);
			if (val == null)
			{
				return arrangeBounds;
			}
			ContentSize = val.DesiredSize;
			val.Arrange(new Rect(val.DesiredSize));
			return arrangeBounds;
		}
	}
	[TemplatePart(Name = "PART_Presenter", Type = typeof(ZoomContentPresenter))]
	public class ZoomControl : ContentControl
	{
		private const string PartPresenter = "PART_Presenter";

		public static readonly DependencyProperty AnimationLengthProperty;

		public static readonly DependencyProperty MaxZoomProperty;

		public static readonly DependencyProperty MinZoomProperty;

		public static readonly DependencyProperty ModeProperty;

		public static readonly DependencyProperty ModifierModeProperty;

		public static readonly DependencyProperty TranslateXProperty;

		public static readonly DependencyProperty TranslateYProperty;

		public static readonly DependencyProperty ZoomProperty;

		private bool _isZooming;

		private bool _mouseCaptured;

		private Point _mouseDownPosition;

		private ZoomContentPresenter? _presenter;

		private ScaleTransform? _scaleTransform;

		private Vector _startTranslate;

		private TransformGroup _transformGroup;

		private TranslateTransform? _translateTransform;

		private int _zoomAnimCount;

		public bool IsPanning { get; private set; }

		public double TranslateX
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(TranslateXProperty);
			}
			set
			{
				((UIElement)this).BeginAnimation(TranslateXProperty, (AnimationTimeline)null);
				((DependencyObject)this).SetValue(TranslateXProperty, (object)value);
			}
		}

		public double TranslateY
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(TranslateYProperty);
			}
			set
			{
				((UIElement)this).BeginAnimation(TranslateYProperty, (AnimationTimeline)null);
				((DependencyObject)this).SetValue(TranslateYProperty, (object)value);
			}
		}

		public TimeSpan AnimationLength
		{
			get
			{
				return (TimeSpan)((DependencyObject)this).GetValue(AnimationLengthProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(AnimationLengthProperty, (object)value);
			}
		}

		public double MinZoom
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(MinZoomProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(MinZoomProperty, (object)value);
			}
		}

		public double MaxZoom
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(MaxZoomProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(MaxZoomProperty, (object)value);
			}
		}

		public double Zoom
		{
			get
			{
				return (double)((DependencyObject)this).GetValue(ZoomProperty);
			}
			set
			{
				if (!(Math.Abs(value - (double)((DependencyObject)this).GetValue(ZoomProperty)) < 1E-05))
				{
					((UIElement)this).BeginAnimation(ZoomProperty, (AnimationTimeline)null);
					((DependencyObject)this).SetValue(ZoomProperty, (object)value);
				}
			}
		}

		private ZoomContentPresenter? Presenter
		{
			get
			{
				return _presenter;
			}
			set
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Expected O, but got Unknown
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Expected O, but got Unknown
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				_presenter = value;
				if (_presenter != null)
				{
					_transformGroup = new TransformGroup();
					_scaleTransform = new ScaleTransform();
					_translateTransform = new TranslateTransform();
					_transformGroup.Children.Add((Transform)(object)_scaleTransform);
					_transformGroup.Children.Add((Transform)(object)_translateTransform);
					((UIElement)_presenter).RenderTransform = (Transform)(object)_transformGroup;
					((UIElement)_presenter).RenderTransformOrigin = new Point(0.5, 0.5);
				}
			}
		}

		public ZoomViewModifierMode ModifierMode
		{
			get
			{
				return (ZoomViewModifierMode)((DependencyObject)this).GetValue(ModifierModeProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(ModifierModeProperty, (object)value);
			}
		}

		public ZoomControlModes Mode
		{
			get
			{
				return (ZoomControlModes)((DependencyObject)this).GetValue(ModeProperty);
			}
			set
			{
				((DependencyObject)this).SetValue(ModeProperty, (object)value);
			}
		}

		static ZoomControl()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_0153: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Expected O, but got Unknown
			//IL_01a1: Expected O, but got Unknown
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Expected O, but got Unknown
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			AnimationLengthProperty = DependencyProperty.Register("AnimationLength", typeof(TimeSpan), typeof(ZoomControl), (PropertyMetadata)new UIPropertyMetadata((object)TimeSpan.FromMilliseconds(500.0)));
			MaxZoomProperty = DependencyProperty.Register("MaxZoom", typeof(double), typeof(ZoomControl), (PropertyMetadata)new UIPropertyMetadata((object)100.0));
			MinZoomProperty = DependencyProperty.Register("MinZoom", typeof(double), typeof(ZoomControl), (PropertyMetadata)new UIPropertyMetadata((object)0.01));
			ModeProperty = DependencyProperty.Register("Mode", typeof(ZoomControlModes), typeof(ZoomControl), (PropertyMetadata)new UIPropertyMetadata((object)ZoomControlModes.Custom, new PropertyChangedCallback(ModePropertyChanged)));
			ModifierModeProperty = DependencyProperty.Register("ModifierMode", typeof(ZoomViewModifierMode), typeof(ZoomControl), (PropertyMetadata)new UIPropertyMetadata((object)ZoomViewModifierMode.None));
			TranslateXProperty = DependencyProperty.Register("TranslateX", typeof(double), typeof(ZoomControl), (PropertyMetadata)new UIPropertyMetadata((object)0.0, new PropertyChangedCallback(TranslateXPropertyChanged), new CoerceValueCallback(TranslateXCoerce)));
			TranslateYProperty = DependencyProperty.Register("TranslateY", typeof(double), typeof(ZoomControl), (PropertyMetadata)new UIPropertyMetadata((object)0.0, new PropertyChangedCallback(TranslateYPropertyChanged), new CoerceValueCallback(TranslateYCoerce)));
			ZoomProperty = DependencyProperty.Register("Zoom", typeof(double), typeof(ZoomControl), (PropertyMetadata)new UIPropertyMetadata((object)1.0, new PropertyChangedCallback(ZoomPropertyChanged)));
			FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(ZoomControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)typeof(ZoomControl)));
		}

		public ZoomControl()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			((UIElement)this).PreviewMouseWheel += new MouseWheelEventHandler(ZoomControlMouseWheel);
			((UIElement)this).PreviewMouseDown += (MouseButtonEventHandler)delegate(object _, MouseButtonEventArgs e)
			{
				OnMouseDown((MouseEventArgs)(object)e, isPreview: true);
			};
			((UIElement)this).MouseDown += (MouseButtonEventHandler)delegate(object _, MouseButtonEventArgs e)
			{
				OnMouseDown((MouseEventArgs)(object)e, isPreview: false);
			};
			((UIElement)this).MouseUp += new MouseButtonEventHandler(ZoomControlMouseUp);
		}

		private static void ModePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			ZoomControl zoomControl = (ZoomControl)(object)d;
			switch ((ZoomControlModes)((DependencyPropertyChangedEventArgs)(ref e)).NewValue)
			{
			case ZoomControlModes.Fill:
				zoomControl.DoZoomToFill();
				break;
			case ZoomControlModes.Original:
				zoomControl.DoZoomToOriginal();
				break;
			default:
				throw new ArgumentOutOfRangeException();
			case ZoomControlModes.Custom:
				break;
			}
		}

		private static object TranslateXCoerce(DependencyObject d, object basevalue)
		{
			return (((ZoomControl)(object)d)._presenter == null) ? 0.0 : ((double)basevalue);
		}

		private static object TranslateYCoerce(DependencyObject d, object basevalue)
		{
			return (((ZoomControl)(object)d)._presenter == null) ? 0.0 : ((double)basevalue);
		}

		private void ZoomControlMouseUp(object sender, MouseButtonEventArgs e)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			if (ModifierMode == ZoomViewModifierMode.Pan)
			{
				ModifierMode = ZoomViewModifierMode.None;
				((UIElement)this).PreviewMouseMove -= new MouseEventHandler(ZoomControlPreviewMouseMove);
				((UIElement)this).ReleaseMouseCapture();
			}
		}

		private void ZoomControlPreviewMouseMove(object sender, MouseEventArgs e)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (ModifierMode == ZoomViewModifierMode.Pan)
			{
				if (!_mouseCaptured)
				{
					Mouse.Capture((IInputElement)(object)this);
					_mouseCaptured = true;
				}
				Vector val = e.GetPosition((IInputElement)(object)this) - _mouseDownPosition;
				Vector val2 = _startTranslate + val;
				TranslateX = ((Vector)(ref val2)).X;
				TranslateY = ((Vector)(ref val2)).Y;
				IsPanning = ((Vector)(ref val)).LengthSquared > 0.1;
			}
		}

		private void OnMouseDown(MouseEventArgs e, bool isPreview)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected I4, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Invalid comparison between Unknown and I4
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			if (ModifierMode != 0)
			{
				return;
			}
			ModifierKeys modifiers = Keyboard.Modifiers;
			switch ((int)modifiers)
			{
			default:
				if ((int)modifiers != 8)
				{
					return;
				}
				break;
			case 0:
				if (!isPreview)
				{
					ModifierMode = ZoomViewModifierMode.Pan;
				}
				break;
			case 4:
				ModifierMode = ZoomViewModifierMode.Pan;
				break;
			case 1:
			case 3:
				return;
			case 2:
				break;
			}
			if (ModifierMode != 0)
			{
				IsPanning = false;
				_mouseDownPosition = e.GetPosition((IInputElement)(object)this);
				_startTranslate = new Vector(TranslateX, TranslateY);
				((UIElement)this).PreviewMouseMove += new MouseEventHandler(ZoomControlPreviewMouseMove);
			}
		}

		private static void TranslateXPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			ZoomControl zoomControl = (ZoomControl)(object)d;
			if (zoomControl._translateTransform != null)
			{
				zoomControl._translateTransform.X = (double)((DependencyPropertyChangedEventArgs)(ref e)).NewValue;
				if (!zoomControl._isZooming)
				{
					zoomControl.Mode = ZoomControlModes.Custom;
				}
			}
		}

		private static void TranslateYPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			ZoomControl zoomControl = (ZoomControl)(object)d;
			if (zoomControl._translateTransform != null)
			{
				zoomControl._translateTransform.Y = (double)((DependencyPropertyChangedEventArgs)(ref e)).NewValue;
				if (!zoomControl._isZooming)
				{
					zoomControl.Mode = ZoomControlModes.Custom;
				}
			}
		}

		private static void ZoomPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			ZoomControl zoomControl = (ZoomControl)(object)d;
			if (zoomControl._scaleTransform != null)
			{
				double num = (double)((DependencyPropertyChangedEventArgs)(ref e)).NewValue;
				zoomControl._scaleTransform.ScaleX = num;
				zoomControl._scaleTransform.ScaleY = num;
				if (!zoomControl._isZooming)
				{
					double num2 = (double)((DependencyPropertyChangedEventArgs)(ref e)).NewValue / (double)((DependencyPropertyChangedEventArgs)(ref e)).OldValue;
					zoomControl.TranslateX *= num2;
					zoomControl.TranslateY *= num2;
					zoomControl.Mode = ZoomControlModes.Custom;
				}
			}
		}

		private void ZoomControlMouseWheel(object sender, MouseWheelEventArgs e)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			((RoutedEventArgs)e).Handled = true;
			Point origoPosition = default(Point);
			((Point)(ref origoPosition))..ctor(((FrameworkElement)this).ActualWidth / 2.0, ((FrameworkElement)this).ActualHeight / 2.0);
			Point position = ((MouseEventArgs)e).GetPosition((IInputElement)(object)this);
			double deltaZoom = Math.Max(0.2, Math.Min(2.0, (double)e.Delta / 300.0 + 1.0));
			DoZoom(deltaZoom, origoPosition, position, position);
		}

		public void ZoomToPos(float targetX, float targetY, int yOffset)
		{
			double zoom = Zoom;
			double transformX = 0.0 - ((double)targetX - ((FrameworkElement)this).ActualWidth / 2.0) * zoom;
			double transformY = 0.0 - ((double)targetY - ((FrameworkElement)this).ActualHeight / 2.0) * zoom + (double)yOffset;
			DoZoomAnimation(Zoom, transformX, transformY);
			Mode = ZoomControlModes.Custom;
		}

		private void DoZoom(double deltaZoom, Point origoPosition, Point startHandlePosition, Point targetHandlePosition)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			double zoom = Zoom;
			double val = zoom * deltaZoom;
			val = Math.Max(MinZoom, Math.Min(MaxZoom, val));
			Vector val2 = default(Vector);
			((Vector)(ref val2))..ctor(TranslateX, TranslateY);
			Vector val3 = startHandlePosition - origoPosition;
			Vector val4 = targetHandlePosition - origoPosition;
			Vector val5 = (val3 - val2) / zoom * val + val2;
			Vector val6 = val4 - val5;
			double transformX = ((_presenter == null) ? 0.0 : (TranslateX + ((Vector)(ref val6)).X));
			double transformY = ((_presenter == null) ? 0.0 : (TranslateY + ((Vector)(ref val6)).Y));
			DoZoomAnimation(val, transformX, transformY);
			Mode = ZoomControlModes.Custom;
		}

		private void DoZoomAnimation(double targetZoom, double transformX, double transformY)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			_isZooming = true;
			Duration duration = default(Duration);
			((Duration)(ref duration))..ctor(AnimationLength);
			StartAnimation(TranslateXProperty, transformX, duration);
			StartAnimation(TranslateYProperty, transformY, duration);
			StartAnimation(ZoomProperty, targetZoom, duration);
		}

		private void StartAnimation(DependencyProperty dp, double toValue, Duration duration)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			if (double.IsNaN(toValue) || double.IsInfinity(toValue))
			{
				if (dp == ZoomProperty)
				{
					_isZooming = false;
				}
				return;
			}
			DoubleAnimation val = new DoubleAnimation(toValue, duration);
			if (dp == ZoomProperty)
			{
				_zoomAnimCount++;
				((Timeline)val).Completed += delegate
				{
					_zoomAnimCount--;
					if (_zoomAnimCount <= 0)
					{
						double zoom = Zoom;
						((UIElement)this).BeginAnimation(ZoomProperty, (AnimationTimeline)null);
						((DependencyObject)this).SetValue(ZoomProperty, (object)zoom);
						_isZooming = false;
					}
				};
			}
			((UIElement)this).BeginAnimation(dp, (AnimationTimeline)(object)val, (HandoffBehavior)1);
		}

		private void DoZoomToOriginal()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (_presenter != null)
			{
				Vector initialTranslate = GetInitialTranslate();
				DoZoomAnimation(1.0, ((Vector)(ref initialTranslate)).X, ((Vector)(ref initialTranslate)).Y);
			}
		}

		private Vector GetInitialTranslate()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (_presenter == null)
			{
				return new Vector(0.0, 0.0);
			}
			Size val = _presenter.ContentSize;
			double width = ((Size)(ref val)).Width;
			val = ((UIElement)_presenter).DesiredSize;
			double num = (0.0 - (width - ((Size)(ref val)).Width)) / 2.0;
			val = _presenter.ContentSize;
			double height = ((Size)(ref val)).Height;
			val = ((UIElement)_presenter).DesiredSize;
			double num2 = (0.0 - (height - ((Size)(ref val)).Height)) / 2.0;
			return new Vector(num, num2);
		}

		public void ZoomToFill()
		{
			Mode = ZoomControlModes.Fill;
		}

		private void DoZoomToFill()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (_presenter != null && Mode == ZoomControlModes.Fill)
			{
				double actualWidth = ((FrameworkElement)this).ActualWidth;
				Size contentSize = _presenter.ContentSize;
				double val = actualWidth / ((Size)(ref contentSize)).Width;
				double actualHeight = ((FrameworkElement)this).ActualHeight;
				contentSize = _presenter.ContentSize;
				double num = Math.Min(val, actualHeight / ((Size)(ref contentSize)).Height);
				Vector initialTranslate = GetInitialTranslate();
				DoZoomAnimation(num, ((Vector)(ref initialTranslate)).X * num, ((Vector)(ref initialTranslate)).Y * num);
			}
		}

		public override void OnApplyTemplate()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			((FrameworkElement)this).OnApplyTemplate();
			Presenter = ((FrameworkElement)this).GetTemplateChild("PART_Presenter") as ZoomContentPresenter;
			if (Presenter != null)
			{
				((FrameworkElement)Presenter).SizeChanged += (SizeChangedEventHandler)delegate
				{
					DoZoomToFill();
				};
				Presenter.ContentSizeChanged += delegate
				{
					DoZoomToFill();
				};
			}
			ZoomToFill();
		}
	}
	public enum ZoomControlModes
	{
		Fill,
		Original,
		Custom
	}
	public enum ZoomViewModifierMode
	{
		None,
		Pan
	}
}