use std::collections::HashMap;
use std::sync::LazyLock;

/// Maps lowercased NSIS instruction names to their canonical casing.
pub static CANONICAL_CASING: LazyLock<HashMap<&'static str, &'static str>> = LazyLock::new(|| {
	HashMap::from([
		// Compiler commands (all lowercase by convention)
		("!addincludedir", "!addincludedir"),
		("!addplugindir", "!addplugindir"),
		("!appendfile", "!appendfile"),
		("!appendmemfile", "!appendmemfile"),
		("!assert", "!assert"),
		("!cd", "!cd"),
		("!define", "!define"),
		("!delfile", "!delfile"),
		("!echo", "!echo"),
		("!else", "!else"),
		("!elseif", "!elseif"),
		("!endif", "!endif"),
		("!error", "!error"),
		("!execute", "!execute"),
		("!finalize", "!finalize"),
		("!getdllversion", "!getdllversion"),
		("!gettlbversion", "!gettlbversion"),
		("!if", "!if"),
		("!ifdef", "!ifdef"),
		("!ifmacrodef", "!ifmacrodef"),
		("!ifmacrondef", "!ifmacrondef"),
		("!ifndef", "!ifndef"),
		("!include", "!include"),
		("!insertmacro", "!insertmacro"),
		("!macro", "!macro"),
		("!macroend", "!macroend"),
		("!macroundef", "!macroundef"),
		("!makensis", "!makensis"),
		("!packhdr", "!packhdr"),
		("!pragma", "!pragma"),
		("!searchparse", "!searchparse"),
		("!searchreplace", "!searchreplace"),
		("!system", "!system"),
		("!tempfile", "!tempfile"),
		("!undef", "!undef"),
		("!uninstfinalize", "!uninstfinalize"),
		("!verbose", "!verbose"),
		("!warning", "!warning"),
		// Instructions & block keywords (canonical PascalCase)
		("abort", "Abort"),
		("addbrandingimage", "AddBrandingImage"),
		("addsize", "AddSize"),
		("allowrootdirinstall", "AllowRootDirInstall"),
		("allowskipfiles", "AllowSkipFiles"),
		("autoclosewindow", "AutoCloseWindow"),
		("bgfont", "BGFont"),
		("bggradient", "BGGradient"),
		("brandingtext", "BrandingText"),
		("bringtofront", "BringToFront"),
		("call", "Call"),
		("callinstdll", "CallInstDLL"),
		("caption", "Caption"),
		("changeui", "ChangeUI"),
		("checkbitmap", "CheckBitmap"),
		("clearerrors", "ClearErrors"),
		("completedtext", "CompletedText"),
		("componenttext", "ComponentText"),
		("copyfiles", "CopyFiles"),
		("cpu", "CPU"),
		("crccheck", "CRCCheck"),
		("createdirectory", "CreateDirectory"),
		("createfont", "CreateFont"),
		("createshortcut", "CreateShortcut"),
		("delete", "Delete"),
		("deleteinisec", "DeleteINISec"),
		("deleteinistr", "DeleteINIStr"),
		("deleteregkey", "DeleteRegKey"),
		("deleteregvalue", "DeleteRegValue"),
		("detailprint", "DetailPrint"),
		("detailsbuttontext", "DetailsButtonText"),
		("dirshow", "DirShow"),
		("dirtext", "DirText"),
		("dirvar", "DirVar"),
		("dirverify", "DirVerify"),
		("enablewindow", "EnableWindow"),
		("enumregkey", "EnumRegKey"),
		("enumregvalue", "EnumRegValue"),
		("exch", "Exch"),
		("exec", "Exec"),
		("execshell", "ExecShell"),
		("execshellwait", "ExecShellWait"),
		("execwait", "ExecWait"),
		("expandenvstrings", "ExpandEnvStrings"),
		("file", "File"),
		("filebufsize", "FileBufSize"),
		("fileclose", "FileClose"),
		("fileerrortext", "FileErrorText"),
		("fileopen", "FileOpen"),
		("fileread", "FileRead"),
		("filereadbyte", "FileReadByte"),
		("filereadutf16le", "FileReadUTF16LE"),
		("filereadword", "FileReadWord"),
		("fileseek", "FileSeek"),
		("filewrite", "FileWrite"),
		("filewritebyte", "FileWriteByte"),
		("filewriteutf16le", "FileWriteUTF16LE"),
		("filewriteword", "FileWriteWord"),
		("findclose", "FindClose"),
		("findfirst", "FindFirst"),
		("findnext", "FindNext"),
		("findwindow", "FindWindow"),
		("flushini", "FlushINI"),
		("function", "Function"),
		("functionend", "FunctionEnd"),
		("getcurinsttype", "GetCurInstType"),
		("getcurrentaddress", "GetCurrentAddress"),
		("getdlgitem", "GetDlgItem"),
		("getdllversion", "GetDLLVersion"),
		("getdllversionlocal", "GetDLLVersionLocal"),
		("geterrorlevel", "GetErrorLevel"),
		("getfiletime", "GetFileTime"),
		("getfiletimelocal", "GetFileTimeLocal"),
		("getfullpathname", "GetFullPathName"),
		("getfunctionaddress", "GetFunctionAddress"),
		("getinstdirerror", "GetInstDirError"),
		("getknownfolderpath", "GetKnownFolderPath"),
		("getlabeladdress", "GetLabelAddress"),
		("getregview", "GetRegView"),
		("getshellvarcontext", "GetShellVarContext"),
		("gettempfilename", "GetTempFileName"),
		("getwinver", "GetWinVer"),
		("goto", "Goto"),
		("hidewindow", "HideWindow"),
		("icon", "Icon"),
		("ifabort", "IfAbort"),
		("ifaltregview", "IfAltRegView"),
		("iferrors", "IfErrors"),
		("iffileexists", "IfFileExists"),
		("ifrebootflag", "IfRebootFlag"),
		("ifrtllanguage", "IfRtlLanguage"),
		("ifshellvarcontextall", "IfShellVarContextAll"),
		("ifsilent", "IfSilent"),
		("initpluginsdir", "InitPluginsDir"),
		("installbuttontext", "InstallButtonText"),
		("installcolors", "InstallColors"),
		("installdir", "InstallDir"),
		("installdirregkey", "InstallDirRegKey"),
		("instprogressflags", "InstProgressFlags"),
		("insttype", "InstType"),
		("insttypegettext", "InstTypeGetText"),
		("insttypesettext", "InstTypeSetText"),
		("int64cmp", "Int64Cmp"),
		("int64cmpu", "Int64CmpU"),
		("int64fmt", "Int64Fmt"),
		("intcmp", "IntCmp"),
		("intcmpu", "IntCmpU"),
		("intfmt", "IntFmt"),
		("intop", "IntOp"),
		("intptrcmp", "IntPtrCmp"),
		("intptrcmpu", "IntPtrCmpU"),
		("intptrop", "IntPtrOp"),
		("iswindow", "IsWindow"),
		("langstring", "LangString"),
		("langstringup", "LangStringUP"),
		("licensebkcolor", "LicenseBkColor"),
		("licensedata", "LicenseData"),
		("licenseforceselection", "LicenseForceSelection"),
		("licenselangstring", "LicenseLangString"),
		("licensetext", "LicenseText"),
		("loadandsetimage", "LoadAndSetImage"),
		("loadlanguagefile", "LoadLanguageFile"),
		("lockwindow", "LockWindow"),
		("logset", "LogSet"),
		("logtext", "LogText"),
		("manifestappendcustomstring", "ManifestAppendCustomString"),
		(
			"manifestdisablewindowfiltering",
			"ManifestDisableWindowFiltering",
		),
		("manifestdpiaware", "ManifestDPIAware"),
		("manifestdpiawareness", "ManifestDPIAwareness"),
		("manifestgdiscaling", "ManifestGdiScaling"),
		("manifestlongpathaware", "ManifestLongPathAware"),
		("manifestmaxversiontested", "ManifestMaxVersionTested"),
		("manifestsupportedos", "ManifestSupportedOS"),
		("messagebox", "MessageBox"),
		("miscbuttontext", "MiscButtonText"),
		("name", "Name"),
		("nop", "Nop"),
		("outfile", "OutFile"),
		("page", "Page"),
		("pagecallbacks", "PageCallbacks"),
		("pageex", "PageEx"),
		("pageexend", "PageExEnd"),
		("peaddresource", "PEAddResource"),
		("pedllcharacteristics", "PEDllCharacteristics"),
		("peremoveresource", "PERemoveResource"),
		("pesubsysver", "PESubsysVer"),
		("pop", "Pop"),
		("push", "Push"),
		("quit", "Quit"),
		("readenvstr", "ReadEnvStr"),
		("readinistr", "ReadINIStr"),
		("readmemory", "ReadMemory"),
		("readregdword", "ReadRegDWORD"),
		("readregstr", "ReadRegStr"),
		("reboot", "Reboot"),
		("regdll", "RegDLL"),
		("rename", "Rename"),
		("requestexecutionlevel", "RequestExecutionLevel"),
		("reservefile", "ReserveFile"),
		("return", "Return"),
		("rmdir", "RMDir"),
		("searchpath", "SearchPath"),
		("section", "Section"),
		("sectionend", "SectionEnd"),
		("sectiongetflags", "SectionGetFlags"),
		("sectiongetinsttypes", "SectionGetInstTypes"),
		("sectiongetsize", "SectionGetSize"),
		("sectiongettext", "SectionGetText"),
		("sectiongroup", "SectionGroup"),
		("sectiongroupend", "SectionGroupEnd"),
		("sectionin", "SectionIn"),
		("sectioninsttype", "SectionInstType"),
		("sectionsetflags", "SectionSetFlags"),
		("sectionsetinsttypes", "SectionSetInstTypes"),
		("sectionsetsize", "SectionSetSize"),
		("sectionsettext", "SectionSetText"),
		("sendmessage", "SendMessage"),
		("setautoclose", "SetAutoClose"),
		("setbrandingimage", "SetBrandingImage"),
		("setcompress", "SetCompress"),
		("setcompressionlevel", "SetCompressionLevel"),
		("setcompressor", "SetCompressor"),
		("setcompressordictsize", "SetCompressorDictSize"),
		("setctlcolors", "SetCtlColors"),
		("setcurinsttype", "SetCurInstType"),
		("setdatablockoptimize", "SetDatablockOptimize"),
		("setdatesave", "SetDateSave"),
		("setdetailsprint", "SetDetailsPrint"),
		("setdetailsview", "SetDetailsView"),
		("seterrorlevel", "SetErrorLevel"),
		("seterrors", "SetErrors"),
		("setfileattributes", "SetFileAttributes"),
		("setfont", "SetFont"),
		("setoutpath", "SetOutPath"),
		("setoverwrite", "SetOverwrite"),
		("setpluginunload", "SetPluginUnload"),
		("setrebootflag", "SetRebootFlag"),
		("setregview", "SetRegView"),
		("setshellvarcontext", "SetShellVarContext"),
		("setsilent", "SetSilent"),
		("showinstdetails", "ShowInstDetails"),
		("showuninstdetails", "ShowUninstDetails"),
		("showwindow", "ShowWindow"),
		("silentinstall", "SilentInstall"),
		("silentuninstall", "SilentUnInstall"),
		("sleep", "Sleep"),
		("spacetexts", "SpaceTexts"),
		("strcmp", "StrCmp"),
		("strcmps", "StrCmpS"),
		("strcpy", "StrCpy"),
		("strlen", "StrLen"),
		("subcaption", "SubCaption"),
		("subsection", "SubSection"),
		("subsectionend", "SubSectionEnd"),
		("target", "Target"),
		("unicode", "Unicode"),
		("uninstallbuttontext", "UninstallButtonText"),
		("uninstallcaption", "UninstallCaption"),
		("uninstallexename", "UninstallExeName"),
		("uninstallicon", "UninstallIcon"),
		("uninstallsubcaption", "UninstallSubCaption"),
		("uninstalltext", "UninstallText"),
		("uninstpage", "UninstPage"),
		("unregdll", "UnRegDLL"),
		("unsafestrcpy", "UnsafeStrCpy"),
		("var", "Var"),
		("viaddversionkey", "VIAddVersionKey"),
		("vifileversion", "VIFileVersion"),
		("viproductversion", "VIProductVersion"),
		("windowicon", "WindowIcon"),
		("writeinistr", "WriteINIStr"),
		("writeregbin", "WriteRegBin"),
		("writeregdword", "WriteRegDWORD"),
		("writeregexpandstr", "WriteRegExpandStr"),
		("writeregmultistr", "WriteRegMultiStr"),
		("writeregnone", "WriteRegNone"),
		("writeregstr", "WriteRegStr"),
		("writeuninstaller", "WriteUninstaller"),
		("xpstyle", "XPStyle"),
	])
});
