Decompiled source of BepInEx ConfigDrawers v1.0.2

plugins/BepInEx.ConfigDrawers.dll

Decompiled 2 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx.Bootstrap;
using BepInEx.ConfigDrawers.Components;
using BepInEx.ConfigDrawers.Configuration;
using BepInEx.ConfigDrawers.Drawers;
using BepInEx.ConfigDrawers.Drawers.JsonDrawer;
using BepInEx.ConfigDrawers.Drawers.LegacyBridge;
using BepInEx.ConfigDrawers.Drawers.PrimitiveDrawers;
using BepInEx.ConfigDrawers.Drawers.StructuredDrawers;
using BepInEx.ConfigDrawers.Drawers.UguiScope;
using BepInEx.ConfigDrawers.Files;
using BepInEx.ConfigDrawers.Models;
using BepInEx.ConfigDrawers.Patches;
using BepInEx.ConfigDrawers.UI;
using BepInEx.Configuration;
using BepInEx.Logging;
using ConfigurationManager;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.TextCore.LowLevel;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BepInEx.ConfigDrawers")]
[assembly: AssemblyDescription("Next-generation in-game Configuration Manager for Unity BepInEx")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Vapok")]
[assembly: AssemblyProduct("BepInEx.ConfigDrawers")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5E4029F7-70DB-4C5C-BDC3-A882E9437DEB")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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 ConfigurationManager
{
	public class ConfigurationManager : MonoBehaviour
	{
		public static ConfigurationManager? Instance { get; private set; }

		public bool DisplayingWindow
		{
			get
			{
				return ConfigDrawerWindow.Instance?.IsVisible ?? false;
			}
			set
			{
				if ((Object)(object)ConfigDrawerWindow.Instance != (Object)null)
				{
					ConfigDrawerWindow.Instance.SetVisible(value);
				}
			}
		}

		public bool OverrideHotkey { get; set; }

		public int RightColumnWidth => 350;

		public void SetRightColumnWidth(int value)
		{
		}

		private void Awake()
		{
			Instance = this;
		}

		public void BuildSettingList()
		{
			ConfigRegistry.Instance.Refresh();
		}
	}
}
namespace BepInEx.ConfigDrawers
{
	[BepInPlugin("vapok.bepinex.configdrawers", "BepInEx.ConfigDrawers", "1.0.2")]
	public class ConfigDrawers : BaseUnityPlugin
	{
		public const string ModGuid = "vapok.bepinex.configdrawers";

		public const string ModName = "BepInEx.ConfigDrawers";

		public const string ModVersion = "1.0.2";

		public const int NexusId = 3909;

		public static ConfigDrawers? Instance { get; private set; }

		public static ManualLogSource? Log
		{
			get
			{
				ConfigDrawers? instance = Instance;
				if (instance == null)
				{
					return null;
				}
				return ((BaseUnityPlugin)instance).Logger;
			}
		}

		public static bool IsOpen
		{
			get
			{
				if ((Object)(object)Instance != (Object)null && (Object)(object)ConfigDrawerWindow.Instance != (Object)null)
				{
					return ConfigDrawerWindow.Instance.IsVisible;
				}
				return false;
			}
		}

		private void Awake()
		{
			//IL_0016: 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_0046: Expected O, but got Unknown
			Instance = this;
			ConfigDrawerConfig.Initialize(((BaseUnityPlugin)this).Config);
			Harmony val = new Harmony("vapok.bepinex.configdrawers");
			val.PatchAll(typeof(ConfigDrawers).Assembly);
			LegacyManagerSuppressor.CheckAndSuppress(((BaseUnityPlugin)this).Logger);
			DynamicInputBlocker.Initialize(val, ((BaseUnityPlugin)this).Logger);
			UIFonts.GetPrimaryFont();
			InitializeWindow();
			AttachCompatibilityShim();
		}

		private void InitializeWindow()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			Object.DontDestroyOnLoad((Object)new GameObject("ConfigDrawer_Window", new Type[1] { typeof(ConfigDrawerWindow) }));
		}

		private void AttachCompatibilityShim()
		{
			try
			{
				if ((Object)(object)Chainloader.ManagerObject != (Object)null && (Object)(object)Chainloader.ManagerObject.GetComponent<global::ConfigurationManager.ConfigurationManager>() == (Object)null)
				{
					Chainloader.ManagerObject.AddComponent<global::ConfigurationManager.ConfigurationManager>();
				}
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to attach compatibility shim: " + ex.Message));
			}
		}

		private void Update()
		{
			//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)
			if (ConfigDrawerConfig.ToggleKeybind != null)
			{
				KeyboardShortcut value = ConfigDrawerConfig.ToggleKeybind.Value;
				if (((KeyboardShortcut)(ref value)).IsDown())
				{
					ConfigDrawerWindow.Instance?.Toggle();
				}
			}
		}
	}
	public interface IUguiDrawerScope
	{
		Transform Container { get; }

		bool IsReadOnly { get; }

		IDisposable Horizontal(float spacing = 4f);

		IDisposable Vertical(float spacing = 4f);

		IDisposable Box(Color? backgroundColor = null, float padding = 4f, float spacing = 4f);

		IDisposable Row(Color? backgroundColor = null, float padding = 4f, float spacing = 4f);

		void Label(string text, float width = -1f);

		void TextField(string value, Action<string> onCommit, float width = -1f);

		void Button(string text, Action onClick, float width = 50f);

		void Button(string text, Action onClick, float width, string? tooltip);

		void Slider(float value, float min, float max, Action<float> onChanged, float width = 120f, string? format = null);

		void Toggle(bool value, string label, Action<bool> onChanged);

		void Space(float pixels);

		void Separator(float height = 1f, Color? color = null);
	}
}
namespace BepInEx.ConfigDrawers.UI
{
	public class ColorSpectrumPicker : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IDragHandler
	{
		public Action<float, float>? OnPick;

		private RectTransform? _rt;

		private void Awake()
		{
			_rt = ((Component)this).GetComponent<RectTransform>();
		}

		public void OnPointerDown(PointerEventData eventData)
		{
			HandlePointer(eventData);
		}

		public void OnDrag(PointerEventData eventData)
		{
			HandlePointer(eventData);
		}

		private void HandlePointer(PointerEventData eventData)
		{
			//IL_001e: 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_003e: 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)
			Vector2 val = default(Vector2);
			if (!((Object)(object)_rt == (Object)null) && OnPick != null && RectTransformUtility.ScreenPointToLocalPointInRectangle(_rt, eventData.position, eventData.pressEventCamera, ref val))
			{
				Rect rect = _rt.rect;
				float arg = Mathf.Clamp01((val.x - ((Rect)(ref rect)).xMin) / ((Rect)(ref rect)).width);
				float arg2 = Mathf.Clamp01((val.y - ((Rect)(ref rect)).yMin) / ((Rect)(ref rect)).height);
				OnPick(arg, arg2);
			}
		}
	}
	public class CyberDropdownOverlay : MonoBehaviour
	{
		private static GameObject? _currentOverlay;

		public static void Show(RectTransform targetButtonRT, string[] options, int selectedIndex, Action<int> onSelect)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0071: 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_0087: 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_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_00e4: 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)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_0163: 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_0188: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: 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_0242: Expected O, but got Unknown
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: 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_0313: Expected O, but got Unknown
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Expected O, but got Unknown
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f3: Expected O, but got Unknown
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b5: Expected O, but got Unknown
			//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0615: Unknown result type (might be due to invalid IL or missing references)
			//IL_061a: Unknown result type (might be due to invalid IL or missing references)
			//IL_062d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_064a: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			Close();
			if ((Object)(object)targetButtonRT == (Object)null || options == null || options.Length == 0)
			{
				return;
			}
			Canvas componentInParent = ((Component)targetButtonRT).GetComponentInParent<Canvas>();
			if ((Object)(object)componentInParent == (Object)null)
			{
				return;
			}
			GameObject val = new GameObject("DropdownOverlay", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(((Component)componentInParent).transform, false);
			_currentOverlay = val;
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = Vector2.zero;
			component.offsetMax = Vector2.zero;
			GameObject val2 = new GameObject("Blocker", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			val2.transform.SetParent(val.transform, false);
			RectTransform component2 = val2.GetComponent<RectTransform>();
			component2.anchorMin = Vector2.zero;
			component2.anchorMax = Vector2.one;
			component2.offsetMin = Vector2.zero;
			component2.offsetMax = Vector2.zero;
			((Graphic)val2.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.01f);
			((UnityEvent)val2.GetComponent<Button>().onClick).AddListener(new UnityAction(Close));
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			targetButtonRT.GetWorldCorners(array);
			Rect rect = targetButtonRT.rect;
			float num = Mathf.Max(((Rect)(ref rect)).width, 110f);
			GameObject val3 = UiFactory.CreatePanel(val.transform, "PopupCard", CyberPalette.ColorIceBlue, CyberPalette.ColorVoidBlack);
			RectTransform component3 = val3.GetComponent<RectTransform>();
			component3.pivot = new Vector2(1f, 1f);
			((Transform)component3).position = array[2];
			Transform val4 = val3.transform.Find("Fill");
			Transform val5 = (((Object)(object)val4 != (Object)null) ? val4 : val3.transform);
			int num2 = Mathf.Min(options.Length, 8);
			bool flag = options.Length > num2;
			GameObject val6 = new GameObject("ScrollArea", new Type[3]
			{
				typeof(RectTransform),
				typeof(ScrollRect),
				typeof(RectMask2D)
			});
			val6.transform.SetParent(val5, false);
			RectTransform component4 = val6.GetComponent<RectTransform>();
			component4.anchorMin = Vector2.zero;
			component4.anchorMax = Vector2.one;
			component4.offsetMin = new Vector2(2f, 2f);
			component4.offsetMax = (flag ? new Vector2(-10f, -2f) : new Vector2(-2f, -2f));
			ScrollRect component5 = val6.GetComponent<ScrollRect>();
			component5.horizontal = false;
			component5.vertical = flag;
			component5.movementType = (MovementType)2;
			component5.scrollSensitivity = 35f;
			GameObject val7 = new GameObject("Content", new Type[3]
			{
				typeof(RectTransform),
				typeof(VerticalLayoutGroup),
				typeof(ContentSizeFitter)
			});
			val7.transform.SetParent(val6.transform, false);
			RectTransform component6 = val7.GetComponent<RectTransform>();
			component6.anchorMin = new Vector2(0f, 1f);
			component6.anchorMax = new Vector2(1f, 1f);
			component6.pivot = new Vector2(0.5f, 1f);
			component6.sizeDelta = new Vector2(0f, 0f);
			VerticalLayoutGroup component7 = val7.GetComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)component7).spacing = 2f;
			((LayoutGroup)component7).padding = new RectOffset(2, 2, 2, 2);
			((HorizontalOrVerticalLayoutGroup)component7).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)component7).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)component7).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)component7).childForceExpandHeight = false;
			val7.GetComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			component5.content = component6;
			for (int i = 0; i < options.Length; i++)
			{
				int idx = i;
				bool num3 = idx == selectedIndex;
				string labelText = options[idx];
				Color textColor = (num3 ? CyberPalette.ColorGlacialMint : CyberPalette.ColorTextMain);
				Color borderColor = (num3 ? CyberPalette.ColorGlacialMint : CyberPalette.ColorBorderSubtle);
				LayoutElement component8 = UiFactory.CreateCyberButton(val7.transform, $"Item_{idx}", labelText, delegate
				{
					Close();
					onSelect?.Invoke(idx);
				}, borderColor, textColor, num - 6f, 22f).GetComponent<LayoutElement>();
				component8.minHeight = 22f;
				component8.preferredHeight = 22f;
				component8.flexibleHeight = 0f;
				component8.flexibleWidth = 1f;
			}
			if (flag)
			{
				GameObject val8 = new GameObject("Scrollbar", new Type[3]
				{
					typeof(RectTransform),
					typeof(Scrollbar),
					typeof(Image)
				});
				val8.transform.SetParent(val5, false);
				RectTransform component9 = val8.GetComponent<RectTransform>();
				component9.anchorMin = new Vector2(1f, 0f);
				component9.anchorMax = new Vector2(1f, 1f);
				component9.pivot = new Vector2(1f, 0.5f);
				component9.sizeDelta = new Vector2(5f, -4f);
				component9.anchoredPosition = new Vector2(-2f, 0f);
				((Graphic)val8.GetComponent<Image>()).color = new Color(0.02f, 0.05f, 0.08f, 0.8f);
				GameObject val9 = new GameObject("SlidingArea", new Type[1] { typeof(RectTransform) });
				val9.transform.SetParent(val8.transform, false);
				RectTransform component10 = val9.GetComponent<RectTransform>();
				component10.anchorMin = Vector2.zero;
				component10.anchorMax = Vector2.one;
				component10.sizeDelta = Vector2.zero;
				GameObject val10 = new GameObject("Handle", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				val10.transform.SetParent(val9.transform, false);
				RectTransform component11 = val10.GetComponent<RectTransform>();
				component11.sizeDelta = Vector2.zero;
				Image component12 = val10.GetComponent<Image>();
				((Graphic)component12).color = CyberPalette.ColorIceBlue;
				Scrollbar component13 = val8.GetComponent<Scrollbar>();
				component13.handleRect = component11;
				((Selectable)component13).targetGraphic = (Graphic)(object)component12;
				component13.direction = (Direction)2;
				component5.verticalScrollbar = component13;
				component5.verticalScrollbarVisibility = (ScrollbarVisibility)0;
			}
			float num4 = (float)num2 * 24f + 8f;
			float num5 = (flag ? 14f : 8f);
			component3.sizeDelta = new Vector2(num + num5, num4);
			val.AddComponent<CyberDropdownOverlay>();
		}

		public static void Close()
		{
			if ((Object)(object)_currentOverlay != (Object)null)
			{
				Object.Destroy((Object)(object)_currentOverlay);
				_currentOverlay = null;
			}
		}

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)27))
			{
				Close();
			}
		}
	}
	public class CyberHoverHandler : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler
	{
		private Image? _borderImg;

		private Image? _fillImg;

		private TextMeshProUGUI? _text;

		private Color _normalBorder;

		private Color _hoverBorder;

		private Color _pressedBorder;

		private Color _normalFill;

		private Color _hoverFill;

		private Color _pressedFill;

		private Color _normalText;

		private Color _hoverText;

		private Color _pressedText;

		private bool _isHovered;

		private bool _isPressed;

		public void Init(Image borderImg, Color normalBorder, Color hoverBorder, Image? fillImg = null, Color? normalFill = null, Color? hoverFill = null, Color? pressedBorder = null, Color? pressedFill = null, TextMeshProUGUI? text = null, Color? normalText = null, Color? hoverText = null, Color? pressedText = null)
		{
			//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)
			//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_0036: 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_0023: 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_003b: 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_0076: 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)
			//IL_005f: 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_0089: 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_00d7: 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_00ce: 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_010b: 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_0110: 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_0123: 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_014c: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			_borderImg = borderImg;
			_normalBorder = normalBorder;
			_hoverBorder = hoverBorder;
			_pressedBorder = (Color)(((??)pressedBorder) ?? Color.Lerp(hoverBorder, Color.white, 0.45f));
			_fillImg = fillImg;
			_normalFill = (Color)(((??)normalFill) ?? (((Object)(object)fillImg != (Object)null) ? ((Graphic)fillImg).color : Color.clear));
			_hoverFill = (Color)(((??)hoverFill) ?? _normalFill);
			_pressedFill = (Color)(((??)pressedFill) ?? (((Object)(object)fillImg != (Object)null) ? new Color(0.12f, 0.22f, 0.32f, 1f) : Color.clear));
			_text = text;
			if ((Object)(object)text != (Object)null)
			{
				_normalText = (Color)(((??)normalText) ?? ((Graphic)text).color);
				_hoverText = (Color)(((??)hoverText) ?? _normalText);
				_pressedText = (Color)(((??)pressedText) ?? Color.white);
			}
			UpdateVisuals();
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			_isHovered = true;
			UpdateVisuals();
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			_isHovered = false;
			UpdateVisuals();
		}

		public void OnPointerDown(PointerEventData eventData)
		{
			_isPressed = true;
			UpdateVisuals();
		}

		public void OnPointerUp(PointerEventData eventData)
		{
			_isPressed = false;
			UpdateVisuals();
		}

		public void SetNormalColors(Color normalBorder, Color normalText, Color? normalFill = null, Color? hoverBorder = null, Color? hoverText = null, Color? hoverFill = null, Color? pressedBorder = null, Color? pressedText = null, Color? pressedFill = null)
		{
			//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_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)
			//IL_001a: 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_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_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_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_0072: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			_normalBorder = normalBorder;
			_normalText = normalText;
			if (normalFill.HasValue)
			{
				_normalFill = normalFill.Value;
			}
			if (hoverBorder.HasValue)
			{
				_hoverBorder = hoverBorder.Value;
			}
			if (hoverText.HasValue)
			{
				_hoverText = hoverText.Value;
			}
			if (hoverFill.HasValue)
			{
				_hoverFill = hoverFill.Value;
			}
			if (pressedBorder.HasValue)
			{
				_pressedBorder = pressedBorder.Value;
			}
			if (pressedText.HasValue)
			{
				_pressedText = pressedText.Value;
			}
			if (pressedFill.HasValue)
			{
				_pressedFill = pressedFill.Value;
			}
			UpdateVisuals();
		}

		public void UpdateVisuals()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_003c: 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_00a5: 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_0122: 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)
			if (_isPressed)
			{
				if ((Object)(object)_borderImg != (Object)null)
				{
					((Graphic)_borderImg).color = _pressedBorder;
				}
				if ((Object)(object)_fillImg != (Object)null)
				{
					((Graphic)_fillImg).color = _pressedFill;
				}
				if ((Object)(object)_text != (Object)null)
				{
					((Graphic)_text).color = _pressedText;
				}
			}
			else if (_isHovered)
			{
				if ((Object)(object)_borderImg != (Object)null)
				{
					((Graphic)_borderImg).color = _hoverBorder;
				}
				if ((Object)(object)_fillImg != (Object)null)
				{
					((Graphic)_fillImg).color = _hoverFill;
				}
				if ((Object)(object)_text != (Object)null)
				{
					((Graphic)_text).color = _hoverText;
				}
			}
			else
			{
				if ((Object)(object)_borderImg != (Object)null)
				{
					((Graphic)_borderImg).color = _normalBorder;
				}
				if ((Object)(object)_fillImg != (Object)null)
				{
					((Graphic)_fillImg).color = _normalFill;
				}
				if ((Object)(object)_text != (Object)null)
				{
					((Graphic)_text).color = _normalText;
				}
			}
		}
	}
	public static class CyberPalette
	{
		public static readonly Color ColorVoidBlack = new Color(0.024f, 0.035f, 0.055f, 1f);

		public static readonly Color ColorCardSurface = new Color(0.039f, 0.055f, 0.082f, 1f);

		public static readonly Color ColorIceBlue = new Color(0.392f, 0.941f, 0.988f, 1f);

		public static readonly Color ColorIceBlueBright = new Color(0.647f, 0.953f, 0.988f, 1f);

		public static readonly Color ColorCyberTeal = new Color(0.078f, 0.722f, 0.651f, 1f);

		public static readonly Color ColorGlacialMint = new Color(0f, 0.961f, 0.608f, 1f);

		public static readonly Color ColorWarningAmber = new Color(0.984f, 0.749f, 0.141f, 1f);

		public static readonly Color ColorErrorRed = new Color(0.937f, 0.267f, 0.267f, 1f);

		public static readonly Color ColorTextMain = new Color(0.784f, 0.867f, 0.933f, 1f);

		public static readonly Color ColorTextMuted = new Color(0.482f, 0.604f, 0.725f, 1f);

		public static readonly Color ColorBorderSubtle = new Color(0.392f, 0.941f, 0.988f, 0.22f);

		public static readonly Color ColorBorderCard = new Color(0.125f, 0.23f, 0.34f, 0.85f);

		public static readonly Color ColorSeparator = new Color(0.392f, 0.941f, 0.988f, 0.16f);

		public static readonly Color ColorInputGroove = new Color(0.12f, 0.2f, 0.28f, 0.85f);

		public static readonly Color ColorInputWell = new Color(0.008f, 0.012f, 0.018f, 1f);

		public static readonly Color ColorInputAccent = new Color(0.15f, 0.4f, 0.52f, 0.7f);
	}
	public static class IconFactory
	{
		private static Sprite? _syncSprite;

		private static Sprite? _lockSprite;

		private static Sprite? _textPadSprite;

		private static Sprite? _undoSprite;

		private static Sprite? _redoSprite;

		private static Sprite? _formatSprite;

		private static Sprite? _revertSprite;

		private static Sprite? _saveSprite;

		public static Sprite GetSyncIcon()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0054: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_00f0: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_syncSprite != (Object)null)
			{
				return _syncSprite;
			}
			Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)0;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color white = Color.white;
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 16; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			for (int k = 3; k <= 12; k++)
			{
				val.SetPixel(k, 11, white);
			}
			val.SetPixel(11, 12, white);
			val.SetPixel(10, 13, white);
			val.SetPixel(11, 10, white);
			val.SetPixel(10, 9, white);
			for (int l = 3; l <= 12; l++)
			{
				val.SetPixel(l, 4, white);
			}
			val.SetPixel(4, 5, white);
			val.SetPixel(5, 6, white);
			val.SetPixel(4, 3, white);
			val.SetPixel(5, 2, white);
			val.Apply();
			_syncSprite = Sprite.Create(val, new Rect(0f, 0f, 16f, 16f), new Vector2(0.5f, 0.5f));
			return _syncSprite;
		}

		public static Sprite GetLockIcon()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0054: 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_008f: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00c4: 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_010e: 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_0120: 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_014a: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_lockSprite != (Object)null)
			{
				return _lockSprite;
			}
			Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)0;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color white = Color.white;
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 16; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			for (int k = 6; k <= 9; k++)
			{
				val.SetPixel(k, 13, white);
			}
			val.SetPixel(5, 12, white);
			val.SetPixel(10, 12, white);
			val.SetPixel(5, 11, white);
			val.SetPixel(10, 11, white);
			val.SetPixel(5, 10, white);
			val.SetPixel(10, 10, white);
			val.SetPixel(5, 9, white);
			val.SetPixel(10, 9, white);
			for (int l = 2; l <= 8; l++)
			{
				for (int m = 4; m <= 11; m++)
				{
					val.SetPixel(m, l, white);
				}
			}
			val.SetPixel(7, 5, val2);
			val.SetPixel(8, 5, val2);
			val.SetPixel(7, 4, val2);
			val.SetPixel(8, 4, val2);
			val.Apply();
			_lockSprite = Sprite.Create(val, new Rect(0f, 0f, 16f, 16f), new Vector2(0.5f, 0.5f));
			return _lockSprite;
		}

		public static Sprite GetTextPadIcon()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0054: 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_0095: 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_00ba: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_textPadSprite != (Object)null)
			{
				return _textPadSprite;
			}
			Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)0;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color white = Color.white;
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 16; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			for (int k = 6; k <= 9; k++)
			{
				val.SetPixel(k, 14, white);
			}
			for (int l = 3; l <= 12; l++)
			{
				val.SetPixel(l, 13, white);
				val.SetPixel(l, 1, white);
			}
			for (int m = 1; m <= 13; m++)
			{
				val.SetPixel(3, m, white);
				val.SetPixel(12, m, white);
			}
			for (int n = 5; n <= 10; n++)
			{
				val.SetPixel(n, 10, white);
			}
			for (int num = 5; num <= 10; num++)
			{
				val.SetPixel(num, 7, white);
			}
			for (int num2 = 5; num2 <= 8; num2++)
			{
				val.SetPixel(num2, 4, white);
			}
			val.Apply();
			_textPadSprite = Sprite.Create(val, new Rect(0f, 0f, 16f, 16f), new Vector2(0.5f, 0.5f));
			return _textPadSprite;
		}

		public static Sprite GetUndoIcon()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0073: 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_0090: 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_0054: 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_00c4: 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)
			//IL_0117: 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)
			if ((Object)(object)_undoSprite != (Object)null)
			{
				return _undoSprite;
			}
			Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)0;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color white = Color.white;
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 16; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			val.SetPixel(3, 9, white);
			val.SetPixel(4, 10, white);
			val.SetPixel(4, 8, white);
			val.SetPixel(5, 11, white);
			val.SetPixel(5, 7, white);
			for (int k = 5; k <= 10; k++)
			{
				val.SetPixel(k, 9, white);
			}
			for (int l = 5; l <= 10; l++)
			{
				val.SetPixel(l, 8, white);
			}
			for (int m = 5; m <= 8; m++)
			{
				val.SetPixel(11, m, white);
				val.SetPixel(12, m, white);
			}
			val.Apply();
			_undoSprite = Sprite.Create(val, new Rect(0f, 0f, 16f, 16f), new Vector2(0.5f, 0.5f));
			return _undoSprite;
		}

		public static Sprite GetRedoIcon()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0074: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_0054: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_011a: 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)
			if ((Object)(object)_redoSprite != (Object)null)
			{
				return _redoSprite;
			}
			Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)0;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color white = Color.white;
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 16; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			val.SetPixel(12, 9, white);
			val.SetPixel(11, 10, white);
			val.SetPixel(11, 8, white);
			val.SetPixel(10, 11, white);
			val.SetPixel(10, 7, white);
			for (int k = 5; k <= 10; k++)
			{
				val.SetPixel(k, 9, white);
			}
			for (int l = 5; l <= 10; l++)
			{
				val.SetPixel(l, 8, white);
			}
			for (int m = 5; m <= 8; m++)
			{
				val.SetPixel(3, m, white);
				val.SetPixel(4, m, white);
			}
			val.Apply();
			_redoSprite = Sprite.Create(val, new Rect(0f, 0f, 16f, 16f), new Vector2(0.5f, 0.5f));
			return _redoSprite;
		}

		public static Sprite GetFormatIcon()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0073: 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_0087: 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_0099: 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_00ab: 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_00c1: 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_00d6: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_formatSprite != (Object)null)
			{
				return _formatSprite;
			}
			Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)0;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color white = Color.white;
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 16; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			val.SetPixel(5, 12, white);
			val.SetPixel(4, 11, white);
			val.SetPixel(4, 9, white);
			val.SetPixel(3, 8, white);
			val.SetPixel(4, 7, white);
			val.SetPixel(4, 5, white);
			val.SetPixel(5, 4, white);
			val.SetPixel(10, 12, white);
			val.SetPixel(11, 11, white);
			val.SetPixel(11, 9, white);
			val.SetPixel(12, 8, white);
			val.SetPixel(11, 7, white);
			val.SetPixel(11, 5, white);
			val.SetPixel(10, 4, white);
			val.Apply();
			_formatSprite = Sprite.Create(val, new Rect(0f, 0f, 16f, 16f), new Vector2(0.5f, 0.5f));
			return _formatSprite;
		}

		public static Sprite GetRevertIcon()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0073: 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_0087: 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_0054: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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)
			//IL_00f3: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_revertSprite != (Object)null)
			{
				return _revertSprite;
			}
			Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)0;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color white = Color.white;
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 16; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			val.SetPixel(3, 11, white);
			val.SetPixel(4, 12, white);
			val.SetPixel(3, 10, white);
			val.SetPixel(2, 10, white);
			for (int k = 5; k <= 9; k++)
			{
				val.SetPixel(k, 12, white);
			}
			val.SetPixel(10, 11, white);
			val.SetPixel(11, 10, white);
			for (int l = 6; l <= 9; l++)
			{
				val.SetPixel(12, l, white);
			}
			val.SetPixel(11, 5, white);
			val.SetPixel(10, 4, white);
			for (int m = 6; m <= 9; m++)
			{
				val.SetPixel(m, 3, white);
			}
			val.SetPixel(5, 4, white);
			val.SetPixel(4, 5, white);
			val.Apply();
			_revertSprite = Sprite.Create(val, new Rect(0f, 0f, 16f, 16f), new Vector2(0.5f, 0.5f));
			return _revertSprite;
		}

		public static Sprite GetSaveIcon()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0054: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00d6: 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_00fd: 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_011e: 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_0175: 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_013d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_saveSprite != (Object)null)
			{
				return _saveSprite;
			}
			Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)0;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color white = Color.white;
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 16; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			for (int k = 3; k <= 11; k++)
			{
				val.SetPixel(k, 13, white);
			}
			val.SetPixel(12, 12, white);
			for (int l = 2; l <= 11; l++)
			{
				val.SetPixel(12, l, white);
			}
			for (int m = 3; m <= 12; m++)
			{
				val.SetPixel(m, 2, white);
			}
			for (int n = 2; n <= 13; n++)
			{
				val.SetPixel(3, n, white);
			}
			for (int num = 5; num <= 9; num++)
			{
				val.SetPixel(num, 12, white);
				val.SetPixel(num, 11, white);
				val.SetPixel(num, 10, white);
			}
			val.SetPixel(8, 11, val2);
			val.SetPixel(8, 12, val2);
			for (int num2 = 5; num2 <= 10; num2++)
			{
				for (int num3 = 4; num3 <= 7; num3++)
				{
					val.SetPixel(num2, num3, white);
				}
			}
			val.Apply();
			_saveSprite = Sprite.Create(val, new Rect(0f, 0f, 16f, 16f), new Vector2(0.5f, 0.5f));
			return _saveSprite;
		}
	}
	public static class UIExtensions
	{
		public static RectTransform SetAnchor(this RectTransform rectTransform, Vector2 min, Vector2 max)
		{
			//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)
			rectTransform.anchorMin = min;
			rectTransform.anchorMax = max;
			return rectTransform;
		}

		public static RectTransform SetAnchorMin(this RectTransform rectTransform, Vector2 min)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchorMin = min;
			return rectTransform;
		}

		public static RectTransform SetAnchorMax(this RectTransform rectTransform, Vector2 max)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchorMax = max;
			return rectTransform;
		}

		public static RectTransform SetPivot(this RectTransform rectTransform, Vector2 pivot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.pivot = pivot;
			return rectTransform;
		}

		public static RectTransform SetSizeDelta(this RectTransform rectTransform, Vector2 sizeDelta)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.sizeDelta = sizeDelta;
			return rectTransform;
		}

		public static RectTransform SetAnchoredPosition(this RectTransform rectTransform, Vector2 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchoredPosition = position;
			return rectTransform;
		}

		public static RectTransform SetOffsets(this RectTransform rectTransform, Vector2 minOffset, Vector2 maxOffset)
		{
			//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)
			rectTransform.offsetMin = minOffset;
			rectTransform.offsetMax = maxOffset;
			return rectTransform;
		}

		public static CanvasGroup SetAlpha(this CanvasGroup canvasGroup, float alpha)
		{
			canvasGroup.alpha = alpha;
			return canvasGroup;
		}

		public static CanvasGroup SetInteractable(this CanvasGroup canvasGroup, bool interactable)
		{
			canvasGroup.interactable = interactable;
			return canvasGroup;
		}

		public static CanvasGroup SetBlocksRaycasts(this CanvasGroup canvasGroup, bool blocksRaycasts)
		{
			canvasGroup.blocksRaycasts = blocksRaycasts;
			return canvasGroup;
		}

		public static Image SetColor(this Image image, Color color)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)image).color = color;
			return image;
		}

		public static Image SetRaycastTarget(this Image image, bool raycastTarget)
		{
			((Graphic)image).raycastTarget = raycastTarget;
			return image;
		}

		public static LayoutElement SetDimensions(this LayoutElement element, float minWidth, float minHeight, float preferredWidth, float preferredHeight, float flexibleWidth = 0f, float flexibleHeight = 0f)
		{
			element.minWidth = minWidth;
			element.minHeight = minHeight;
			element.preferredWidth = preferredWidth;
			element.preferredHeight = preferredHeight;
			element.flexibleWidth = flexibleWidth;
			element.flexibleHeight = flexibleHeight;
			return element;
		}

		public static LayoutElement SetFixedWidth(this LayoutElement element, float width)
		{
			element.minWidth = width;
			element.preferredWidth = width;
			element.flexibleWidth = 0f;
			return element;
		}

		public static LayoutElement SetFixedHeight(this LayoutElement element, float height)
		{
			element.minHeight = height;
			element.preferredHeight = height;
			element.flexibleHeight = 0f;
			return element;
		}

		public static T SetChildControl<T>(this T layoutGroup, bool width, bool height) where T : HorizontalOrVerticalLayoutGroup
		{
			((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlWidth = width;
			((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlHeight = height;
			return layoutGroup;
		}

		public static T SetChildForceExpand<T>(this T layoutGroup, bool width, bool height) where T : HorizontalOrVerticalLayoutGroup
		{
			((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandWidth = width;
			((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandHeight = height;
			return layoutGroup;
		}

		public static T SetSpacing<T>(this T layoutGroup, float spacing) where T : HorizontalOrVerticalLayoutGroup
		{
			((HorizontalOrVerticalLayoutGroup)layoutGroup).spacing = spacing;
			return layoutGroup;
		}

		public static T SetPadding<T>(this T layoutGroup, int left, int right, int top, int bottom) where T : LayoutGroup
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			((LayoutGroup)layoutGroup).padding = new RectOffset(left, right, top, bottom);
			return layoutGroup;
		}

		public static T SetChildAlignment<T>(this T layoutGroup, TextAnchor alignment) where T : LayoutGroup
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((LayoutGroup)layoutGroup).childAlignment = alignment;
			return layoutGroup;
		}

		public static ContentSizeFitter SetHorizontalFit(this ContentSizeFitter fitter, FitMode fitMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			fitter.horizontalFit = fitMode;
			return fitter;
		}

		public static ContentSizeFitter SetVerticalFit(this ContentSizeFitter fitter, FitMode fitMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			fitter.verticalFit = fitMode;
			return fitter;
		}
	}
	public static class UiFactory
	{
		public static float GetFontScaleFactor()
		{
			return ConfigDrawerConfig.UiFontSize?.Value switch
			{
				FontSizeScale.Small => 0.85f, 
				FontSizeScale.Large => 1.08f, 
				_ => 0.95f, 
			};
		}

		public static float GetScaledFontSize(float baseSize)
		{
			return Mathf.Round(baseSize * GetFontScaleFactor());
		}

		public static TMP_FontAsset? ResolveFont()
		{
			return UIFonts.GetPrimaryFont();
		}

		public static TMP_FontAsset? ResolveTerminalFont()
		{
			return UIFonts.GetTerminalFont();
		}

		public static void RefreshAllFonts(GameObject root)
		{
			UIFonts.RefreshAllFonts(root);
		}

		public static GameObject CreatePanel(Transform parent, string name, Color borderColor, Color fillColor, float borderWidth = 1f)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_003a: 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_006a: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name, new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(parent, false);
			((Graphic)val.GetComponent<Image>()).color = borderColor;
			GameObject val2 = new GameObject("Fill", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val2.transform.SetParent(val.transform, false);
			float num = Mathf.Max(borderWidth, 0.5f);
			val2.GetComponent<RectTransform>().SetAnchor(Vector2.zero, Vector2.one).SetOffsets(new Vector2(num, num), new Vector2(0f - num, 0f - num));
			((Graphic)val2.GetComponent<Image>()).color = fillColor;
			return val;
		}

		public static void AddBorderOutline(Transform parent, Color borderColor, float width = 1f)
		{
			//IL_001c: 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_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_0041: 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_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)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_00a0: 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_00b0: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(width, 0.5f);
			CreateBorderLine(parent, "BorderTop", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 0f - num), Vector2.zero, borderColor);
			CreateBorderLine(parent, "BorderBottom", new Vector2(0f, 0f), new Vector2(1f, 0f), Vector2.zero, new Vector2(0f, num), borderColor);
			CreateBorderLine(parent, "BorderLeft", new Vector2(0f, 0f), new Vector2(0f, 1f), Vector2.zero, new Vector2(num, 0f), borderColor);
			CreateBorderLine(parent, "BorderRight", new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f - num, 0f), Vector2.zero, borderColor);
		}

		private static void CreateBorderLine(Transform parent, string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 offsetMin, Vector2 offsetMax, Color color)
		{
			//IL_0021: 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_0033: 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_004f: 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)
			GameObject val = new GameObject(name, new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(parent, false);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = anchorMin;
			component.anchorMax = anchorMax;
			component.offsetMin = offsetMin;
			component.offsetMax = offsetMax;
			Image component2 = val.GetComponent<Image>();
			((Graphic)component2).color = color;
			((Graphic)component2).raycastTarget = false;
		}

		public static GameObject CreateCyberButton(Transform parent, string name, string labelText, Action onClick, Color borderColor, Color textColor, float width = -1f, float height = 24f, bool enableHover = true)
		{
			//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_0030: 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_0098: 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_00ac: 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_00b7: 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_00da: 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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Expected O, but got Unknown
			//IL_0193: 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_01bd: 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_01c2: 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_01c7: 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_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: 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_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: 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_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(parent, name, borderColor, CyberPalette.ColorVoidBlack);
			float num = ((width > 0f) ? width : 50f);
			val.GetComponent<RectTransform>().SetSizeDelta(new Vector2(num, height));
			val.AddComponent<LayoutElement>().SetDimensions(num, height, num, height);
			Transform val2 = val.transform.Find("Fill");
			Transform val3 = (((Object)(object)val2 != (Object)null) ? val2 : val.transform);
			GameObject val4 = new GameObject("Text", new Type[1] { typeof(RectTransform) });
			val4.SetActive(false);
			val4.transform.SetParent(val3, false);
			val4.GetComponent<RectTransform>().SetAnchor(Vector2.zero, Vector2.one).SetOffsets(new Vector2(3f, 0f), new Vector2(-3f, 0f));
			TextMeshProUGUI val5 = val4.AddComponent<TextMeshProUGUI>();
			TMP_FontAsset val6 = ResolveFont();
			if ((Object)(object)val6 != (Object)null)
			{
				((TMP_Text)val5).font = val6;
				if ((Object)(object)((TMP_Asset)val6).material != (Object)null)
				{
					((TMP_Text)val5).fontSharedMaterial = ((TMP_Asset)val6).material;
				}
			}
			((TMP_Text)val5).text = labelText;
			((TMP_Text)val5).fontSize = GetScaledFontSize(10.5f);
			((Graphic)val5).color = textColor;
			((TMP_Text)val5).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val5).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)val5).overflowMode = (TextOverflowModes)0;
			val4.SetActive(true);
			if (enableHover)
			{
				CyberHoverHandler cyberHoverHandler = val.AddComponent<CyberHoverHandler>();
				Image component = val.GetComponent<Image>();
				Image fillImg = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponent<Image>() : null);
				bool num2 = borderColor == CyberPalette.ColorErrorRed;
				Color hoverBorder = (Color)(num2 ? new Color(1f, 0.45f, 0.45f, 1f) : CyberPalette.ColorIceBlueBright);
				Color value = (Color)(num2 ? new Color(1f, 0.85f, 0.85f, 1f) : Color.white);
				Color value2 = (Color)(num2 ? new Color(0.18f, 0.04f, 0.04f, 1f) : CyberPalette.ColorCardSurface);
				Color value3 = (num2 ? new Color(0.35f, 0.08f, 0.08f, 1f) : new Color(0.12f, 0.22f, 0.32f, 1f));
				Color value4 = (num2 ? Color.white : CyberPalette.ColorIceBlueBright);
				Color white = Color.white;
				cyberHoverHandler.Init(component, borderColor, hoverBorder, fillImg, CyberPalette.ColorVoidBlack, value2, value, value3, val5, textColor, value4, white);
			}
			Button obj = val.AddComponent<Button>();
			((Selectable)obj).transition = (Transition)0;
			((UnityEvent)obj.onClick).AddListener(new UnityAction(onClick.Invoke));
			return val;
		}

		public static TextMeshProUGUI CreateLabel(Transform parent, string name, string text, Color color, float fontSize = 11f, TextAlignmentOptions alignment = (TextAlignmentOptions)513)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_007a: 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)
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.SetActive(false);
			val.transform.SetParent(parent, false);
			TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
			TMP_FontAsset val3 = ResolveFont();
			if ((Object)(object)val3 != (Object)null)
			{
				((TMP_Text)val2).font = val3;
				if ((Object)(object)((TMP_Asset)val3).material != (Object)null)
				{
					((TMP_Text)val2).fontSharedMaterial = ((TMP_Asset)val3).material;
				}
			}
			((TMP_Text)val2).text = text;
			((TMP_Text)val2).fontSize = GetScaledFontSize(fontSize);
			((Graphic)val2).color = color;
			((TMP_Text)val2).alignment = alignment;
			((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)val2).overflowMode = (TextOverflowModes)1;
			val.SetActive(true);
			return val2;
		}

		public static (GameObject Root, TMP_InputField Input) CreateInputField(Transform parent, string name, string initialText, Action<string> onCommit, float width = 120f, float height = 24f, string placeholderText = "", bool multiline = false, bool wrapText = true, float horizontalPadding = 8f)
		{
			//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_0049: 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_0216: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Expected O, but got Unknown
			//IL_015c: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: 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_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0584: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_05df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0623: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0643: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(parent, name, CyberPalette.ColorInputGroove, CyberPalette.ColorInputWell);
			float num = ((width > 0f) ? width : 120f);
			if (height > 0f)
			{
				val.GetComponent<RectTransform>().SetSizeDelta(new Vector2(num, height));
			}
			LayoutElement obj = val.AddComponent<LayoutElement>();
			obj.minWidth = num;
			obj.preferredWidth = ((width > 0f) ? num : (-1f));
			obj.flexibleWidth = ((width > 0f) ? 0f : 1f);
			obj.minHeight = ((height > 0f) ? height : 60f);
			obj.preferredHeight = ((height > 0f) ? height : (-1f));
			obj.flexibleHeight = ((height > 0f) ? 0f : 1f);
			Transform val2 = val.transform.Find("Fill");
			Transform val3 = (((Object)(object)val2 != (Object)null) ? val2 : val.transform);
			Image blImg = null;
			if (!multiline)
			{
				GameObject val4 = new GameObject("BottomAccent", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				val4.transform.SetParent(val3, false);
				val4.GetComponent<RectTransform>().SetAnchor(new Vector2(0f, 0f), new Vector2(1f, 0f)).SetPivot(new Vector2(0.5f, 0f))
					.SetSizeDelta(new Vector2(0f, 1.5f))
					.SetAnchoredPosition(Vector2.zero);
				blImg = val4.GetComponent<Image>();
				((Graphic)blImg).color = CyberPalette.ColorInputAccent;
				((Graphic)blImg).raycastTarget = false;
			}
			float scaledFontSize = GetScaledFontSize(10f);
			GameObject val5 = new GameObject("TextArea", new Type[3]
			{
				typeof(RectTransform),
				typeof(RectMask2D),
				typeof(Image)
			});
			val5.transform.SetParent(val3, false);
			Image component = val5.GetComponent<Image>();
			((Graphic)component).color = Color.clear;
			((Graphic)component).raycastTarget = true;
			float num2 = (multiline ? 6f : Mathf.Max(horizontalPadding, 2f));
			RectTransform textViewport = val5.GetComponent<RectTransform>().SetAnchor(Vector2.zero, Vector2.one).SetOffsets(multiline ? new Vector2(6f, 6f) : new Vector2(num2, 0f), multiline ? new Vector2(-6f, -6f) : new Vector2(0f - num2, 0f));
			GameObject val6 = new GameObject("Text", new Type[1] { typeof(RectTransform) });
			val6.SetActive(false);
			val6.transform.SetParent(val5.transform, false);
			val6.GetComponent<RectTransform>().SetAnchor(Vector2.zero, Vector2.one).SetOffsets(Vector2.zero, Vector2.zero);
			TMP_FontAsset val7 = ResolveFont();
			TextMeshProUGUI val8 = val6.AddComponent<TextMeshProUGUI>();
			if ((Object)(object)val7 != (Object)null)
			{
				((TMP_Text)val8).font = val7;
				if ((Object)(object)((TMP_Asset)val7).material != (Object)null)
				{
					((TMP_Text)val8).fontSharedMaterial = ((TMP_Asset)val7).material;
				}
			}
			((TMP_Text)val8).fontSize = scaledFontSize;
			((Graphic)val8).color = CyberPalette.ColorTextMain;
			((TMP_Text)val8).alignment = (TextAlignmentOptions)(multiline ? 257 : 4097);
			((TMP_Text)val8).textWrappingMode = (TextWrappingModes)((multiline && wrapText) ? 1 : 0);
			((TMP_Text)val8).richText = false;
			((TMP_Text)val8).overflowMode = (TextOverflowModes)0;
			((TMP_Text)val8).maxVisibleCharacters = int.MaxValue;
			((TMP_Text)val8).maxVisibleWords = int.MaxValue;
			((TMP_Text)val8).maxVisibleLines = int.MaxValue;
			((Graphic)val8).raycastTarget = false;
			val6.SetActive(true);
			GameObject val9 = new GameObject("Placeholder", new Type[1] { typeof(RectTransform) });
			val9.SetActive(false);
			val9.transform.SetParent(val5.transform, false);
			val9.GetComponent<RectTransform>().SetAnchor(Vector2.zero, Vector2.one).SetOffsets(Vector2.zero, Vector2.zero);
			TextMeshProUGUI val10 = val9.AddComponent<TextMeshProUGUI>();
			if ((Object)(object)val7 != (Object)null)
			{
				((TMP_Text)val10).font = val7;
				if ((Object)(object)((TMP_Asset)val7).material != (Object)null)
				{
					((TMP_Text)val10).fontSharedMaterial = ((TMP_Asset)val7).material;
				}
			}
			((TMP_Text)val10).fontSize = scaledFontSize;
			((Graphic)val10).color = new Color(0.35f, 0.48f, 0.58f, 0.55f);
			((TMP_Text)val10).text = placeholderText ?? string.Empty;
			((TMP_Text)val10).alignment = (TextAlignmentOptions)(multiline ? 257 : 4097);
			((TMP_Text)val10).textWrappingMode = (TextWrappingModes)((multiline && wrapText) ? 1 : 0);
			((TMP_Text)val10).richText = false;
			((Graphic)val10).raycastTarget = false;
			val9.SetActive(true);
			Image borderImg = val.GetComponent<Image>();
			if ((Object)(object)borderImg != (Object)null)
			{
				((Graphic)borderImg).raycastTarget = true;
			}
			Image val11 = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponent<Image>() : null);
			if ((Object)(object)val11 != (Object)null)
			{
				((Graphic)val11).raycastTarget = false;
			}
			TMP_InputField val12 = val.AddComponent<TMP_InputField>();
			val12.textComponent = (TMP_Text)(object)val8;
			val12.textViewport = textViewport;
			((Selectable)val12).targetGraphic = (Graphic)(object)(((Object)(object)borderImg != (Object)null) ? borderImg : val.GetComponent<Image>());
			val12.placeholder = (Graphic)(object)val10;
			val12.lineType = (LineType)(multiline ? 2 : 0);
			Navigation navigation = default(Navigation);
			((Navigation)(ref navigation)).mode = (Mode)0;
			((Selectable)val12).navigation = navigation;
			((Selectable)val12).transition = (Transition)0;
			val12.customCaretColor = true;
			val12.caretColor = CyberPalette.ColorIceBlueBright;
			val12.caretWidth = 3;
			val12.caretBlinkRate = 0.85f;
			val12.selectionColor = new Color(0.15f, 0.55f, 0.85f, 0.35f);
			if (multiline)
			{
				val12.onFocusSelectAll = false;
			}
			((Behaviour)val12).enabled = false;
			((Behaviour)val12).enabled = true;
			if ((Object)(object)borderImg != (Object)null && !multiline)
			{
				val.AddComponent<CyberHoverHandler>().Init(borderImg, CyberPalette.ColorInputGroove, new Color(0.22f, 0.38f, 0.5f, 0.9f), val11, CyberPalette.ColorInputWell, CyberPalette.ColorInputWell, CyberPalette.ColorIceBlueBright, CyberPalette.ColorInputWell);
			}
			((UnityEvent<string>)(object)val12.onSelect).AddListener((UnityAction<string>)delegate
			{
				//IL_0014: 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)
				if ((Object)(object)borderImg != (Object)null)
				{
					((Graphic)borderImg).color = CyberPalette.ColorIceBlueBright;
				}
				if ((Object)(object)blImg != (Object)null)
				{
					((Graphic)blImg).color = CyberPalette.ColorIceBlueBright;
				}
			});
			((UnityEvent<string>)(object)val12.onDeselect).AddListener((UnityAction<string>)delegate
			{
				//IL_0014: 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)
				if ((Object)(object)borderImg != (Object)null)
				{
					((Graphic)borderImg).color = CyberPalette.ColorInputGroove;
				}
				if ((Object)(object)blImg != (Object)null)
				{
					((Graphic)blImg).color = CyberPalette.ColorInputAccent;
				}
			});
			val12.text = initialText;
			((UnityEvent<string>)(object)val12.onEndEdit).AddListener((UnityAction<string>)delegate(string obj2)
			{
				onCommit?.Invoke(obj2);
			});
			return (Root: val, Input: val12);
		}

		public static RectTransform? AttachTextPadIcon(Transform leftArea, TextMeshProUGUI label)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_005c: 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_007f: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)leftArea == (Object)null || (Object)(object)label == (Object)null)
			{
				return null;
			}
			GameObject val = new GameObject("TextPadIcon", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(leftArea, false);
			RectTransform obj = val.GetComponent<RectTransform>().SetAnchor(new Vector2(0f, 0.5f), new Vector2(0f, 0.5f)).SetPivot(new Vector2(0f, 0.5f))
				.SetSizeDelta(new Vector2(13f, 13f));
			((TMP_Text)label).ForceMeshUpdate(false, false);
			obj.anchoredPosition = new Vector2(((TMP_Text)label).preferredWidth + 6f, 0f);
			Image component = val.GetComponent<Image>();
			component.sprite = IconFactory.GetTextPadIcon();
			((Graphic)component).color = CyberPalette.ColorTextMuted;
			((Graphic)component).raycastTarget = false;
			return obj;
		}

		public static (GameObject Root, Image IconImage) CreateIconButton(Transform parent, string name, Sprite iconSprite, string tooltipHeader, string tooltipBody, Action onClick, Color borderColor, Color iconColor, float size = 24f)
		{
			//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_001e: 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_00b2: 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_00d0: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: 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)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: 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_01b1: 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_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_0236: 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)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: 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_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Expected O, but got Unknown
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(parent, name, borderColor, CyberPalette.ColorVoidBlack);
			val.GetComponent<RectTransform>().SetSizeDelta(new Vector2(size, size));
			LayoutElement obj = val.AddComponent<LayoutElement>();
			obj.minWidth = size;
			obj.preferredWidth = size;
			obj.flexibleWidth = 0f;
			obj.minHeight = size;
			obj.preferredHeight = size;
			obj.flexibleHeight = 0f;
			Transform val2 = val.transform.Find("Fill");
			Transform val3 = (((Object)(object)val2 != (Object)null) ? val2 : val.transform);
			GameObject val4 = new GameObject("Icon", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val4.transform.SetParent(val3, false);
			RectTransform component = val4.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0.5f, 0.5f);
			component.anchorMax = new Vector2(0.5f, 0.5f);
			component.pivot = new Vector2(0.5f, 0.5f);
			component.sizeDelta = new Vector2(16f, 16f);
			component.anchoredPosition = Vector2.zero;
			Image component2 = val4.GetComponent<Image>();
			component2.sprite = iconSprite;
			((Graphic)component2).color = iconColor;
			((Graphic)component2).raycastTarget = false;
			CyberHoverHandler cyberHoverHandler = val.AddComponent<CyberHoverHandler>();
			Image component3 = val.GetComponent<Image>();
			Image fillImg = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponent<Image>() : null);
			bool num = borderColor == CyberPalette.ColorErrorRed;
			bool flag = borderColor == CyberPalette.ColorWarningAmber;
			bool flag2 = borderColor == CyberPalette.ColorGlacialMint;
			Color hoverBorder = (Color)(num ? new Color(1f, 0.45f, 0.45f, 1f) : (flag ? new Color(1f, 0.85f, 0.45f, 1f) : (flag2 ? new Color(0.6f, 1f, 0.9f, 1f) : CyberPalette.ColorIceBlueBright)));
			Color value = (Color)(num ? new Color(0.18f, 0.04f, 0.04f, 1f) : (flag ? new Color(0.18f, 0.14f, 0.04f, 1f) : CyberPalette.ColorCardSurface));
			Color white = Color.white;
			Color value2 = default(Color);
			((Color)(ref value2))..ctor(0.12f, 0.22f, 0.32f, 1f);
			Color white2 = Color.white;
			Color white3 = Color.white;
			cyberHoverHandler.Init(component3, borderColor, hoverBorder, fillImg, CyberPalette.ColorVoidBlack, value, white, value2, null, iconColor, white2, white3);
			Button obj2 = val.AddComponent<Button>();
			((Selectable)obj2).transition = (Transition)0;
			((UnityEvent)obj2.onClick).AddListener(new UnityAction(onClick.Invoke));
			if (!string.IsNullOrEmpty(tooltipHeader) || !string.IsNullOrEmpty(tooltipBody))
			{
				ButtonTooltipHandler.Attach(val, tooltipHeader, tooltipBody);
			}
			return (Root: val, IconImage: component2);
		}
	}
	public static class UIFonts
	{
		private static TMP_FontAsset? _cachedPrimaryFont;

		private static TMP_FontAsset? _cachedTerminalFont;

		private static TMP_FontAsset? _customFontRegular;

		private static TMP_FontAsset? _customFontBold;

		private static bool _customFontLoadAttempted;

		private const string ResourceRegularFont = "BepInEx.ConfigDrawers.Resources.Hack-Regular.ttf";

		private const string ResourceBoldFont = "BepInEx.ConfigDrawers.Resources.Hack-Bold.ttf";

		private const string CacheDirectoryName = "ConfigDrawers";

		private const string FileRegularFont = "Hack-Regular.ttf";

		private const string FileBoldFont = "Hack-Bold.ttf";

		public static TMP_FontAsset? GetPrimaryFont()
		{
			if ((Object)(object)_cachedPrimaryFont != (Object)null)
			{
				return _cachedPrimaryFont;
			}
			TMP_FontAsset terminalFont = GetTerminalFont();
			if ((Object)(object)terminalFont != (Object)null)
			{
				_cachedPrimaryFont = terminalFont;
				return _cachedPrimaryFont;
			}
			try
			{
				TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
				if (array != null && array.Length != 0)
				{
					TMP_FontAsset[] array2 = array;
					foreach (TMP_FontAsset val in array2)
					{
						if (!((Object)(object)val == (Object)null) && !string.IsNullOrEmpty(((Object)val).name))
						{
							string text = ((Object)val).name.ToLowerInvariant();
							if ((text.Contains("valheim") || text.Contains("averia")) && !text.Contains("norse") && !text.Contains("bold") && !text.Contains("prstart") && val.characterTable != null && val.characterTable.Count > 0)
							{
								SetCachedFont(val);
								return _cachedPrimaryFont;
							}
						}
					}
					array2 = array;
					foreach (TMP_FontAsset val2 in array2)
					{
						if (!((Object)(object)val2 == (Object)null) && !string.IsNullOrEmpty(((Object)val2).name))
						{
							string text2 = ((Object)val2).name.ToLowerInvariant();
							if (!text2.Contains("prstart") && !text2.Contains("norse") && val2.characterTable != null && val2.characterTable.Count > 0)
							{
								SetCachedFont(val2);
								return _cachedPrimaryFont;
							}
						}
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? log = ConfigDrawers.Log;
				if (log != null)
				{
					log.LogWarning((object)("[ConfigDrawers] Failed during fallback font discovery: " + ex.Message));
				}
			}
			return null;
		}

		public static TMP_FontAsset? GetTerminalFont()
		{
			if ((Object)(object)_cachedTerminalFont != (Object)null)
			{
				return _cachedTerminalFont;
			}
			EnsureCustomFontLoaded();
			if ((Object)(object)_customFontRegular != (Object)null)
			{
				_cachedTerminalFont = _customFontRegular;
				return _cachedTerminalFont;
			}
			try
			{
				TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
				if (array != null && array.Length != 0)
				{
					TMP_FontAsset[] array2 = array;
					foreach (TMP_FontAsset val in array2)
					{
						if (!((Object)(object)val == (Object)null) && !string.IsNullOrEmpty(((Object)val).name))
						{
							string text = ((Object)val).name.ToLowerInvariant();
							if ((text.Contains("hack") || text.Contains("mono") || text.Contains("consolas")) && val.characterTable != null && val.characterTable.Count > 0)
							{
								_cachedTerminalFont = val;
								return _cachedTerminalFont;
							}
						}
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? log = ConfigDrawers.Log;
				if (log != null)
				{
					log.LogWarning((object)("[ConfigDrawers] Failed during terminal font discovery: " + ex.Message));
				}
			}
			return GetPrimaryFont();
		}

		public static void RefreshAllFonts(GameObject root)
		{
			if ((Object)(object)root == (Object)null)
			{
				return;
			}
			TMP_FontAsset primaryFont = GetPrimaryFont();
			if ((Object)(object)primaryFont == (Object)null)
			{
				return;
			}
			TextMeshProUGUI[] componentsInChildren = root.GetComponentsInChildren<TextMeshProUGUI>(true);
			foreach (TextMeshProUGUI val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null)
				{
					((TMP_Text)val).font = primaryFont;
					if ((Object)(object)((TMP_Asset)primaryFont).material != (Object)null)
					{
						((TMP_Text)val).fontSharedMaterial = ((TMP_Asset)primaryFont).material;
					}
				}
			}
		}

		private static void EnsureCustomFontLoaded()
		{
			if (_customFontLoadAttempted)
			{
				return;
			}
			_customFontLoadAttempted = true;
			_customFontRegular = CreateFontFromTtf("BepInEx.ConfigDrawers.Resources.Hack-Regular.ttf", "Hack-Regular.ttf");
			_customFontBold = CreateFontFromTtf("BepInEx.ConfigDrawers.Resources.Hack-Bold.ttf", "Hack-Bold.ttf");
			if (!((Object)(object)_customFontRegular != (Object)null) || !((Object)(object)((TMP_Asset)_customFontRegular).material != (Object)null))
			{
				return;
			}
			TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
			if (array == null || array.Length == 0)
			{
				return;
			}
			TMP_FontAsset[] array2 = array;
			foreach (TMP_FontAsset val in array2)
			{
				if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)_customFontRegular && (Object)(object)((TMP_Asset)val).material != (Object)null && (Object)(object)((TMP_Asset)val).material.shader != (Object)null)
				{
					((TMP_Asset)_customFontRegular).material.shader = ((TMP_Asset)val).material.shader;
					if ((Object)(object)_customFontBold != (Object)null && (Object)(object)((TMP_Asset)_customFontBold).material != (Object)null)
					{
						((TMP_Asset)_customFontBold).material.shader = ((TMP_Asset)val).material.shader;
					}
					break;
				}
			}
		}

		private static TMP_FontAsset? CreateFontFromTtf(string resourceName, string fontFileName)
		{
			try
			{
				using Stream stream = typeof(UIFonts).Assembly.GetManifestResourceStream(resourceName);
				if (stream == null)
				{
					ManualLogSource? log = ConfigDrawers.Log;
					if (log != null)
					{
						log.LogWarning((object)("[ConfigDrawers] TTF resource stream not found: " + resourceName));
					}
					return null;
				}
				string text = Path.Combine(Paths.CachePath, "ConfigDrawers");
				if (!Directory.Exists(text))
				{
					Directory.CreateDirectory(text);
				}
				string text2 = Path.Combine(text, fontFileName);
				using (FileStream destination = new FileStream(text2, FileMode.Create, FileAccess.Write))
				{
					stream.CopyTo(destination);
				}
				TMP_FontAsset val = TMP_FontAsset.CreateFontAsset(text2, 0, 36, 5, (GlyphRenderMode)4165, 1024, 1024);
				if ((Object)(object)val != (Object)null)
				{
					ManualLogSource? log2 = ConfigDrawers.Log;
					if (log2 != null)
					{
						log2.LogInfo((object)("[ConfigDrawers] Generated dynamic TMP font asset from " + fontFileName));
					}
					return val;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? log3 = ConfigDrawers.Log;
				if (log3 != null)
				{
					log3.LogWarning((object)("[ConfigDrawers] Error creating dynamic font from " + fontFileName + ": " + ex.Message));
				}
			}
			return null;
		}

		private static void SetCachedFont(TMP_FontAsset font)
		{
			_cachedPrimaryFont = font;
			try
			{
				if ((Object)(object)TMP_Settings.defaultFontAsset == (Object)null)
				{
					TMP_Settings.defaultFontAsset = font;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? log = ConfigDrawers.Log;
				if (log != null)
				{
					log.LogWarning((object)("[ConfigDrawers] Failed setting TMP_Settings.defaultFontAsset: " + ex.Message));
				}
			}
		}
	}
}
namespace BepInEx.ConfigDrawers.Patches
{
	[HarmonyPatch]
	internal static class ConfigurationManagerRightColumnWidthPatch
	{
		private const int MinimumRightColumnWidth = 200;

		private const int TargetRightColumnWidth = 350;

		[HarmonyPrepare]
		internal static bool Prepare()
		{
			return AccessTools.TypeByName("ConfigurationManager.ConfigurationManager") != null;
		}

		[HarmonyTargetMethods]
		internal static IEnumerable<MethodBase> TargetMethods()
		{
			List<MethodBase> list = new List<MethodBase>();
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				try
				{
					Type type = assembly.GetType("ConfigurationManager.ConfigurationManager");
					if (type != null)
					{
						MethodInfo methodInfo = AccessTools.PropertyGetter(type, "RightColumnWidth");
						if (methodInfo != null)
						{
							list.Add(methodInfo);
						}
					}
				}
				catch (Exception ex)
				{
					ManualLogSource? log = ConfigDrawers.Log;
					if (log != null)
					{
						log.LogDebug((object)("[ConfigDrawers] Dynamic assembly inspection skipped " + assembly.FullName + ": " + ex.Message));
					}
				}
			}
			return list;
		}

		[HarmonyPostfix]
		private static void Postfix(ref int __result)
		{
			if (__result <= 0 || __result < 200)
			{
				__result = 350;
			}
		}
	}
	internal static class DynamicInputBlocker
	{
		private static bool _initialized;

		private static bool _discoveryComplete;

		private static int _discoveryScanCount;

		private const int MaxDiscoveryScans = 60;

		private static Harmony? _harmony;

		private static ManualLogSource? _logger;

		private static readonly Assembly _ourAssembly = typeof(DynamicInputBlocker).Assembly;

		private static readonly HashSet<Type> _attachedTypes = new HashSet<Type>();

		private static readonly HashSet<MethodBase> _patchedMethods = new HashSet<MethodBase>();

		private static MethodInfo? _getKeyDownMethod;

		private static MethodInfo? _wasPressedGetter;

		private static MethodInfo? _suppressBoolPrefix;

		private static MethodInfo? _suppressFloatPrefix;

		private static MethodInfo? _suppressAxisPrefix;

		private static MethodInfo? _suppressVoidPrefix;

		public static void Initialize(Harmony harmony, ManualLogSource logger)
		{
			if (!_initialized)
			{
				_initialized = true;
				_harmony = harmony;
				_logger = logger;
				_suppressBoolPrefix = AccessTools.Method(typeof(DynamicInputBlocker), "SuppressBoolPrefix", (Type[])null, (Type[])null);
				_suppressFloatPrefix = AccessTools.Method(typeof(DynamicInputBlocker), "SuppressFloatPrefix", (Type[])null, (Type[])null);
				_suppressAxisPrefix = AccessTools.Method(typeof(DynamicInputBlocker), "SuppressAxisPrefix", (Type[])null, (Type[])null);
				_suppressVoidPrefix = AccessTools.Method(typeof(DynamicInputBlocker), "SuppressVoidPrefix", (Type[])null, (Type[])null);
				StartUnityDiscoveryHooks(harmony);
			}
		}

		private static void StartUn